update: fix Debugger issue
parent
cdf379be10
commit
54ef66a97d
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示 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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
|
|
@ -175,7 +174,6 @@ namespace Guru
|
|||
continue;
|
||||
}
|
||||
|
||||
|
||||
foreach (var item in ol.items)
|
||||
{
|
||||
switch (item.type)
|
||||
|
|
@ -191,9 +189,6 @@ namespace Guru
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -275,38 +270,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
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue