VirtualFramework/Assets/Scripts/UI/UIInstruction.cs
2025-01-09 17:08:20 +08:00

75 lines
2.2 KiB
C#

using UnityEngine;
using UnityEngine.UI;
using QFramework;
using TMPro;
using System.Diagnostics.Eventing.Reader;
namespace QFramework.Example
{
public class UIInstructionData : UIPanelData
{
}
public partial class UIInstruction : UIPanel
{
protected override void OnInit(IUIData uiData = null)
{
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
mData = uiData as UIInstructionData ?? new UIInstructionData();
// please add init code here
Training.onValueChanged.AddListener(isOn =>
{
if (isOn)
{
Training.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = new Color(1, 1, 1, 1f);
}
else
{
Training.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = new Color(1, 1, 1, 0.5f);
}
TrainContent.gameObject.SetActive(isOn);
});
Operation.onValueChanged.AddListener(isOn =>
{
if (isOn)
{
Operation.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = new Color(1, 1, 1, 1f);
}
else
{
Operation.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = new Color(1, 1, 1, 0.5f);
}
OperationContent.gameObject.SetActive(isOn);
});
ConfirmBtn.onClick.AddListener(() => Hide());
}
protected override void OnOpen(IUIData uiData = null)
{
if (string.IsNullOrEmpty(Global.Instance.curModule.Descript))
{
ContentText.text = "ûÓÐDescriptÏà¹ØÅäÖÃ";
}
else
{
ContentText.text = Global.Instance.curModule.Descript;
}
}
protected override void OnShow()
{
}
protected override void OnHide()
{
}
protected override void OnClose()
{
}
}
}