From d679f7f50dcec0d0080a470e3b469f90964e915a Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Mon, 10 Mar 2025 17:06:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9UI=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/UI/UIFengGuangJingBSKPanel.cs | 53 +++++++++++--------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/Assets/Scripts/UI/UIFengGuangJingBSKPanel.cs b/Assets/Scripts/UI/UIFengGuangJingBSKPanel.cs index 91cfd59e..11fd0055 100644 --- a/Assets/Scripts/UI/UIFengGuangJingBSKPanel.cs +++ b/Assets/Scripts/UI/UIFengGuangJingBSKPanel.cs @@ -18,26 +18,7 @@ namespace QFramework.Example TypeEventSystem.Global.Register(OnModuleQuitEvent); // please add init code here - BS.GetComponent().onValueChanged.AddListener((isOn) => - { - SelectBaoShi(BS.transform.name); - }); - ZML.GetComponent().onValueChanged.AddListener((isOn) => - { - SelectBaoShi(ZML.transform.name); - }); - HBS.GetComponent().onValueChanged.AddListener((isOn) => - { - SelectBaoShi(HBS.transform.name); - }); - HSJJS.GetComponent().onValueChanged.AddListener((isOn) => - { - SelectBaoShi(HSJJS.transform.name); - }); - LBS.GetComponent().onValueChanged.AddListener((isOn) => - { - SelectBaoShi(LBS.transform.name); - }); + } private void OnModuleQuitEvent(OnModuleQuit quit) @@ -59,13 +40,39 @@ namespace QFramework.Example } protected override void OnShow() - { - BS.GetComponent().isOn = false; + { + BS.onValueChanged.RemoveAllListeners(); + ZML.onValueChanged.RemoveAllListeners(); + HBS.onValueChanged.RemoveAllListeners(); + HSJJS.onValueChanged.RemoveAllListeners(); + LBS.onValueChanged.RemoveAllListeners(); + + BS.GetComponent().isOn = false; ZML.GetComponent().isOn = false; HBS.GetComponent().isOn = false; HSJJS.GetComponent().isOn = false; LBS.GetComponent().isOn = false; - } + BS.GetComponent().onValueChanged.AddListener((isOn) => + { + SelectBaoShi(BS.transform.name); + }); + ZML.GetComponent().onValueChanged.AddListener((isOn) => + { + SelectBaoShi(ZML.transform.name); + }); + HBS.GetComponent().onValueChanged.AddListener((isOn) => + { + SelectBaoShi(HBS.transform.name); + }); + HSJJS.GetComponent().onValueChanged.AddListener((isOn) => + { + SelectBaoShi(HSJJS.transform.name); + }); + LBS.GetComponent().onValueChanged.AddListener((isOn) => + { + SelectBaoShi(LBS.transform.name); + }); + } protected override void OnHide() {