Пример #1
0
    /// <summary>
    /// Display a message box.
    /// </summary>
    /// <param name="message">The message to be displayed.</param>
    /// <param name="title">A title for the message box.</param>
    /// <param name="onFinished">An action to be called when the dialog is closed.</param>
    /// <param name="buttons">Selects what buttons are shown on the dialog.</param>
    /// <returns>The message box game object.</returns>
    public static MessageBox Show(string message, string title = null, OnDialogClicked onFinished = null, MessageBoxButtons buttons = MessageBoxButtons.OK)
    {
        var box = (Instantiate(Resources.Load <GameObject>(PrefabResourceName)) as GameObject).GetComponent <MessageBox>();

        box.onFinish = onFinished;

        box.SetUpButtons(buttons);
        box.SetText(message, title);

        return(box);
    }
Пример #2
0
 public override void onButtonClick(InputEngine.MouseArgs e)
 {
     base.onButtonClick(e);
     if (IsIn(e.curState.X, e.curState.Y))
     {
         Sound.SoundPlayer.PlayButtonClick();
         if (OnDialogClicked != null)
         {
             e.Handled = true;
             OnDialogClicked.Invoke(this, new DialogClickedArgs()
             {
                 button = e.button
             });
         }
     }
 }
Пример #3
0
 /// <summary>
 /// Display a message box.
 /// </summary>
 /// <param name="message">The message to be displayed.</param>
 /// <param name="onFinished">An action to be called when the dialog is closed.</param>
 /// <param name="buttons">Selects what buttons are shown on the dialog.</param>
 /// <returns>The message box game object.</returns>
 public static MessageBox Show(string message, OnDialogClicked onFinished, MessageBoxButtons buttons = MessageBoxButtons.OK)
 {
     return(Show(message, null, onFinished, buttons));
 }