53 lines
1.1 KiB
C#
53 lines
1.1 KiB
C#
// Author: whc
|
|
// Desc: 对话框提示
|
|
|
|
using System.Collections;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class TipDialogUnit : TipUnit
|
|
{
|
|
public TextMeshProUGUI m_txtTitle;
|
|
public Button m_BtnYes;
|
|
|
|
public DialogData m_Data;
|
|
|
|
public override void Awake()
|
|
{
|
|
base.Awake();
|
|
m_txtTitle = transform.Find("tmpTitle").GetComponent<TextMeshProUGUI>();
|
|
m_BtnYes = transform.Find("btnYes").GetComponent<Button>();
|
|
}
|
|
|
|
public virtual void OnEnable()
|
|
{
|
|
m_BtnYes.onClick.AddListener(OnBtnYesClick);
|
|
}
|
|
|
|
public virtual void OnDisable()
|
|
{
|
|
m_BtnYes.onClick.RemoveAllListeners();
|
|
}
|
|
|
|
public virtual void OnBtnCloseClick()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
|
|
public virtual void OnBtnYesClick()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
|
|
public override void Refresh(TipData _Data)
|
|
{
|
|
base.Refresh(_Data);
|
|
m_Data = _Data as DialogData;
|
|
m_txtTitle.text = m_Data.m_title;
|
|
//Debug.Log("TipUnit. Refresh(). text:" + _Data.m_text);
|
|
}
|
|
|
|
|
|
|
|
} |