diff --git a/Assets/Scripts/Controller/ScoreController.cs b/Assets/Scripts/Controller/ScoreController.cs index a52be7ae..460ded4d 100644 --- a/Assets/Scripts/Controller/ScoreController.cs +++ b/Assets/Scripts/Controller/ScoreController.cs @@ -17,8 +17,15 @@ public class ScoreController : MonoSingleton { base.OnSingletonInit(); InitData(); - TypeEventSystem.Global.Register(OnStart).UnRegisterWhenGameObjectDestroyed(gameObject); - TypeEventSystem.Global.Register(OnQuit).UnRegisterWhenGameObjectDestroyed(gameObject); + } + + public void Init() + { + if (Global.Instance.curModule.type == "Exam" || Global.Instance.curModule.type == "All") + { + TypeEventSystem.Global.Register(OnStart); + TypeEventSystem.Global.Register(OnQuit); + } } public void InitData() @@ -92,6 +99,8 @@ public class ScoreController : MonoSingleton var data = moduleDict[Global.Instance.curModule.ModuleName]; var scoreDict = data.scoreDict; scoreDict.Clear(); + TypeEventSystem.Global.UnRegister(OnStart); + TypeEventSystem.Global.UnRegister(OnQuit); } diff --git a/Assets/Scripts/UI/UIModuleSelect.cs b/Assets/Scripts/UI/UIModuleSelect.cs index 279c9bb3..bb867b3c 100644 --- a/Assets/Scripts/UI/UIModuleSelect.cs +++ b/Assets/Scripts/UI/UIModuleSelect.cs @@ -84,7 +84,7 @@ namespace QFramework.Example var machin = StateMachineController.Instance; var op = OperationController.Instance; var dev = DeviceController.Instance; - var score = ScoreController.Instance; + ScoreController.Instance.Init(); UIKit.OpenPanelAsync().ToAction().StartGlobal(() => {