退出模块时清空控制器的数据
This commit is contained in:
parent
1642e93d06
commit
6033a0b34f
@ -30,7 +30,6 @@ public class DeviceController : MonoSingleton<DeviceController>
|
|||||||
private void OnQuit(OnModuleQuit quit)
|
private void OnQuit(OnModuleQuit quit)
|
||||||
{
|
{
|
||||||
deviceDict.Clear();
|
deviceDict.Clear();
|
||||||
deviceDict.Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnStart(OnModuleStart start)
|
private void OnStart(OnModuleStart start)
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using QFramework;
|
using QFramework;
|
||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -12,9 +13,15 @@ public class VarController : MonoSingleton<VarController>
|
|||||||
{
|
{
|
||||||
base.OnSingletonInit();
|
base.OnSingletonInit();
|
||||||
varDict = new Dictionary<string, float>();
|
varDict = new Dictionary<string, float>();
|
||||||
|
TypeEventSystem.Global.Register<OnModuleQuit>(OnQuit).UnRegisterWhenGameObjectDestroyed(gameObject);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnQuit(OnModuleQuit quit)
|
||||||
|
{
|
||||||
|
varDict.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
public void Set(string key, float value)
|
public void Set(string key, float value)
|
||||||
{
|
{
|
||||||
if (varDict.ContainsKey(key))
|
if (varDict.ContainsKey(key))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user