/// <summary>
    /// 对话框
    /// </summary>
    /// <param name="title">对话框标题</param>
    /// <param name="content">对话框文字内容</param>
    /// <param name="buttonPattern">按钮的种类,常用方法:BUTTON.YES|BUTTON.NO,或者BUTTON.OK</param>
    /// <param name="callBack">对话框按钮被按下后的回调函数,参数是按钮的ID</param>
    /// <param name="showBackground">是否显示背景板</param>
    public void Init(string title, string content, int buttonPattern, MessageBoxCallBack callBack, bool showBackground)
    {
        _lbTitle.text   = title;
        _lbContent.text = content;

        _btn1.gameObject.SetActive(false);
        _btn2.gameObject.SetActive(false);
        _btn3.gameObject.SetActive(false);
        _goBg.SetActive(false);
        if ((buttonPattern & (int)BUTTON.YES) == (int)BUTTON.YES)
        {
            _btn1.gameObject.SetActive(true);
        }
        if ((buttonPattern & (int)BUTTON.NO) == (int)BUTTON.NO)
        {
            _btn2.gameObject.SetActive(true);
        }
        if ((buttonPattern & (int)BUTTON.OK) == (int)BUTTON.OK)
        {
            _btn3.gameObject.SetActive(true);
        }

        if (showBackground)
        {
            _goBg.SetActive(true);
        }
        _messageBoxCallBack = callBack;
    }
Exemple #2
0
 public SubMessage(SubMessageLayer subMsgLayer, string MsgTitle, string MsgMainBody, string EnsureBtnStr, MessageBoxCallBack SureMessageCallBack)//带确定返回参数
 {
     this.SubMsgLayer         = subMsgLayer;
     this.MsgTitle            = MsgTitle;
     this.MsgMainBody         = MsgMainBody;
     this.EnsureBtnStr        = EnsureBtnStr;
     this.SureMessageCallBack = SureMessageCallBack;
     messageType = MessageType.WithAnParameter;
 }
Exemple #3
0
 public static void show(string message, string yes, MessageBoxCallBack yesCall, string no, MessageBoxCallBack noCall)
 {
     info = new MsgInfo
     {
         show = true,
         message = message,
         yes = yes,
         yesCall = yesCall,
         no = no,
         noCall = noCall
     };
 }
Exemple #4
0
 //带消耗性货币
 public SubMessage(SubMessageLayer subMsgLayer, EMessageCoinType coinType, string MsgMainBody, string MsgMoney, string EnsureBtnStr, string CancelBtnStr, MessageBoxCallBack SureMessageCallBack, MessageBoxCallBack CancelMessageCallBack)    //带确定取消返回参数
 {
     this.SubMsgLayer = subMsgLayer;
     //界面中把标题当消耗货币使用//
     this.MsgMainBody           = MsgMainBody;
     this.MsgMoneyStr           = MsgMoney;
     this.ShowCoinType          = coinType;
     this.EnsureBtnStr          = EnsureBtnStr;
     this.CancelBtnStr          = CancelBtnStr;
     this.SureMessageCallBack   = SureMessageCallBack;
     this.CancelMessageCallBack = CancelMessageCallBack;
     messageType = MessageType.WithTwoParamMoney;
 }
Exemple #5
0
        public DialogResult MessageBoxByAsync(string text, string caption, MessageBoxButtons okcancel)
        {
            DialogResult drt = DialogResult.Cancel;

            try
            {
                MessageBoxCallBack stcb = new MessageBoxCallBack(MsgBox);
                drt = (DialogResult)(this.Invoke(stcb, new object[] { text, caption, okcancel }));
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.StackTrace);
            }
            return(drt);
        }
 private void Update()
 {
     if (Canvas.activeInHierarchy == true)
     {
         return;
     }
     if (Queue.Count == 0)
     {
         return;
     }
     NextOKCall     = Queue[0].OKCallback;
     NextCancelCall = Queue[0].CancelCallback;
     Message.text   = Queue[0].Message;
     Queue.RemoveAt(0);
     Canvas.SetActive(true);
 }
Exemple #7
0
 public static void Show(string text, MessageBoxCallBack callBack = null)
 {
     instace.Add(new MessageBoxContext(text, callBack));
 }
