diff --git a/Assets/00.StaryEvo/Runtime/Architecture/Architecture.cs b/Assets/00.StaryEvo/Runtime/Architecture/Architecture.cs index 0cf761d..a69c7dd 100644 --- a/Assets/00.StaryEvo/Runtime/Architecture/Architecture.cs +++ b/Assets/00.StaryEvo/Runtime/Architecture/Architecture.cs @@ -9,7 +9,7 @@ namespace Stary.Evo /// 架构 /// /// - public abstract class Architecture : IArchitecture where T : Architecture, new() + public abstract class Architecture : IDisposable, IArchitecture where T : Architecture, new() { /// /// 是否已经初始化完成 @@ -91,7 +91,7 @@ namespace Stary.Evo } // // 提供一个释放模块的 API - public void Dispose() + public void OnDispose() { for (int i = 0; i < mArchitecture.mSystems.Count; i++) { @@ -102,8 +102,9 @@ namespace Stary.Evo { mArchitecture.mDatas[i].Dispose(); } + _mEnumEventSystem.Dispose(); - _mEnumEventSystem=null; + _mEnumEventSystem = null; mArchitecture = null; } @@ -336,46 +337,53 @@ namespace Stary.Evo /// /// /// - public void UnRegisterEvent(TEvent key, Action onEvent)where TEvent : IConvertible + public void UnRegisterEvent(TEvent key, Action onEvent) where TEvent : IConvertible { - _mEnumEventSystem.UnRegister(key,onEvent); + _mEnumEventSystem.UnRegister(key, onEvent); } + /// /// 事件销毁 /// /// /// - public void UnRegisterEvent(TEvent key, Action< Tvalue1> onEvent)where TEvent : IConvertible + public void UnRegisterEvent(TEvent key, Action onEvent) where TEvent : IConvertible { - _mEnumEventSystem.UnRegister(key,onEvent); + _mEnumEventSystem.UnRegister(key, onEvent); } + /// /// 事件销毁 /// /// /// - public void UnRegisterEvent(TEvent key, Action onEvent)where TEvent : IConvertible + public void UnRegisterEvent(TEvent key, Action onEvent) + where TEvent : IConvertible { - _mEnumEventSystem.UnRegister(key,onEvent); + _mEnumEventSystem.UnRegister(key, onEvent); } + /// /// 事件销毁 /// /// /// - public void UnRegisterEvent(TEvent key, Action onEvent)where TEvent : IConvertible + public void UnRegisterEvent(TEvent key, Action onEvent) + where TEvent : IConvertible { - _mEnumEventSystem.UnRegister(key,onEvent); + _mEnumEventSystem.UnRegister(key, onEvent); } + /// /// 事件销毁 /// /// /// - public void UnRegisterEvent(TEvent key, Action onEvent)where TEvent : IConvertible + public void UnRegisterEvent(TEvent key, Action onEvent) where TEvent : IConvertible { - _mEnumEventSystem.UnRegister(key,onEvent); + _mEnumEventSystem.UnRegister(key, onEvent); } + public TResult SendQuery(IQuery query) { return DoQuery(query); @@ -386,5 +394,10 @@ namespace Stary.Evo query.SetArchitecture(this); return query.Do(); } + + public void Dispose() + { + OnDispose(); + } } } \ No newline at end of file diff --git a/Assets/00.StaryEvo/Runtime/Architecture/IArchitecture.cs b/Assets/00.StaryEvo/Runtime/Architecture/IArchitecture.cs index 66bde90..148e23c 100644 --- a/Assets/00.StaryEvo/Runtime/Architecture/IArchitecture.cs +++ b/Assets/00.StaryEvo/Runtime/Architecture/IArchitecture.cs @@ -170,6 +170,6 @@ namespace Stary.Evo TResult SendQuery(IQuery query); - void Dispose(); + void OnDispose(); } } \ No newline at end of file diff --git a/Assets/00.StaryEvo/package.json b/Assets/00.StaryEvo/package.json index 74b9589..fa4e332 100644 --- a/Assets/00.StaryEvo/package.json +++ b/Assets/00.StaryEvo/package.json @@ -1,6 +1,6 @@ { "name": "com.staryevo.main", - "version": "1.3.27", + "version": "1.3.28", "displayName": "00.StaryEvo", "description": "This is an Framework package(后台服务器版本,端口9527)", "unity": "2021.3",