update space shooter

pull/82/head
hevinci 2023-03-11 00:45:58 +08:00
parent ff8f8623d9
commit 20061983d6
34 changed files with 104 additions and 104 deletions

View File

@ -1,6 +1,6 @@
using UnityEngine; using UnityEngine;
using UniFramework.Event; using UniFramework.Event;
using UniFramework.Module; using UniFramework.Singleton;
using YooAsset; using YooAsset;
public class Boot : MonoBehaviour public class Boot : MonoBehaviour
@ -21,15 +21,15 @@ public class Boot : MonoBehaviour
// 初始化事件系统 // 初始化事件系统
UniEvent.Initalize(); UniEvent.Initalize();
// 初始化管理系统 // 初始化单例系统
UniModule.Initialize(); UniSingleton.Initialize();
// 初始化资源系统 // 初始化资源系统
YooAssets.Initialize(); YooAssets.Initialize();
YooAssets.SetOperationSystemMaxTimeSlice(30); YooAssets.SetOperationSystemMaxTimeSlice(30);
// 创建补丁管理器 // 创建补丁管理器
UniModule.CreateModule<PatchManager>(); UniSingleton.CreateSingleton<PatchManager>();
// 开始补丁更新流程 // 开始补丁更新流程
PatchManager.Instance.Run(PlayMode); PatchManager.Instance.Run(PlayMode);

View File

