diff --git a/Assets/Scripts/UI/UIBody3D.cs b/Assets/Scripts/UI/UIBody3D.cs index d671c128..964e01b1 100644 --- a/Assets/Scripts/UI/UIBody3D.cs +++ b/Assets/Scripts/UI/UIBody3D.cs @@ -57,6 +57,7 @@ namespace QFramework.Example Dictionary bodyListIndex = new Dictionary(); protected override void OnInit(IUIData uiData = null) { + TypeEventSystem.Global.Register(OnModuleQuithandler).UnRegisterWhenGameObjectDestroyed(this); DragBtn.onValueChanged.AddListener(isOn => { DragBtn.transform.Find("SubBtns").gameObject.SetActive(isOn); @@ -146,6 +147,10 @@ namespace QFramework.Example }); } + private void OnModuleQuithandler(OnModuleQuit quit) + { + Hide(); + } private void OnUIDrawClose() { diff --git a/Assets/Scripts/UI/UIBody3DInfo.cs b/Assets/Scripts/UI/UIBody3DInfo.cs index 14892a76..1d40613f 100644 --- a/Assets/Scripts/UI/UIBody3DInfo.cs +++ b/Assets/Scripts/UI/UIBody3DInfo.cs @@ -18,6 +18,7 @@ namespace QFramework.Example float bgH; protected override void OnInit(IUIData uiData = null) { + TypeEventSystem.Global.Register(OnModuleQuithandler).UnRegisterWhenGameObjectDestroyed(this); bgH = Content.sizeDelta.y; Group.onValueChanged.AddListener(isOn => { @@ -122,6 +123,11 @@ namespace QFramework.Example } + private void OnModuleQuithandler(OnModuleQuit quit) + { + Hide(); + } + public void RefreshTipPath() { ListContent.RemoveAllChildren(); diff --git a/Assets/Scripts/UI/UIBody3DMenuTree.cs b/Assets/Scripts/UI/UIBody3DMenuTree.cs index 97a5cb4e..211ef38f 100644 --- a/Assets/Scripts/UI/UIBody3DMenuTree.cs +++ b/Assets/Scripts/UI/UIBody3DMenuTree.cs @@ -4,6 +4,7 @@ using XMLTool; using System.Collections.Generic; using TMPro; using DG.Tweening; +using System; namespace QFramework.Example { @@ -204,6 +205,7 @@ namespace QFramework.Example DOTweenAnimation contentAnim; protected override void OnInit(IUIData uiData = null) { + TypeEventSystem.Global.Register(OnModuleQuithandler).UnRegisterWhenGameObjectDestroyed(this); contentAnim = RootContent.GetComponent(); // please add init code here Close.onClick.AddListener(() => @@ -233,7 +235,10 @@ namespace QFramework.Example }); } - + private void OnModuleQuithandler(OnModuleQuit quit) + { + Hide(); + } protected override void OnOpen(IUIData uiData = null) { diff --git a/Assets/Scripts/UI/UIBody3DMouse.cs b/Assets/Scripts/UI/UIBody3DMouse.cs index 05095ca5..0929d1ab 100644 --- a/Assets/Scripts/UI/UIBody3DMouse.cs +++ b/Assets/Scripts/UI/UIBody3DMouse.cs @@ -15,6 +15,7 @@ namespace QFramework.Example private bool isObjectHit; // 标记是否有物体被击中 protected override void OnInit(IUIData uiData = null) { + TypeEventSystem.Global.Register(OnModuleQuithandler).UnRegisterWhenGameObjectDestroyed(this); mData = uiData as UIBody3DMouseData ?? new UIBody3DMouseData(); dragItem = Content.GetComponent(); @@ -31,6 +32,11 @@ namespace QFramework.Example }); } + private void OnModuleQuithandler(OnModuleQuit quit) + { + Hide(); + } + private void OnEndDrag() { Show3DCamera.instance.lockMove = false;