HAARFTE/Assets/DemoGame/GameScript/Hotfix/UI/Logic/MinTipsUI.cs

39 lines
1.0 KiB
C#

using System;
using TMPro;
using UnityEngine.UI;
namespace ZC
{
[UIType(UIType.MinTipsUI)]
public class MinTipsUI : UIBase
{
private TMP_Text txt_Title;
private TMP_Text txt_Content;
private Button btn_Close;
private Action closeAction;
public override void Init()
{
base.Init();
this.txt_Title = self.transform.FindChildDeep<TMP_Text>("txt_Title");
this.txt_Content = self.transform.FindChildDeep<TMP_Text>("txt_Content");
this.btn_Close = self.transform.FindChildDeep<Button>("btn_Close");
btn_Close.onClick.AddListener(ClickClose);
}
private void ClickClose()
{
ZCGame.UIManager.HideUI(UIType.IntroduceUI);
closeAction?.Invoke();
closeAction = null;
}
public void SetData(string title, string content, Action callback = null)
{
txt_Title.text = title;
txt_Content.text = content;
closeAction = callback;
}
}
}