VirtualFramework/Assets/Scripts/UI/UIInstruction.cs

64 lines
1.7 KiB
C#
Raw Normal View History

2024-12-14 18:27:59 +08:00
using UnityEngine;
using UnityEngine.UI;
using QFramework;
using TMPro;
namespace QFramework.Example
{
public class UIInstructionData : UIPanelData
{
}
public partial class UIInstruction : UIPanel
{
protected override void OnInit(IUIData uiData = null)
{
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)
{
}
protected override void OnShow()
{
}
protected override void OnHide()
{
}
protected override void OnClose()
{
}
}
}