From 1a7e0af9a4a34a5b6a6dea04144a5f1ac908e971 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Wed, 26 Mar 2025 17:46:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8A=A0=E8=BD=BDbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/UI/UIBackPack.cs | 1 + Assets/Scripts/UI/UIOperationList.cs | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/UI/UIBackPack.cs b/Assets/Scripts/UI/UIBackPack.cs index cfbb880b..00b392b4 100644 --- a/Assets/Scripts/UI/UIBackPack.cs +++ b/Assets/Scripts/UI/UIBackPack.cs @@ -27,6 +27,7 @@ namespace QFramework.Example protected override void OnOpen(IUIData uiData = null) { + mData = uiData as UIBackPackData ?? new UIBackPackData(); Content.RemoveAllChildren(); foreach (var device in mData.devices) diff --git a/Assets/Scripts/UI/UIOperationList.cs b/Assets/Scripts/UI/UIOperationList.cs index 6c282f59..d294edc8 100644 --- a/Assets/Scripts/UI/UIOperationList.cs +++ b/Assets/Scripts/UI/UIOperationList.cs @@ -17,7 +17,6 @@ namespace QFramework.Example protected override void OnInit(IUIData uiData = null) { mData = uiData as UIOperationListData ?? new UIOperationListData(); - TypeEventSystem.Global.Register((arg) => Refresh()).UnRegisterWhenGameObjectDestroyed(gameObject); TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } @@ -80,8 +79,9 @@ namespace QFramework.Example protected override void OnOpen(IUIData uiData = null) { + TypeEventSystem.Global.Register((arg) => Refresh()); TypeEventSystem.Global.Register(OnStepChanged).UnRegisterWhenDisabled(this); - Refresh(); + } public void Refresh() @@ -149,9 +149,17 @@ namespace QFramework.Example protected override void OnShow() { + Refresh(); } protected override void OnClose() { + TypeEventSystem.Global.UnRegister((arg) => Refresh()); + } + + public override void Hide() + { + base.Hide(); + TypeEventSystem.Global.UnRegister((arg) => Refresh()); } } }