54 lines
1.3 KiB
C#
54 lines
1.3 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using QFramework;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
|
|
namespace QFramework.Example
|
|
{
|
|
public class UITextTipData : UIPanelData
|
|
{
|
|
public string text;
|
|
|
|
public List<string> btns;
|
|
}
|
|
public partial class UITextTip : UIPanel
|
|
{
|
|
protected override void OnInit(IUIData uiData = null)
|
|
{
|
|
|
|
mData = uiData as UITextTipData ?? new UITextTipData();
|
|
|
|
}
|
|
|
|
protected override void OnOpen(IUIData uiData = null)
|
|
{
|
|
mData = uiData as UITextTipData ?? new UITextTipData();
|
|
Des.text = mData.text;
|
|
BtnContent.RemoveAllChildren();
|
|
foreach (var item in mData.btns)
|
|
{
|
|
GameObject btn = GameObject.Instantiate(Btn.gameObject, BtnContent);
|
|
btn.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = item;
|
|
btn.name = item;
|
|
btn.GetComponent<Button>().onClick.AddListener(() =>
|
|
{
|
|
Hide();
|
|
});
|
|
}
|
|
}
|
|
|
|
protected override void OnShow()
|
|
{
|
|
}
|
|
|
|
protected override void OnHide()
|
|
{
|
|
}
|
|
|
|
protected override void OnClose()
|
|
{
|
|
}
|
|
}
|
|
}
|