55 lines
1.2 KiB
C#
55 lines
1.2 KiB
C#
// Author: whc
|
|
// Desc: 对话框提示
|
|
|
|
using System.Collections;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class TipDialogUnit : TipUnit
|
|
{
|
|
public Text m_txtTitle;
|
|
public Button m_BtnClose;
|
|
public Button m_BtnYes;
|
|
|
|
public DialogData m_Data;
|
|
|
|
public override void Awake()
|
|
{
|
|
base.Awake();
|
|
m_txtTitle = transform.Find("txtTitle").GetComponent<Text>();
|
|
m_BtnClose = transform.Find("btnClose").GetComponent<Button>();
|
|
m_BtnYes = transform.Find("btnYes").GetComponent<Button>();
|
|
}
|
|
|
|
public void OnEnable()
|
|
{
|
|
m_BtnClose.onClick.AddListener(OnBtnCloseClick);
|
|
m_BtnYes.onClick.AddListener(OnBtnYesClick);
|
|
}
|
|
|
|
public void OnDisable()
|
|
{
|
|
m_BtnClose.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);
|
|
}
|
|
|
|
|
|
|
|
} |