- 最后登录
- 2016-8-29
- 注册时间
- 2012-8-25
- 阅读权限
- 90
- 积分
- 23585
- 纳金币
- 20645
- 精华
- 62
|
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);
- }
- }
复制代码 |
|