diff --git a/Runtime/Code/SDK/GuruSDK.Debugger.cs b/Runtime/Code/SDK/GuruSDK.Debugger.cs index 3524df6..32b3b99 100644 --- a/Runtime/Code/SDK/GuruSDK.Debugger.cs +++ b/Runtime/Code/SDK/GuruSDK.Debugger.cs @@ -1,3 +1,5 @@ +using System; + namespace Guru { using UnityEngine; @@ -5,6 +7,18 @@ namespace Guru public partial class GuruSDK { private static bool _isDebuggerInited = false; + private static bool _useBaseOpions = true; + + private static Debugger _debugger; + + public static Debugger Debugger + { + get + { + if (_debugger == null) _debugger = Debugger.Instance; + return _debugger; + } + } /// /// 显示 Debugger @@ -17,10 +31,9 @@ namespace Guru return false; } - if (!_isDebuggerInited) + if (_useBaseOpions) { InitDebuggerLayout(); - _isDebuggerInited = true; } Debugger.Show(); // 显示 Debugger 界面 @@ -99,6 +112,11 @@ namespace Guru return res; } + public static Debugger.OptionLayout AddOption(string uri, string content = "", Action clickHandler = null) + { + return Debugger.AddOption(uri, content, clickHandler); + } + } } \ No newline at end of file diff --git a/Runtime/Debugger/Runtime/Code/Core/Debugger.cs b/Runtime/Debugger/Runtime/Code/Core/Debugger.cs index 68e8421..f644fe5 100644 --- a/Runtime/Debugger/Runtime/Code/Core/Debugger.cs +++ b/Runtime/Debugger/Runtime/Code/Core/Debugger.cs @@ -10,7 +10,7 @@ namespace Guru using System.Linq; - public class Debugger: IUpdater + public class Debugger { public const string Version = "1.0.0"; private static bool _initOnce = false; @@ -64,8 +64,6 @@ namespace Guru _initOnce = true; _instance = new Debugger(); _instance.StartService(); - - // GuruSDK.RegisterUpdater(_instance); } private void StartService() @@ -135,7 +133,8 @@ namespace Guru public void ShowPage(string tabName = "") { - if (string.IsNullOrEmpty(tabName)) + if (string.IsNullOrEmpty(tabName) + && optionDicts != null && optionDicts.Count > 0) { tabName = optionDicts.Keys.First(); } @@ -174,8 +173,7 @@ namespace Guru ui.Clickable = true; continue; } - - + foreach (var item in ol.items) { switch (item.type) @@ -191,9 +189,6 @@ namespace Guru break; } } - - - } } else @@ -274,38 +269,6 @@ namespace Guru } #endregion - - - - - #region API - - private UpdaterState _state = UpdaterState.Prepare; - public UpdaterState State => _state; - public void Start() - { - _state = UpdaterState.Running; - } - - public void OnUpdate() - { - if(Time.frameCount%5 == 0) - { - RenderPage(_curTabName); - } - } - - public void Pause(bool paused) - { - _state = paused ? UpdaterState.Pause : UpdaterState.Running; - } - - public void Kill() - { - _state = UpdaterState.Kill; - } - - #endregion }