标签:on() wak ctr root col ons tar 对话 stat
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
/// <summary>
/// 提示、对话框控制
/// </summary>
public class DialogTipsCtrl : MonoBehaviour
{
private GameObject waitingDialogRoot;
private GameObject messageDialogRoot;
private Text messageDialogMessageText;
private Button messageDialogOKButton;
private static DialogTipsCtrl instance;
public static DialogTipsCtrl Instance
{
get
{
return instance;
}
}
void Awake()
{
instance = this;
}
void Start()
{
waitingDialogRoot = transform.Find("WaitingDialog").gameObject;
messageDialogRoot = transform.Find("MessageDialog").gameObject;
messageDialogMessageText = transform.Find("MessageDialog/Panel/Message").GetComponent<Text>();
messageDialogOKButton = transform.Find("MessageDialog/Panel/OK").GetComponent<Button>();
messageDialogOKButton.onClick.AddListener(OnClickMessageDialogOKButton);
}
/// <summary>
/// 弹出一个消息提示框
/// </summary>
/// <param name="message">要显示的消息内容</param>
public void ShowMessage(string message)
{
messageDialogMessageText.text = message;
messageDialogRoot.SetActive(true);
}
void OnClickMessageDialogOKButton()
{
messageDialogRoot.SetActive(false);
}
/// <summary>
/// 显示等待提示
/// </summary>
public void BeginWait()
{
waitingDialogRoot.SetActive(true);
}
/// <summary>
/// 关闭等待提示
/// </summary>
public void EndWait()
{
waitingDialogRoot.SetActive(false);
}
}
标签:on() wak ctr root col ons tar 对话 stat
原文地址:http://www.cnblogs.com/0315cz/p/7993275.html