2024-11-07 23:17:41 +08:00
|
|
|
|
using System;
|
|
|
|
|
using TMPro;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
namespace ZC
|
|
|
|
|
{
|
|
|
|
|
[UIType(UIType.DialogueUI)]
|
|
|
|
|
public class DialogueUI : UIBase
|
|
|
|
|
{
|
2024-12-01 23:23:44 +08:00
|
|
|
|
// private TMP_Text txt_Title;
|
2024-11-07 23:17:41 +08:00
|
|
|
|
private TMP_Text txt_Content;
|
|
|
|
|
private Button btn_Close;
|
|
|
|
|
private Action callback;
|
|
|
|
|
|
|
|
|
|
public override void Init()
|
|
|
|
|
{
|
|
|
|
|
base.Init();
|
2024-12-01 23:23:44 +08:00
|
|
|
|
// txt_Title = GetValue<TMP_Text>("txt_Title");
|
2024-11-07 23:17:41 +08:00
|
|
|
|
txt_Content = GetValue<TMP_Text>("txt_Content");
|
|
|
|
|
btn_Close = GetValue<Button>("btn_Close");
|
|
|
|
|
|
|
|
|
|
btn_Close.onClick.AddListener(ClickClose);
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-01 23:23:44 +08:00
|
|
|
|
public void SetData(string content, Action callback = null)
|
|
|
|
|
{
|
|
|
|
|
// txt_Title.text = title;
|
|
|
|
|
txt_Content.text = content;
|
|
|
|
|
this.callback = callback;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-07 23:17:41 +08:00
|
|
|
|
public void SetData(string title, string content, Action callback = null)
|
|
|
|
|
{
|
2024-12-01 23:23:44 +08:00
|
|
|
|
// txt_Title.text = title;
|
2024-11-07 23:17:41 +08:00
|
|
|
|
txt_Content.text = content;
|
|
|
|
|
this.callback = callback;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ClickClose()
|
|
|
|
|
{
|
2024-11-08 11:05:33 +08:00
|
|
|
|
EventManager.Instance.FireNow(this, new UIHideOrShowEventArgs(UIType.DialogueUI));
|
2024-11-07 23:17:41 +08:00
|
|
|
|
callback?.Invoke();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|