diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Boot.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Boot.cs index 742cc5e..acb1a1d 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Boot.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Boot.cs @@ -1,6 +1,6 @@ using UnityEngine; using UniFramework.Event; -using UniFramework.Module; +using UniFramework.Singleton; using YooAsset; public class Boot : MonoBehaviour @@ -21,15 +21,15 @@ public class Boot : MonoBehaviour // 初始化事件系统 UniEvent.Initalize(); - // 初始化管理系统 - UniModule.Initialize(); + // 初始化单例系统 + UniSingleton.Initialize(); // 初始化资源系统 YooAssets.Initialize(); YooAssets.SetOperationSystemMaxTimeSlice(30); // 创建补丁管理器 - UniModule.CreateModule(); + UniSingleton.CreateSingleton(); // 开始补丁更新流程 PatchManager.Instance.Run(PlayMode); diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmInitGame.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmInitGame.cs index 1843276..6408d26 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmInitGame.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmInitGame.cs @@ -4,7 +4,7 @@ using UnityEngine; using UniFramework.Pooling; using UniFramework.Window; using UniFramework.Machine; -using UniFramework.Module; +using UniFramework.Singleton; using YooAsset; internal class FsmInitGame : IStateNode @@ -17,7 +17,7 @@ internal class FsmInitGame : IStateNode } void IStateNode.OnEnter() { - UniModule.StartCoroutine(Prepare()); + UniSingleton.StartCoroutine(Prepare()); } void IStateNode.OnUpdate() { diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneBattle.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneBattle.cs index 8dc0864..eef86f7 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneBattle.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneBattle.cs @@ -5,7 +5,7 @@ using UnityEngine; using UniFramework.Window; using UniFramework.Event; using UniFramework.Machine; -using UniFramework.Module; +using UniFramework.Singleton; using YooAsset; internal class FsmSceneBattle : IStateNode @@ -17,7 +17,7 @@ internal class FsmSceneBattle : IStateNode } void IStateNode.OnEnter() { - UniModule.StartCoroutine(Prepare()); + UniSingleton.StartCoroutine(Prepare()); } void IStateNode.OnUpdate() { diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs index b3c1b1e..a92d193 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using UnityEngine; using UniFramework.Machine; using UniFramework.Window; -using UniFramework.Module; +using UniFramework.Singleton; using YooAsset; internal class FsmSceneHome : IStateNode @@ -16,7 +16,7 @@ internal class FsmSceneHome : IStateNode } void IStateNode.OnEnter() { - UniModule.StartCoroutine(Prepare()); + UniSingleton.StartCoroutine(Prepare()); } void IStateNode.OnUpdate() { diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/GameManager.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/GameManager.cs index 1625773..13e81ae 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/GameManager.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/GameManager.cs @@ -3,22 +3,22 @@ using System.Collections.Generic; using UnityEngine; using UniFramework.Event; using UniFramework.Machine; -using UniFramework.Module; +using UniFramework.Singleton; -public class GameManager : ModuleSingleton, IModule +public class GameManager : SingletonInstance, ISingleton { private bool _isRun = false; private EventGroup _eventGroup = new EventGroup(); private StateMachine _machine; - void IModule.OnCreate(object createParam) + void ISingleton.OnCreate(object createParam) { } - void IModule.OnDestroy() + void ISingleton.OnDestroy() { _eventGroup.RemoveAllListener(); } - void IModule.OnUpdate() + void ISingleton.OnUpdate() { if (_machine != null) _machine.Update(); diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmCreateDownloader.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmCreateDownloader.cs index c05ceaf..fd8b0a6 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmCreateDownloader.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmCreateDownloader.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using UnityEngine; using UniFramework.Machine; -using UniFramework.Module; +using UniFramework.Singleton; using YooAsset; /// @@ -19,7 +19,7 @@ public class FsmCreateDownloader : IStateNode void IStateNode.OnEnter() { PatchEventDefine.PatchStatesChange.SendEventMessage("创建补丁下载器!"); - UniModule.StartCoroutine(CreateDownloader()); + UniSingleton.StartCoroutine(CreateDownloader()); } void IStateNode.OnUpdate() { diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadFiles.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadFiles.cs index b5c6058..cf149c4 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadFiles.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmDownloadFiles.cs @@ -1,7 +1,7 @@ using System.Collections; using UnityEngine; using UniFramework.Machine; -using UniFramework.Module; +using UniFramework.Singleton; using YooAsset; /// @@ -18,7 +18,7 @@ public class FsmDownloadFiles : IStateNode void IStateNode.OnEnter() { PatchEventDefine.PatchStatesChange.SendEventMessage("开始下载补丁文件!"); - UniModule.StartCoroutine(BeginDownload()); + UniSingleton.StartCoroutine(BeginDownload()); } void IStateNode.OnUpdate() { diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitialize.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitialize.cs index 1bf614d..69640c2 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitialize.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitialize.cs @@ -4,7 +4,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using UniFramework.Machine; -using UniFramework.Module; +using UniFramework.Singleton; using YooAsset; /// @@ -21,7 +21,7 @@ internal class FsmInitialize : IStateNode void IStateNode.OnEnter() { PatchEventDefine.PatchStatesChange.SendEventMessage("初始化资源包!"); - UniModule.StartCoroutine(InitPackage()); + UniSingleton.StartCoroutine(InitPackage()); } void IStateNode.OnUpdate() { diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchDone.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchDone.cs index 99e0633..df85677 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchDone.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchDone.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using UnityEngine; using UniFramework.Machine; -using UniFramework.Module; +using UniFramework.Singleton; /// /// 流程更新完毕 @@ -17,7 +17,7 @@ internal class FsmPatchDone : IStateNode PatchEventDefine.PatchStatesChange.SendEventMessage("开始游戏!"); // 创建游戏管理器 - UniModule.CreateModule(); + UniSingleton.CreateSingleton(); // 开启游戏流程 GameManager.Instance.Run(); diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchPrepare.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchPrepare.cs index 4f23e72..377b14c 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchPrepare.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmPatchPrepare.cs @@ -4,7 +4,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using UniFramework.Machine; -using UniFramework.Module; +using UniFramework.Singleton; /// /// 流程准备工作 diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateManifest.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateManifest.cs index 72841f0..af810e4 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateManifest.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateManifest.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using UnityEngine; using UniFramework.Machine; -using UniFramework.Module; +using UniFramework.Singleton; using YooAsset; /// @@ -19,7 +19,7 @@ public class FsmUpdateManifest : IStateNode void IStateNode.OnEnter() { PatchEventDefine.PatchStatesChange.SendEventMessage("更新资源清单!"); - UniModule.StartCoroutine(UpdateManifest()); + UniSingleton.StartCoroutine(UpdateManifest()); } void IStateNode.OnUpdate() { diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateVersion.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateVersion.cs index 08e6eb9..8330b34 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateVersion.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateVersion.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using UnityEngine; using UniFramework.Machine; -using UniFramework.Module; +using UniFramework.Singleton; using YooAsset; /// @@ -19,7 +19,7 @@ internal class FsmUpdateVersion : IStateNode void IStateNode.OnEnter() { PatchEventDefine.PatchStatesChange.SendEventMessage("获取最新的资源版本 !"); - UniModule.StartCoroutine(GetStaticVersion()); + UniSingleton.StartCoroutine(GetStaticVersion()); } void IStateNode.OnUpdate() { diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/PatchManager.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/PatchManager.cs index 3197da7..4e0f425 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/PatchManager.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/PatchManager.cs @@ -4,10 +4,10 @@ using System.Collections.Generic; using UnityEngine; using UniFramework.Machine; using UniFramework.Event; -using UniFramework.Module; +using UniFramework.Singleton; using YooAsset; -public class PatchManager : ModuleSingleton, IModule +public class PatchManager : SingletonInstance, ISingleton { /// /// 运行模式 @@ -29,14 +29,14 @@ public class PatchManager : ModuleSingleton, IModule private EventGroup _eventGroup = new EventGroup(); private StateMachine _machine; - void IModule.OnCreate(object createParam) + void ISingleton.OnCreate(object createParam) { } - void IModule.OnDestroy() + void ISingleton.OnDestroy() { _eventGroup.RemoveAllListener(); } - void IModule.OnUpdate() + void ISingleton.OnUpdate() { if (_machine != null) _machine.Update(); diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/README.md b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/README.md deleted file mode 100644 index 8358a8a..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# UniFramework.Module - -一个轻量级的模块系统。 diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniModuleDriver.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniModuleDriver.cs deleted file mode 100644 index c9d78a8..0000000 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniModuleDriver.cs +++ /dev/null @@ -1,12 +0,0 @@ -using UnityEngine; - -namespace UniFramework.Module -{ - internal class UniModuleDriver : MonoBehaviour - { - void Update() - { - UniModule.Update(); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/GameObjectPool.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/GameObjectPool.cs index 093ad4e..4a52cf8 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/GameObjectPool.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/GameObjectPool.cs @@ -65,10 +65,10 @@ namespace UniFramework.Pooling /// /// 创建对象池 /// - public void CreatePool(AssetsPackage assetPackage) + public void CreatePool(ResourcePackage package) { // 加载游戏对象 - AssetHandle = assetPackage.LoadAssetAsync(Location); + AssetHandle = package.LoadAssetAsync(Location); // 创建初始对象 for (int i = 0; i < _initCapacity; i++) diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/Spawner.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/Spawner.cs index 2325011..c46901f 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/Spawner.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/Spawner.cs @@ -11,13 +11,13 @@ namespace UniFramework.Pooling private readonly List _gameObjectPools = new List(100); private readonly List _removeList = new List(100); private readonly GameObject _spawnerRoot; - private readonly AssetsPackage _assetPackage; + private readonly ResourcePackage _package; public string PackageName { get { - return _assetPackage.PackageName; + return _package.PackageName; } } @@ -25,11 +25,11 @@ namespace UniFramework.Pooling private Spawner() { } - internal Spawner(GameObject poolingRoot, AssetsPackage assetPackage) + internal Spawner(GameObject poolingRoot, ResourcePackage package) { - _spawnerRoot = new GameObject($"{assetPackage.PackageName}"); + _spawnerRoot = new GameObject($"{package.PackageName}"); _spawnerRoot.transform.SetParent(poolingRoot.transform); - _assetPackage = assetPackage; + _package = package; } /// @@ -137,7 +137,7 @@ namespace UniFramework.Pooling else { pool = new GameObjectPool(_spawnerRoot, location, dontDestroy, initCapacity, maxCapacity, destroyTime); - pool.CreatePool(_assetPackage); + pool.CreatePool(_package); _gameObjectPools.Add(pool); var operation = new CreatePoolOperation(pool.AssetHandle); @@ -240,7 +240,7 @@ namespace UniFramework.Pooling // 如果不存在创建游戏对象池 pool = new GameObjectPool(_spawnerRoot, location, false, 0, int.MaxValue, -1f); - pool.CreatePool(_assetPackage); + pool.CreatePool(_package); _gameObjectPools.Add(pool); return pool.Spawn(parent, position, rotation, forceClone, userDatas); } diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniPooling.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniPooling.cs index 4405b30..85d5054 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniPooling.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/UniPooling.cs @@ -76,7 +76,7 @@ namespace UniFramework.Pooling public static Spawner CreateSpawner(string packageName) { // 获取资源包 - var assetPackage = YooAssets.GetAssetsPackage(packageName); + var assetPackage = YooAssets.GetPackage(packageName); if (assetPackage == null) throw new Exception($"Not found asset package : {packageName}"); diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton.meta similarity index 77% rename from Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule.meta rename to Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton.meta index 60a51a3..664903f 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule.meta +++ b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4e57ebf0b48a9d94dba1c0ce723da392 +guid: c4d0461b6228c584dab24fbeb8dc4907 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/README.md b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/README.md new file mode 100644 index 0000000..ad8db66 --- /dev/null +++ b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/README.md @@ -0,0 +1,3 @@ +# UniFramework.Singleton + +一个轻量级的单例系统。 diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/README.md.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/README.md.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/README.md.meta rename to Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/README.md.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime.meta rename to Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/IModule.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/ISingleton.cs similarity index 62% rename from Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/IModule.cs rename to Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/ISingleton.cs index 7e7e776..c61c8b7 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/IModule.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/ISingleton.cs @@ -1,20 +1,20 @@  -namespace UniFramework.Module +namespace UniFramework.Singleton { - public interface IModule + public interface ISingleton { /// - /// 创建模块 + /// 创建单例 /// void OnCreate(System.Object createParam); /// - /// 更新模块 + /// 更新单例 /// void OnUpdate(); /// - /// 销毁模块 + /// 销毁单例 /// void OnDestroy(); } diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/IModule.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/ISingleton.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/IModule.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/ISingleton.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/ModuleSingleton.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/SingletonInstance.cs similarity index 61% rename from Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/ModuleSingleton.cs rename to Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/SingletonInstance.cs index 4d93ad3..31f4426 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/ModuleSingleton.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/SingletonInstance.cs @@ -1,7 +1,7 @@  -namespace UniFramework.Module +namespace UniFramework.Singleton { - public abstract class ModuleSingleton where T : class, IModule + public abstract class SingletonInstance where T : class, ISingleton { private static T _instance; public static T Instance @@ -9,18 +9,18 @@ namespace UniFramework.Module get { if (_instance == null) - UniLogger.Error($"{typeof(T)} is not create. Use {nameof(UniModule)}.{nameof(UniModule.CreateModule)} create."); + UniLogger.Error($"{typeof(T)} is not create. Use {nameof(UniSingleton)}.{nameof(UniSingleton.CreateSingleton)} create."); return _instance; } } - protected ModuleSingleton() + protected SingletonInstance() { if (_instance != null) throw new System.Exception($"{typeof(T)} instance already created."); _instance = this as T; } - protected void DestroySingleton() + protected void DestroyInstance() { _instance = null; } diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/ModuleSingleton.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/SingletonInstance.cs.meta similarity index 83% rename from Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/ModuleSingleton.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/SingletonInstance.cs.meta index 1638ca2..a413c9c 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/ModuleSingleton.cs.meta +++ b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/SingletonInstance.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b6c8230c0d097534e950f4e84ce01e96 +guid: 9b334be14d2a937409f5e47373f819c4 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniLogger.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniLogger.cs similarity index 91% rename from Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniLogger.cs rename to Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniLogger.cs index 97323d1..191554c 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniLogger.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniLogger.cs @@ -1,6 +1,6 @@ using System.Diagnostics; -namespace UniFramework.Module +namespace UniFramework.Singleton { internal static class UniLogger { diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniLogger.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniLogger.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniLogger.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniLogger.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniModule.asmdef b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingleton.asmdef similarity index 92% rename from Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniModule.asmdef rename to Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingleton.asmdef index 25c873f..76ce370 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniModule.asmdef +++ b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingleton.asmdef @@ -1,5 +1,5 @@ { - "name": "UniModule", + "name": "UniSingleton", "rootNamespace": "", "references": [ "GUID:e34a5702dd353724aa315fb8011f08c3" diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniModule.asmdef.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingleton.asmdef.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniModule.asmdef.meta rename to Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingleton.asmdef.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniModule.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingleton.cs similarity index 72% rename from Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniModule.cs rename to Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingleton.cs index 79dd206..1b9db48 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniModule.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingleton.cs @@ -3,18 +3,18 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -namespace UniFramework.Module +namespace UniFramework.Singleton { - public static class UniModule + public static class UniSingleton { private class Wrapper { public int Priority { private set; get; } - public IModule Module { private set; get; } + public ISingleton Singleton { private set; get; } - public Wrapper(IModule module, int priority) + public Wrapper(ISingleton module, int priority) { - Module = module; + Singleton = module; Priority = priority; } } @@ -26,26 +26,26 @@ namespace UniFramework.Module private static bool _isDirty = false; /// - /// 初始化模块系统 + /// 初始化单例系统 /// public static void Initialize() { if (_isInitialize) - throw new Exception($"{nameof(UniModule)} is initialized !"); + throw new Exception($"{nameof(UniSingleton)} is initialized !"); if (_isInitialize == false) { // 创建驱动器 _isInitialize = true; - _driver = new UnityEngine.GameObject($"[{nameof(UniModule)}]"); - _behaviour = _driver.AddComponent(); + _driver = new UnityEngine.GameObject($"[{nameof(UniSingleton)}]"); + _behaviour = _driver.AddComponent(); UnityEngine.Object.DontDestroyOnLoad(_driver); - UniLogger.Log($"{nameof(UniModule)} initalize !"); + UniLogger.Log($"{nameof(UniSingleton)} initalize !"); } } /// - /// 销毁模块系统 + /// 销毁单例系统 /// public static void Destroy() { @@ -56,12 +56,12 @@ namespace UniFramework.Module _isInitialize = false; if (_driver != null) GameObject.Destroy(_driver); - UniLogger.Log($"{nameof(UniModule)} destroy all !"); + UniLogger.Log($"{nameof(UniSingleton)} destroy all !"); } } /// - /// 更新模块系统 + /// 更新单例系统 /// internal static void Update() { @@ -83,20 +83,20 @@ namespace UniFramework.Module // 轮询所有模块 for (int i = 0; i < _wrappers.Count; i++) { - _wrappers[i].Module.OnUpdate(); + _wrappers[i].Singleton.OnUpdate(); } } /// - /// 获取模块 + /// 获取单例 /// - public static T GetModule() where T : class, IModule + public static T GetSingleton() where T : class, ISingleton { System.Type type = typeof(T); for (int i = 0; i < _wrappers.Count; i++) { - if (_wrappers[i].Module.GetType() == type) - return _wrappers[i].Module as T; + if (_wrappers[i].Singleton.GetType() == type) + return _wrappers[i].Singleton as T; } UniLogger.Error($"Not found manager : {type}"); @@ -104,34 +104,34 @@ namespace UniFramework.Module } /// - /// 查询模块是否存在 + /// 查询单例是否存在 /// - public static bool Contains() where T : class, IModule + public static bool Contains() where T : class, ISingleton { System.Type type = typeof(T); for (int i = 0; i < _wrappers.Count; i++) { - if (_wrappers[i].Module.GetType() == type) + if (_wrappers[i].Singleton.GetType() == type) return true; } return false; } /// - /// 创建模块 + /// 创建单例 /// /// 运行时的优先级,优先级越大越早执行。如果没有设置优先级,那么会按照添加顺序执行 - public static T CreateModule(int priority = 0) where T : class, IModule + public static T CreateSingleton(int priority = 0) where T : class, ISingleton { - return CreateModule(null, priority); + return CreateSingleton(null, priority); } /// - /// 创建模块 + /// 创建单例 /// /// 附加参数 /// 运行时的优先级,优先级越大越早执行。如果没有设置优先级,那么会按照添加顺序执行 - public static T CreateModule(System.Object createParam, int priority = 0) where T : class, IModule + public static T CreateSingleton(System.Object createParam, int priority = 0) where T : class, ISingleton { if (priority < 0) throw new Exception("The priority can not be negative"); @@ -148,23 +148,23 @@ namespace UniFramework.Module T module = Activator.CreateInstance(); Wrapper wrapper = new Wrapper(module, priority); - wrapper.Module.OnCreate(createParam); + wrapper.Singleton.OnCreate(createParam); _wrappers.Add(wrapper); _isDirty = true; return module; } /// - /// 销毁模块 + /// 销毁单例 /// - public static bool DestroyModule() where T : class, IModule + public static bool DestroySingleton() where T : class, ISingleton { var type = typeof(T); for (int i = 0; i < _wrappers.Count; i++) { - if (_wrappers[i].Module.GetType() == type) + if (_wrappers[i].Singleton.GetType() == type) { - _wrappers[i].Module.OnDestroy(); + _wrappers[i].Singleton.OnDestroy(); _wrappers.RemoveAt(i); return true; } @@ -218,7 +218,7 @@ namespace UniFramework.Module { for (int i = 0; i < _wrappers.Count; i++) { - _wrappers[i].Module.OnDestroy(); + _wrappers[i].Singleton.OnDestroy(); } _wrappers.Clear(); } diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniModule.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingleton.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniModule.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingleton.cs.meta diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingletonDriver.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingletonDriver.cs new file mode 100644 index 0000000..a252e18 --- /dev/null +++ b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingletonDriver.cs @@ -0,0 +1,12 @@ +using UnityEngine; + +namespace UniFramework.Singleton +{ + internal class UniSingletonDriver : MonoBehaviour + { + void Update() + { + UniSingleton.Update(); + } + } +} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniModuleDriver.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingletonDriver.cs.meta similarity index 100% rename from Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniModule/Runtime/UniModuleDriver.cs.meta rename to Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniSingleton/Runtime/UniSingletonDriver.cs.meta