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

43 lines
1.2 KiB
C#
Raw Normal View History

using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace ZC
{
[UIType(UIType.AnalysisReportUI)]
public class AnalysisReportUI : UIBase
{
private TMP_Text txt_Title;
private TMP_Text txt_Content;
private Image img_Pic;
private Button btn_Close;
private Action closeAction;
public override void Init()
{
base.Init();
2024-11-07 22:49:10 +08:00
this.txt_Title = GetValue<TMP_Text>("txt_Title");
this.txt_Content = GetValue<TMP_Text>("txt_Content");
this.img_Pic = GetValue<Image>("img_Pic");
this.btn_Close = GetValue<Button>("btn_Close");
btn_Close.onClick.AddListener(ClickClose);
}
private void ClickClose()
{
ZCGame.UIManager.HideUI(UIType.AnalysisReportUI);
closeAction?.Invoke();
closeAction = null;
}
public void SetData(string title, Sprite sprite, string content, Action callback = null)
{
txt_Title.text = title;
img_Pic.sprite = sprite;
txt_Content.text = content;
closeAction = callback;
}
}
}