修改UI逻辑

This commit is contained in:
shenjianxing 2025-03-10 17:06:07 +08:00
parent e7a6837c40
commit d679f7f50d

View File

@ -18,26 +18,7 @@ namespace QFramework.Example
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuitEvent); TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuitEvent);
// please add init code here // please add init code here
BS.GetComponent<Toggle>().onValueChanged.AddListener((isOn) =>
{
SelectBaoShi(BS.transform.name);
});
ZML.GetComponent<Toggle>().onValueChanged.AddListener((isOn) =>
{
SelectBaoShi(ZML.transform.name);
});
HBS.GetComponent<Toggle>().onValueChanged.AddListener((isOn) =>
{
SelectBaoShi(HBS.transform.name);
});
HSJJS.GetComponent<Toggle>().onValueChanged.AddListener((isOn) =>
{
SelectBaoShi(HSJJS.transform.name);
});
LBS.GetComponent<Toggle>().onValueChanged.AddListener((isOn) =>
{
SelectBaoShi(LBS.transform.name);
});
} }
private void OnModuleQuitEvent(OnModuleQuit quit) private void OnModuleQuitEvent(OnModuleQuit quit)
@ -60,11 +41,37 @@ namespace QFramework.Example
protected override void OnShow() protected override void OnShow()
{ {
BS.onValueChanged.RemoveAllListeners();
ZML.onValueChanged.RemoveAllListeners();
HBS.onValueChanged.RemoveAllListeners();
HSJJS.onValueChanged.RemoveAllListeners();
LBS.onValueChanged.RemoveAllListeners();
BS.GetComponent<Toggle>().isOn = false; BS.GetComponent<Toggle>().isOn = false;
ZML.GetComponent<Toggle>().isOn = false; ZML.GetComponent<Toggle>().isOn = false;
HBS.GetComponent<Toggle>().isOn = false; HBS.GetComponent<Toggle>().isOn = false;
HSJJS.GetComponent<Toggle>().isOn = false; HSJJS.GetComponent<Toggle>().isOn = false;
LBS.GetComponent<Toggle>().isOn = false; LBS.GetComponent<Toggle>().isOn = false;
BS.GetComponent<Toggle>().onValueChanged.AddListener((isOn) =>
{
SelectBaoShi(BS.transform.name);
});
ZML.GetComponent<Toggle>().onValueChanged.AddListener((isOn) =>
{
SelectBaoShi(ZML.transform.name);
});
HBS.GetComponent<Toggle>().onValueChanged.AddListener((isOn) =>
{
SelectBaoShi(HBS.transform.name);
});
HSJJS.GetComponent<Toggle>().onValueChanged.AddListener((isOn) =>
{
SelectBaoShi(HSJJS.transform.name);
});
LBS.GetComponent<Toggle>().onValueChanged.AddListener((isOn) =>
{
SelectBaoShi(LBS.transform.name);
});
} }
protected override void OnHide() protected override void OnHide()