Example #1
0
 /// <summary>
 /// 请求提示
 /// </summary>
 /// <param name="text">提示文本</param>
 /// <param name="type">提示窗口类型</param>
 /// <param name="onOK">按确认/重试键时回调</param>
 /// <param name="onCancel">按取消键时回调(默认关闭弹窗)</param>
 /// <param name="duration">自动消失时长</param>
 /// <remarks>用于呼出提示窗口(弹窗)</remarks>
 /// <example>例 1:显示一个提示:
 /// <code>
 /// var gameSys = GameSystem.get();
 /// gameSys.requestAlert("提示!");
 /// </code>
 /// </example>
 /// <example>例 2:显示一个带确认按钮的提示,确认时执行 onOK 函数,否则关闭弹窗:
 /// <code>
 /// var gameSys = GameSystem.get();
 /// gameSys.requestAlert("确认?", AlertWindow.Type.YesOrNo, onOK);
 /// </code>
 /// </example>
 public void requestAlert(string text,
                          AlertWindow.Type type = AlertWindow.Type.Notice,
                          UnityAction onOK      = null, UnityAction onCancel = null,
                          float duration        = AlertWindow.DefaultDuration)
 {
     alertRequest = new AlertRequest(text, type, onOK, onCancel, duration);
 }
Example #2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="btns">弹窗按钮文本</param>
 /// <param name="actions">弹窗按钮动作</param>
 public AlertRequest(string text,
                     AlertWindow.Type type = AlertWindow.Type.Notice,
                     UnityAction onOK      = null, UnityAction onCancel = null,
                     float duration        = AlertWindow.DefaultDuration)
 {
     this.text     = text; this.type = type;
     this.onOK     = onOK; this.onCancel = onCancel;
     this.duration = duration;
 }
Example #3
0
 /// <summary>
 /// 显示提示
 /// </summary>
 /// <param name="msg">提示信息</param>
 /// <param name="btns">按键文本</param>
 /// <param name="actions">按键回调</param>
 static void alert(string text,
                   AlertWindow.Type type = AlertWindow.Type.Notice,
                   UnityAction onOK      = null, UnityAction onCancel = null,
                   float duration        = AlertWindow.DefaultDuration)
 {
     Debug.Log("alert: " + text + ":" + alertWindow);
     if (alertWindow)
     {
         alertWindow.activate(text, type, onOK, onCancel, duration);
     }
     // 若未设置提示窗口,储存这个信息
     else
     {
         alertText = text;
         onOK?.Invoke();
     }
 }