VirtualFramework/Assets/Scripts/UI/UIFengGuangJingBSKPanel.cs
2025-03-10 17:06:07 +08:00

87 lines
2.4 KiB
C#

using UnityEngine;
using UnityEngine.UI;
using FenGuangJingScene;
using QFramework;
using ZXKFramework;
namespace QFramework.Example
{
public class UIFengGuangJingBSKPanelData : UIPanelData
{
}
public partial class UIFengGuangJingBSKPanel : UIPanel
{
protected override void OnInit(IUIData uiData = null)
{
mData = uiData as UIFengGuangJingBSKPanelData ?? new UIFengGuangJingBSKPanelData();
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuitEvent);
// please add init code here
}
private void OnModuleQuitEvent(OnModuleQuit quit)
{
Hide();
}
private void SelectBaoShi(string baoShiName)
{
FenGuangJingSceneCtrl fenGuangJingSceneCtrl = GameObject.FindObjectOfType<FenGuangJingSceneCtrl>();
if (fenGuangJingSceneCtrl != null)
{
fenGuangJingSceneCtrl.SelectBaoShi(baoShiName);
}
StringEventSystem.Global.Send("InputUIʹÓýáÊø");
Hide();
}
protected override void OnOpen(IUIData uiData = null)
{
}
protected override void OnShow()
{
BS.onValueChanged.RemoveAllListeners();
ZML.onValueChanged.RemoveAllListeners();
HBS.onValueChanged.RemoveAllListeners();
HSJJS.onValueChanged.RemoveAllListeners();
LBS.onValueChanged.RemoveAllListeners();
BS.GetComponent<Toggle>().isOn = false;
ZML.GetComponent<Toggle>().isOn = false;
HBS.GetComponent<Toggle>().isOn = false;
HSJJS.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 OnClose()
{
TypeEventSystem.Global.UnRegister<OnModuleQuit>(OnModuleQuitEvent);
}
}
}