107 lines
3.1 KiB
C#
107 lines
3.1 KiB
C#
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
using QFramework;
|
||
using TMPro;
|
||
using System.Diagnostics.Eventing.Reader;
|
||
|
||
namespace QFramework.Example
|
||
{
|
||
public class UIInstructionData : UIPanelData
|
||
{
|
||
public bool isRightTop = false;
|
||
}
|
||
public partial class UIInstruction : UIPanel
|
||
{
|
||
bool isNo = false;
|
||
bool isOperation = false;
|
||
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(() =>
|
||
{
|
||
if (isOperation == false)
|
||
{
|
||
Operation.isOn = true;
|
||
isOperation = true;
|
||
}
|
||
else
|
||
{
|
||
Hide();
|
||
isNo = NoToggle.isOn;
|
||
|
||
}
|
||
});
|
||
|
||
|
||
}
|
||
|
||
protected override void OnOpen(IUIData uiData = null)
|
||
{
|
||
mData = uiData as UIInstructionData ?? new UIInstructionData();
|
||
|
||
if (string.IsNullOrEmpty(Global.Instance.curModule.Descript))
|
||
{
|
||
|
||
ContentText.text = "û<><C3BB>Descript<70><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||
}
|
||
else
|
||
{
|
||
ContentText.text = Global.Instance.curModule.Descript;
|
||
}
|
||
|
||
NoToggle.gameObject.SetActive(mData != null && mData.isRightTop == false);
|
||
|
||
}
|
||
|
||
protected override void OnShow()
|
||
{
|
||
if (isNo == true && mData != null && mData.isRightTop == false)
|
||
{
|
||
Hide();
|
||
}
|
||
}
|
||
|
||
protected override void OnHide()
|
||
{
|
||
mData = null;
|
||
// <20><>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>Action<6F><6E><EFBFBD>ղ<EFBFBD><D5B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ <20>ӳ<EFBFBD>0.1<EFBFBD>뷢<EFBFBD><EFBFBD>
|
||
ActionKit.Delay(0.1f, () =>
|
||
{
|
||
StringEventSystem.Global.Send(this.GetType().Name + "Hide");
|
||
}).StartGlobal();
|
||
}
|
||
|
||
protected override void OnClose()
|
||
{
|
||
}
|
||
}
|
||
}
|