| | 1 | | // Copyright (c) 2020-2024 dotBunny Inc. |
| | 2 | | // dotBunny licenses this file to you under the BSL-1.0 license. |
| | 3 | | // See the LICENSE file in the project root for more information. |
| | 4 | |
|
| | 5 | | namespace GDX.Developer.ConsoleCommands |
| | 6 | | { |
| | 7 | | #if UNITY_2022_2_OR_NEWER |
| | 8 | | public class WatchAllConsoleCommand : ConsoleCommandBase |
| | 9 | | { |
| | 10 | | bool m_DesiredState; |
| | 11 | |
|
| | 12 | | public override bool Evaluate(float deltaTime) |
| 0 | 13 | | { |
| 0 | 14 | | if (m_DesiredState) |
| 0 | 15 | | { |
| 0 | 16 | | WatchProvider.SetAllEnabled(); |
| 0 | 17 | | } |
| | 18 | | else |
| 0 | 19 | | { |
| 0 | 20 | | WatchProvider.SetAllDisabled(); |
| 0 | 21 | | } |
| 0 | 22 | | return true; |
| 0 | 23 | | } |
| | 24 | |
|
| | 25 | | /// <inheritdoc /> |
| | 26 | | public override string GetKeyword() |
| 7 | 27 | | { |
| 7 | 28 | | return "watch.all"; |
| 7 | 29 | | } |
| | 30 | |
|
| | 31 | | /// <inheritdoc /> |
| | 32 | | public override string GetHelpUsage() |
| 0 | 33 | | { |
| 0 | 34 | | return "watch.all <state>"; |
| 0 | 35 | | } |
| | 36 | |
|
| | 37 | | /// <inheritdoc /> |
| | 38 | | public override string GetHelpMessage() |
| 0 | 39 | | { |
| 0 | 40 | | return "Sets the state of all known watches."; |
| 0 | 41 | | } |
| | 42 | |
|
| | 43 | | /// <inheritdoc /> |
| | 44 | | public override ConsoleCommandBase GetInstance(string context) |
| 0 | 45 | | { |
| 0 | 46 | | if (string.IsNullOrEmpty(context)) |
| 0 | 47 | | { |
| 0 | 48 | | UnityEngine.Debug.LogWarning($"A state must be given to apply to all watches."); |
| 0 | 49 | | return null; |
| | 50 | | } |
| | 51 | |
|
| 0 | 52 | | return new WatchAllConsoleCommand() |
| | 53 | | { |
| | 54 | | m_DesiredState = context.IsBooleanPositiveValue() |
| | 55 | | }; |
| 0 | 56 | | } |
| | 57 | | } |
| | 58 | | #endif // UNITY_2022_2_OR_NEWER |
| | 59 | | } |