事件系统优化更新

事件系统优化更新
1.使用静态代替单例,静态方法调用时候内存地址无需二次偏移定位
2.UI事件在关闭UI时自动反监听
This commit is contained in:
ALEXTANG
2022-10-26 15:14:04 +08:00
parent 2e175fbcac
commit 74092e6399
37 changed files with 905 additions and 1187 deletions

View File

@@ -10,9 +10,10 @@ public class UITestMain : MonoBehaviour
{
//Demo示例监听TEngine流程加载器OnStartGame事件
//抛出这个事件说明框架流程加载完成(热更新,初始化等)
GameEventMgr.Instance.AddEventListener(TEngineEvent.OnStartGame,OnStartGame);
GameEvent.AddEventListener(TEngineEvent.OnStartGame,OnStartGame);
}
private int _loopTime = 0;
/// <summary>
/// OnStartGame
/// </summary>
@@ -20,5 +21,17 @@ public class UITestMain : MonoBehaviour
{
// 激活UI系统
UISys.Instance.Active();
UISys.Mgr.ShowWindow<TestUI>();
TimerMgr.Instance.AddTimer((args =>
{
_loopTime++;
GameEvent.Send(TestUI.TestEvent);
if (_loopTime > 7)
{
UISys.Mgr.CloseWindow<TestUI>();
}
}), 1f, true);
}
}