纳金网
标题:
OK Cancel 或者只有一个OK框的通用方法
[打印本页]
作者:
王者再临
时间:
2015-10-29 23:58
标题:
OK Cancel 或者只有一个OK框的通用方法
OK Cancel 或者只有一个OK框的通用方法
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class WarningPanel : MonoBehaviour
{
public delegate void Callback_OK();
public Callback_OK callOK;
public delegate void Callback_Cancel();
public Callback_Cancel callCancel;
public Text txtInfo;
public Button btnOK;
public Button btnCancel;
public Button btnOneOK;
// Use this for initialization
void Start ()
{
//txtInfo.text = "";
}
// Update is called once per frame
void Update () {
}
public void Show(int mode)
{
gameObject.SetActive (true);
SetMode (mode);
}
public void Hide()
{
gameObject.SetActive (false);
}
public void onBtnOK()
{
if(callOK!=null)
callOK();
Main.soundMgr.Play (SoundMgr.Btn_0);
}
public void onBtnCancel()
{
callCancel ();
Main.soundMgr.Play (SoundMgr.Btn_0);
}
public void SetMode(int num)
{
btnOK.gameObject.SetActive( num==2);
btnCancel.gameObject.SetActive (num == 2);
btnOneOK.gameObject.SetActive (num == 1);
}
}
复制代码
欢迎光临 纳金网 (http://go.narkii.com/club/)
Powered by Discuz! X2.5