@ -4,7 +4,7 @@ using UnityEngine;
using UniFramework.Pooling; using UniFramework.Pooling;
using UniFramework.Window; using UniFramework.Window;
using UniFramework.Machine; using UniFramework.Machine;
using UniFramework.Module; using UniFramework.Singleton;
using YooAsset; using YooAsset;
internal class FsmInitGame : IStateNode internal class FsmInitGame : IStateNode
@ -17,7 +17,7 @@ internal class FsmInitGame : IStateNode
} }
void IStateNode.OnEnter() void IStateNode.OnEnter()
{ {
UniModule.StartCoroutine(Prepare()); UniSingleton.StartCoroutine(Prepare());
} }
void IStateNode.OnUpdate() void IStateNode.OnUpdate()
{ {

View File

@ -5,7 +5,7 @@ using UnityEngine;
using UniFramework.Window; using UniFramework.Window;
using UniFramework.Event; using UniFramework.Event;
using UniFramework.Machine; using UniFramework.Machine;
using UniFramework.Module; using UniFramework.Singleton;
using YooAsset; using YooAsset;
internal class FsmSceneBattle : IStateNode internal class FsmSceneBattle : IStateNode
@ -17,7 +17,7 @@ internal class FsmSceneBattle : IStateNode
} }
void IStateNode.OnEnter() void IStateNode.OnEnter()
{ {
UniModule.StartCoroutine(Prepare()); UniSingleton.StartCoroutine(Prepare());
} }
void IStateNode.OnUpdate() void IStateNode.OnUpdate()
{ {

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UniFramework.Machine; using UniFramework.Machine;
using UniFramework.Window; using UniFramework.Window;
using UniFramework.Module; using UniFramework.Singleton;
using YooAsset; using YooAsset;
internal class FsmSceneHome : IStateNode internal class FsmSceneHome : IStateNode
@ -16,7 +16,7 @@ internal class FsmSceneHome : IStateNode
} }
void IStateNode.OnEnter() void IStateNode.OnEnter()
{ {
UniModule.StartCoroutine(Prepare()); UniSingleton.StartCoroutine(Prepare());
} }
void IStateNode.OnUpdate() void IStateNode.OnUpdate()
{ {

View File

@ -3,22 +3,22 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UniFramework.Event; using UniFramework.Event;
using UniFramework.Machine; using UniFramework.Machine;
using UniFramework.Module; using UniFramework.Singleton;
public class GameManager : ModuleSingleton<GameManager>, IModule public class GameManager : SingletonInstance<GameManager>, ISingleton
{ {
private bool _isRun = false; private bool _isRun = false;
private EventGroup _eventGroup = new EventGroup(); private EventGroup _eventGroup = new EventGroup();
private StateMachine _machine; private StateMachine _machine;
void IModule.OnCreate(object createParam) void ISingleton.OnCreate(object createParam)
{ {
} }
void IModule.OnDestroy() void ISingleton.OnDestroy()
{ {
_eventGroup.RemoveAllListener(); _eventGroup.RemoveAllListener();
} }
void IModule.OnUpdate() void ISingleton.OnUpdate()
{ {
if (_machine != null) if (_machine != null)
_machine.Update(); _machine.Update();

View File

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UniFramework.Machine; using UniFramework.Machine;
using UniFramework.Module; using UniFramework.Singleton;
using YooAsset; using YooAsset;
/// <summary> /// <summary>
@ -19,7 +19,7 @@ public class FsmCreateDownloader : IStateNode
void IStateNode.OnEnter() void IStateNode.OnEnter()
{ {
PatchEventDefine.PatchStatesChange.SendEventMessage("创建补丁下载器!"); PatchEventDefine.PatchStatesChange.SendEventMessage("创建补丁下载器!");
UniModule.StartCoroutine(CreateDownloader()); UniSingleton.StartCoroutine(CreateDownloader());
} }
void IStateNode.OnUpdate() void IStateNode.OnUpdate()
{ {

View File

@ -1,7 +1,7 @@
using System.Collections; using System.Collections;
using UnityEngine; using UnityEngine;
using UniFramework.Machine; using UniFramework.Machine;
using UniFramework.Module; using UniFramework.Singleton;
using YooAsset; using YooAsset;
/// <summary> /// <summary>
@ -18,7 +18,7 @@ public class FsmDownloadFiles : IStateNode
void IStateNode.OnEnter() void IStateNode.OnEnter()
{ {
PatchEventDefine.PatchStatesChange.SendEventMessage("开始下载补丁文件!"); PatchEventDefine.PatchStatesChange.SendEventMessage("开始下载补丁文件!");
UniModule.StartCoroutine(BeginDownload()); UniSingleton.StartCoroutine(BeginDownload());
} }
void IStateNode.OnUpdate() void IStateNode.OnUpdate()
{ {

View File

@ -4,7 +4,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UniFramework.Machine; using UniFramework.Machine;
using UniFramework.Module; using UniFramework.Singleton;
using YooAsset; using YooAsset;
/// <summary> /// <summary>
@ -21,7 +21,7 @@ internal class FsmInitialize : IStateNode
void IStateNode.OnEnter() void IStateNode.OnEnter()
{ {
PatchEventDefine.PatchStatesChange.SendEventMessage("初始化资源包!"); PatchEventDefine.PatchStatesChange.SendEventMessage("初始化资源包!");
UniModule.StartCoroutine(InitPackage()); UniSingleton.StartCoroutine(InitPackage());
} }
void IStateNode.OnUpdate() void IStateNode.OnUpdate()
{ {

View File

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UniFramework.Machine; using UniFramework.Machine;
using UniFramework.Module; using UniFramework.Singleton;
/// <summary> /// <summary>
/// 流程更新完毕 /// 流程更新完毕
@ -17,7 +17,7 @@ internal class FsmPatchDone : IStateNode
PatchEventDefine.PatchStatesChange.SendEventMessage("开始游戏!"); PatchEventDefine.PatchStatesChange.SendEventMessage("开始游戏!");
// 创建游戏管理器 // 创建游戏管理器
UniModule.CreateModule<GameManager>(); UniSingleton.CreateSingleton<GameManager>();
// 开启游戏流程 // 开启游戏流程
GameManager.Instance.Run(); GameManager.Instance.Run();

View File

@ -4,7 +4,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UniFramework.Machine; using UniFramework.Machine;
using UniFramework.Module; using UniFramework.Singleton;
/// <summary> /// <summary>
/// 流程准备工作 /// 流程准备工作

View File

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UniFramework.Machine; using UniFramework.Machine;
using UniFramework.Module; using UniFramework.Singleton;
using YooAsset; using YooAsset;
/// <summary> /// <summary>
@ -19,7 +19,7 @@ public class FsmUpdateManifest : IStateNode
void IStateNode.OnEnter() void IStateNode.OnEnter()
{ {
PatchEventDefine.PatchStatesChange.SendEventMessage("更新资源清单!"); PatchEventDefine.PatchStatesChange.SendEventMessage("更新资源清单!");
UniModule.StartCoroutine(UpdateManifest()); UniSingleton.StartCoroutine(UpdateManifest());
} }
void IStateNode.OnUpdate() void IStateNode.OnUpdate()
{ {

View File

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UniFramework.Machine; using UniFramework.Machine;
using UniFramework.Module; using UniFramework.Singleton;
using YooAsset; using YooAsset;
/// <summary> /// <summary>
@ -19,7 +19,7 @@ internal class FsmUpdateVersion : IStateNode
void IStateNode.OnEnter() void IStateNode.OnEnter()
{ {
PatchEventDefine.PatchStatesChange.SendEventMessage("获取最新的资源版本 !"); PatchEventDefine.PatchStatesChange.SendEventMessage("获取最新的资源版本 !");
UniModule.StartCoroutine(GetStaticVersion()); UniSingleton.StartCoroutine(GetStaticVersion());
} }
void IStateNode.OnUpdate() void IStateNode.OnUpdate()
{ {

View File

@ -4,10 +4,10 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UniFramework.Machine; using UniFramework.Machine;
using UniFramework.Event; using UniFramework.Event;
using UniFramework.Module; using UniFramework.Singleton;
using YooAsset; using YooAsset;
public class PatchManager : ModuleSingleton<PatchManager>, IModule public class PatchManager : SingletonInstance<PatchManager>, ISingleton
{ {
/// <summary> /// <summary>
/// 运行模式 /// 运行模式
@ -29,14 +29,14 @@ public class PatchManager : ModuleSingleton<PatchManager>, IModule
private EventGroup _eventGroup = new EventGroup(); private EventGroup _eventGroup = new EventGroup();
private StateMachine _machine; private StateMachine _machine;
void IModule.OnCreate(object createParam) void ISingleton.OnCreate(object createParam)
{ {
} }
void IModule.OnDestroy() void ISingleton.OnDestroy()
{ {
_eventGroup.RemoveAllListener(); _eventGroup.RemoveAllListener();
} }
void IModule.OnUpdate() void ISingleton.OnUpdate()
{ {
if (_machine != null) if (_machine != null)
_machine.Update(); _machine.Update();

View File

@ -1,3 +0,0 @@
# UniFramework.Module
一个轻量级的模块系统。

View File

@ -1,12 +0,0 @@
using UnityEngine;
namespace UniFramework.Module
{
internal class UniModuleDriver : MonoBehaviour
{
void Update()
{
UniModule.Update();
}
}
}

View File

@ -65,10 +65,10 @@ namespace UniFramework.Pooling
/// <summary> /// <summary>
/// 创建对象池 /// 创建对象池
/// </summary> /// </summary>
public void CreatePool(AssetsPackage assetPackage) public void CreatePool(ResourcePackage package)
{ {
// 加载游戏对象 // 加载游戏对象
AssetHandle = assetPackage.LoadAssetAsync<GameObject>(Location); AssetHandle = package.LoadAssetAsync<GameObject>(Location);
// 创建初始对象 // 创建初始对象
for (int i = 0; i < _initCapacity; i++) for (int i = 0; i < _initCapacity; i++)

View File

@ -11,13 +11,13 @@ namespace UniFramework.Pooling
private readonly List<GameObjectPool> _gameObjectPools = new List<GameObjectPool>(100); private readonly List<GameObjectPool> _gameObjectPools = new List<GameObjectPool>(100);
private readonly List<GameObjectPool> _removeList = new List<GameObjectPool>(100); private readonly List<GameObjectPool> _removeList = new List<GameObjectPool>(100);
private readonly GameObject _spawnerRoot; private readonly GameObject _spawnerRoot;
private readonly AssetsPackage _assetPackage; private readonly ResourcePackage _package;
public string PackageName public string PackageName
{ {
get get
{ {
return _assetPackage.PackageName; return _package.PackageName;
} }
} }
@ -25,11 +25,11 @@ namespace UniFramework.Pooling
private Spawner() 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); _spawnerRoot.transform.SetParent(poolingRoot.transform);
_assetPackage = assetPackage; _package = package;
} }
/// <summary> /// <summary>
@ -137,7 +137,7 @@ namespace UniFramework.Pooling
else else
{ {
pool = new GameObjectPool(_spawnerRoot, location, dontDestroy, initCapacity, maxCapacity, destroyTime); pool = new GameObjectPool(_spawnerRoot, location, dontDestroy, initCapacity, maxCapacity, destroyTime);
pool.CreatePool(_assetPackage); pool.CreatePool(_package);
_gameObjectPools.Add(pool); _gameObjectPools.Add(pool);
var operation = new CreatePoolOperation(pool.AssetHandle); var operation = new CreatePoolOperation(pool.AssetHandle);
@ -240,7 +240,7 @@ namespace UniFramework.Pooling
// 如果不存在创建游戏对象池 // 如果不存在创建游戏对象池
pool = new GameObjectPool(_spawnerRoot, location, false, 0, int.MaxValue, -1f); pool = new GameObjectPool(_spawnerRoot, location, false, 0, int.MaxValue, -1f);
pool.CreatePool(_assetPackage); pool.CreatePool(_package);
_gameObjectPools.Add(pool); _gameObjectPools.Add(pool);
return pool.Spawn(parent, position, rotation, forceClone, userDatas); return pool.Spawn(parent, position, rotation, forceClone, userDatas);
} }

View File

@ -76,7 +76,7 @@ namespace UniFramework.Pooling
public static Spawner CreateSpawner(string packageName) public static Spawner CreateSpawner(string packageName)
{ {
// 获取资源包 // 获取资源包
var assetPackage = YooAssets.GetAssetsPackage(packageName); var assetPackage = YooAssets.GetPackage(packageName);
if (assetPackage == null) if (assetPackage == null)
throw new Exception($"Not found asset package : {packageName}"); throw new Exception($"Not found asset package : {packageName}");

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4e57ebf0b48a9d94dba1c0ce723da392 guid: c4d0461b6228c584dab24fbeb8dc4907
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -0,0 +1,3 @@
# UniFramework.Singleton
一个轻量级的单例系统。

View File

@ -1,20 +1,20 @@
 
namespace UniFramework.Module namespace UniFramework.Singleton
{ {
public interface IModule public interface ISingleton
{ {
/// <summary> /// <summary>
/// 创建模块 /// 创建单例
/// </summary> /// </summary>
void OnCreate(System.Object createParam); void OnCreate(System.Object createParam);
/// <summary> /// <summary>
/// 更新模块 /// 更新单例
/// </summary> /// </summary>
void OnUpdate(); void OnUpdate();
/// <summary> /// <summary>
/// 销毁模块 /// 销毁单例
/// </summary> /// </summary>
void OnDestroy(); void OnDestroy();
} }

View File

@ -1,7 +1,7 @@
 
namespace UniFramework.Module namespace UniFramework.Singleton
{ {
public abstract class ModuleSingleton<T> where T : class, IModule public abstract class SingletonInstance<T> where T : class, ISingleton
{ {
private static T _instance; private static T _instance;
public static T Instance public static T Instance
@ -9,18 +9,18 @@ namespace UniFramework.Module
get get
{ {
if (_instance == null) 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; return _instance;
} }
} }
protected ModuleSingleton() protected SingletonInstance()
{ {
if (_instance != null) if (_instance != null)
throw new System.Exception($"{typeof(T)} instance already created."); throw new System.Exception($"{typeof(T)} instance already created.");
_instance = this as T; _instance = this as T;
} }
protected void DestroySingleton() protected void DestroyInstance()
{ {
_instance = null; _instance = null;
} }

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: b6c8230c0d097534e950f4e84ce01e96 guid: 9b334be14d2a937409f5e47373f819c4
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2

View File

@ -1,6 +1,6 @@
using System.Diagnostics; using System.Diagnostics;
namespace UniFramework.Module namespace UniFramework.Singleton
{ {
internal static class UniLogger internal static class UniLogger
{ {

View File

@ -1,5 +1,5 @@
{ {
"name": "UniModule", "name": "UniSingleton",
"rootNamespace": "", "rootNamespace": "",
"references": [ "references": [
"GUID:e34a5702dd353724aa315fb8011f08c3" "GUID:e34a5702dd353724aa315fb8011f08c3"

View File

@ -3,18 +3,18 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace UniFramework.Module namespace UniFramework.Singleton
{ {
public static class UniModule public static class UniSingleton
{ {
private class Wrapper private class Wrapper
{ {
public int Priority { private set; get; } 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; Priority = priority;
} }
} }
@ -26,26 +26,26 @@ namespace UniFramework.Module
private static bool _isDirty = false; private static bool _isDirty = false;
/// <summary> /// <summary>
/// 初始化模块系统 /// 初始化单例系统
/// </summary> /// </summary>
public static void Initialize() public static void Initialize()
{ {
if (_isInitialize) if (_isInitialize)
throw new Exception($"{nameof(UniModule)} is initialized !"); throw new Exception($"{nameof(UniSingleton)} is initialized !");
if (_isInitialize == false) if (_isInitialize == false)
{ {
// 创建驱动器 // 创建驱动器
_isInitialize = true; _isInitialize = true;
_driver = new UnityEngine.GameObject($"[{nameof(UniModule)}]"); _driver = new UnityEngine.GameObject($"[{nameof(UniSingleton)}]");
_behaviour = _driver.AddComponent<UniModuleDriver>(); _behaviour = _driver.AddComponent<UniSingletonDriver>();
UnityEngine.Object.DontDestroyOnLoad(_driver); UnityEngine.Object.DontDestroyOnLoad(_driver);
UniLogger.Log($"{nameof(UniModule)} initalize !"); UniLogger.Log($"{nameof(UniSingleton)} initalize !");
} }
} }
/// <summary> /// <summary>
/// 销毁模块系统 /// 销毁单例系统
/// </summary> /// </summary>
public static void Destroy() public static void Destroy()
{ {
@ -56,12 +56,12 @@ namespace UniFramework.Module
_isInitialize = false; _isInitialize = false;
if (_driver != null) if (_driver != null)
GameObject.Destroy(_driver); GameObject.Destroy(_driver);
UniLogger.Log($"{nameof(UniModule)} destroy all !"); UniLogger.Log($"{nameof(UniSingleton)} destroy all !");
} }
} }
/// <summary> /// <summary>
/// 更新模块系统 /// 更新单例系统
/// </summary> /// </summary>
internal static void Update() internal static void Update()
{ {
@ -83,20 +83,20 @@ namespace UniFramework.Module
// 轮询所有模块 // 轮询所有模块
for (int i = 0; i < _wrappers.Count; i++) for (int i = 0; i < _wrappers.Count; i++)
{ {
_wrappers[i].Module.OnUpdate(); _wrappers[i].Singleton.OnUpdate();
} }
} }
/// <summary> /// <summary>
/// 获取模块 /// 获取单例
/// </summary> /// </summary>
public static T GetModule<T>() where T : class, IModule public static T GetSingleton<T>() where T : class, ISingleton
{ {
System.Type type = typeof(T); System.Type type = typeof(T);
for (int i = 0; i < _wrappers.Count; i++) for (int i = 0; i < _wrappers.Count; i++)
{ {
if (_wrappers[i].Module.GetType() == type) if (_wrappers[i].Singleton.GetType() == type)
return _wrappers[i].Module as T; return _wrappers[i].Singleton as T;
} }
UniLogger.Error($"Not found manager : {type}"); UniLogger.Error($"Not found manager : {type}");
@ -104,34 +104,34 @@ namespace UniFramework.Module
} }
/// <summary> /// <summary>
/// 查询模块是否存在 /// 查询单例是否存在
/// </summary> /// </summary>
public static bool Contains<T>() where T : class, IModule public static bool Contains<T>() where T : class, ISingleton
{ {
System.Type type = typeof(T); System.Type type = typeof(T);
for (int i = 0; i < _wrappers.Count; i++) for (int i = 0; i < _wrappers.Count; i++)
{ {
if (_wrappers[i].Module.GetType() == type) if (_wrappers[i].Singleton.GetType() == type)
return true; return true;
} }
return false; return false;
} }
/// <summary> /// <summary>
/// 创建模块 /// 创建单例
/// </summary> /// </summary>
/// <param name="priority">运行时的优先级,优先级越大越早执行。如果没有设置优先级,那么会按照添加顺序执行</param> /// <param name="priority">运行时的优先级,优先级越大越早执行。如果没有设置优先级,那么会按照添加顺序执行</param>
public static T CreateModule<T>(int priority = 0) where T : class, IModule public static T CreateSingleton<T>(int priority = 0) where T : class, ISingleton
{ {
return CreateModule<T>(null, priority); return CreateSingleton<T>(null, priority);
} }
/// <summary> /// <summary>
/// 创建模块 /// 创建单例
/// </summary> /// </summary>
/// <param name="createParam">附加参数</param> /// <param name="createParam">附加参数</param>
/// <param name="priority">运行时的优先级,优先级越大越早执行。如果没有设置优先级,那么会按照添加顺序执行</param> /// <param name="priority">运行时的优先级,优先级越大越早执行。如果没有设置优先级,那么会按照添加顺序执行</param>
public static T CreateModule<T>(System.Object createParam, int priority = 0) where T : class, IModule public static T CreateSingleton<T>(System.Object createParam, int priority = 0) where T : class, ISingleton
{ {
if (priority < 0) if (priority < 0)
throw new Exception("The priority can not be negative"); throw new Exception("The priority can not be negative");
@ -148,23 +148,23 @@ namespace UniFramework.Module
T module = Activator.CreateInstance<T>(); T module = Activator.CreateInstance<T>();
Wrapper wrapper = new Wrapper(module, priority); Wrapper wrapper = new Wrapper(module, priority);
wrapper.Module.OnCreate(createParam); wrapper.Singleton.OnCreate(createParam);
_wrappers.Add(wrapper); _wrappers.Add(wrapper);
_isDirty = true; _isDirty = true;
return module; return module;
} }
/// <summary> /// <summary>
/// 销毁模块 /// 销毁单例
/// </summary> /// </summary>
public static bool DestroyModule<T>() where T : class, IModule public static bool DestroySingleton<T>() where T : class, ISingleton
{ {
var type = typeof(T); var type = typeof(T);
for (int i = 0; i < _wrappers.Count; i++) 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); _wrappers.RemoveAt(i);
return true; return true;
} }
@ -218,7 +218,7 @@ namespace UniFramework.Module
{ {
for (int i = 0; i < _wrappers.Count; i++) for (int i = 0; i < _wrappers.Count; i++)
{ {
_wrappers[i].Module.OnDestroy(); _wrappers[i].Singleton.OnDestroy();
} }
_wrappers.Clear(); _wrappers.Clear();
} }

View File

@ -0,0 +1,12 @@
using UnityEngine;
namespace UniFramework.Singleton
{
internal class UniSingletonDriver : MonoBehaviour
{
void Update()
{
UniSingleton.Update();
}
}
}