mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
事件系统优化更新
事件系统优化更新 1.使用静态代替单例,静态方法调用时候内存地址无需二次偏移定位 2.UI事件在关闭UI时自动反监听
This commit is contained in:
@@ -11,7 +11,7 @@ public class EntityTestMain : MonoBehaviour
|
||||
{
|
||||
//Demo示例,监听TEngine流程加载器OnStartGame事件
|
||||
//抛出这个事件说明框架流程加载完成(热更新,初始化等)
|
||||
GameEventMgr.Instance.AddEventListener(TEngineEvent.OnStartGame,OnStartGame);
|
||||
GameEvent.AddEventListener(TEngineEvent.OnStartGame,OnStartGame);
|
||||
}
|
||||
|
||||
private void OnStartGame()
|
||||
|
@@ -40,9 +40,9 @@ namespace TEngine.Demo.TEngine.EntityDemo
|
||||
/// </summary>
|
||||
void RegisterEvent()
|
||||
{
|
||||
GameEventMgr.Instance.AddEventListener<IEntity, float, object>(EntityEvent.ShowEntitySuccess, OnShowEntitySuccess);
|
||||
GameEventMgr.Instance.AddEventListener<int, string, string, string, object>(EntityEvent.ShowEntityFailure, OnShowEntityFailure);
|
||||
GameEventMgr.Instance.AddEventListener<int, string, IEntityGroup, object>(EntityEvent.HideEntityComplete, OnHideEntityComplete);
|
||||
GameEvent.AddEventListener<IEntity, float, object>(EntityEvent.ShowEntitySuccess, OnShowEntitySuccess);
|
||||
GameEvent.AddEventListener<int, string, string, string, object>(EntityEvent.ShowEntityFailure, OnShowEntityFailure);
|
||||
GameEvent.AddEventListener<int, string, IEntityGroup, object>(EntityEvent.HideEntityComplete, OnHideEntityComplete);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user