Exemplo n.º 1
0
        /// <summary>
        /// Show an native alert dialog.
        /// </summary>
        /// <param name="title">The title of alert dialog.</param>
        /// <param name="message">The message of alert dialog.</param>
        /// <param name="yesButton">The yes button of alert dialog.</param>
        /// <param name="noButton">The no button of alert dialog.</param>
        /// <param name="onButtonPress">The callback delegate when press any button.</param>
        public virtual void ShowAlert(string title, string message, string yesButton, string noButton = null, OnAlertComplate onButtonPress = null)
        {
            AlertParams param = new AlertParams();

            param.title         = title;
            param.message       = message;
            param.yesButton     = yesButton;
            param.noButton      = noButton;
            param.onButtonPress = onButtonPress;
            ShowAlert(param);
        }
Exemplo n.º 2
0
        internal bool CheckShowAlert(AlertParams param, out AlertParams outparam)
        {
            outparam = param;
            if (outparam.yesButton == null)
            {
                Debug.LogError("must set yesButton for UI.ShowAlert");
                return(false);
            }
            if (outparam.noButton == null)
            {
                outparam.neutralButton = null;
            }

            outparam.alertId = CSharpUtil.GetUniqueInt();
            map.Add(outparam.alertId, outparam);
            return(true);
        }
Exemplo n.º 3
0
        public override void ShowAlert(AlertParams param)
        {
            AlertParams nowparam;

            if (!CheckShowAlert(param, out nowparam))
            {
                return;
            }
            _AlertParams data = new _AlertParams();

            data.alertId       = nowparam.alertId;
            data.title         = nowparam.title;
            data.message       = nowparam.message;
            data.yesButton     = nowparam.yesButton;
            data.noButton      = nowparam.noButton;
            data.neutralButton = nowparam.neutralButton;
            _CPAPI_UI_ShowAlert(data);
        }
        public override void ShowAlert(AlertParams param)
        {
            AlertParams nowparam;

            if (!CheckShowAlert(param, out nowparam))
            {
                return;
            }
            using (var jparam = new AndroidJavaObject("com.litefeel.crossplatformapi.android.ui.AlertParams"))
            {
                jparam.Set("title", nowparam.title);
                jparam.Set("message", nowparam.message);
                jparam.Set("yesButton", nowparam.yesButton);
                jparam.Set("noButton", nowparam.noButton);
                jparam.Set("neutralButton", nowparam.neutralButton);
                jparam.Set("alertId", nowparam.alertId);
                api.CallStatic("showAlert", jparam);
            }
        }
Exemplo n.º 5
0
        public void ShowAlert()
        {
            if (string.IsNullOrEmpty(inputField.text))
            {
                inputField.text = "this is alert text!";
            }
            AlertParams param = new AlertParams()
            {
                title         = "this is title",
                message       = inputField.text,
                yesButton     = "Yes",
                noButton      = "No",
                neutralButton = "Neutral"
            };

            param.onButtonPress = (AlertButton button) =>
            {
                print("the alert button press " + button.ToString());
            };
            UI.ShowAlert(param);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Show an native alert dialog.
 /// </summary>
 /// <param name="param">must have yesButton, ignore neutralButton when have notnoButton.</param>
 public abstract void ShowAlert(AlertParams param);
Exemplo n.º 7
0
 /// <summary>
 /// Show an native alert dialog.
 /// </summary>
 /// <param name="param">must have yesButton, ignore neutralButton when have notnoButton.</param>
 public static void ShowAlert(AlertParams param)
 {
     Init();
     api.ShowAlert(param);
 }