Exemple #8
0
 public void ShowCostMoneyMessageBox(bool CanBuy, EMessageCoinType CostMoneyType, int CostMoneyNumber, string Msg, string SureBtnStr, string CancelBtnStr, MessageBoxCallBack SureBtnCallBack, MessageBoxCallBack CancelBtnCallBack)
 {
     MessageBox.Instance.Show(3, CostMoneyType, Msg, CostMoneyNumber, SureBtnStr, CancelBtnStr, SureBtnCallBack, BuyCancelCallBack);
 }
Exemple #9
0
 /// <summary>
 /// show方法,显示提示框
 /// </summary>
 /// <param name="MsgLayer">优先级,1为最高,10为最低</param>
 /// <param name="MsgTitle">信息标题</param>
 /// <param name="Msg">主信息</param>
 /// <param name="EnsureBtnStr">确定按钮的文字</param>
 /// <param name="CancelBtnStr">取消按钮的文字</param>
 /// <param name="SureButtonCallBack">确定按钮的回调</param>
 /// <param name="CancelButtonCallBack">取消按钮的回调</param>
 public void Show(int MsgLayer, string MsgTitle, string Msg, string EnsureBtnStr, string CancelBtnStr, MessageBoxCallBack SureButtonCallBack, MessageBoxCallBack CancelButtonCallBack)
 {
     if (MessageArray[MsgLayer] == null)
     {
         MessageArray[MsgLayer] = new SubMessageLayer(MsgLayer);
     }
     MessageArray[MsgLayer].AddSubMessage(new SubMessage(MessageArray[MsgLayer], MsgTitle, Msg, EnsureBtnStr, CancelBtnStr, SureButtonCallBack, CancelButtonCallBack));
     ShowLayerMsgBox();
 }
Exemple #10
0
        /// <summary>
        /// show方法,显示提示框(带消耗货币)
        /// </summary>
        /// <param name="MsgLayer">优先级,1为最高,10为最低</param>
        /// <param name="MsgTitle">信息标题</param>
        /// <param name="Msg">主信息</param>
        /// <param name="EnsureBtnStr">确定按钮的文字</param>
        /// <param name="CancelBtnStr">取消按钮的文字</param>
        /// <param name="SureButtonCallBack">确定按钮的回调</param>
        /// <param name="CancelButtonCallBack">取消按钮的回调</param>
        public void Show(int MsgLayer, EMessageCoinType coinType, string MsgText, int money, string EnsureBtnStr, string CancelBtnStr, MessageBoxCallBack SureButtonCallBack, MessageBoxCallBack CancelButtonCallBack)
        {
            if (MessageArray[MsgLayer] == null)
            {
                MessageArray[MsgLayer] = new SubMessageLayer(MsgLayer);
            }
            string strMoney = money.ToString();

            if ((coinType == EMessageCoinType.EGoldType && !PlayerManager.Instance.IsBindPayEnough(money)) || (coinType == EMessageCoinType.ECuType && !PlayerManager.Instance.IsMoneyEnough(money)))
            {
                strMoney = "[ff0000]" + money + "[-]";
            }
            MessageArray[MsgLayer].AddSubMessage(new SubMessage(MessageArray[MsgLayer], coinType, MsgText, strMoney, EnsureBtnStr, CancelBtnStr, SureButtonCallBack, CancelButtonCallBack));
            ShowLayerMsgBox();
        }
Exemple #11
0
 public void Show(string msg, MessageBoxCallBack callback)
 {
     infoLab.text = msg;
     msgBoxPane.gameObject.SetActive(true);
     _callBack = callback;
 }
 public void ShowMessage(string Message, MessageBoxCallBack OKCallback = null, MessageBoxCallBack CancelCallback = null)
 {
     Queue.Add(new MessageBoxQueue(Message, OKCallback, CancelCallback));
 }
 public MessageBoxQueue(string Message, MessageBoxCallBack OKCallback = null, MessageBoxCallBack CancelCallback = null)
 {
     this.Message        = Message;
     this.OKCallback     = OKCallback;
     this.CancelCallback = CancelCallback;
 }
Exemple #14
0
 public void active(MessageBoxContext value)
 {
     errorText.text = value.value;
     result         = value.result;
     canvas.SetActive(true);
 }
Exemple #15
0
 public MessageBoxContext(string value, MessageBoxCallBack result = null)
 {
     this.value  = value;
     this.result = result;
 }