示例#1
0
    private IEnumerator DoShowDialogBox(string message, Action <int> result, DialogBoxPresetType preset)
    {
        switch (preset)
        {
        case DialogBoxPresetType.Ok:
            yield return(DoShowDialogBox(message, result, GetStrings("PersistentUI", "ok"), new TMP_FontAsset[] { greenFont }));

            break;

        case DialogBoxPresetType.OkCancel:
            yield return(DoShowDialogBox(message, result, GetStrings("PersistentUI", "ok", "cancel"), new TMP_FontAsset[] { greenFont, goldFont }));

            break;

        case DialogBoxPresetType.YesNo:
            yield return(DoShowDialogBox(message, result, GetStrings("PersistentUI", "yes", "no"), new TMP_FontAsset[] { greenFont, redFont }));

            break;

        case DialogBoxPresetType.YesNoCancel:
            yield return(DoShowDialogBox(message, result, GetStrings("PersistentUI", "yes", "no", "cancel"), new TMP_FontAsset[] { greenFont, redFont, goldFont }));

            break;

        case DialogBoxPresetType.OkIgnore:
            yield return(DoShowDialogBox(message, result, GetStrings("PersistentUI", "ok", "ignore"), null));

            break;
        }
    }
示例#2
0
    public void ShowDialogBox(string table, string key, Action <int> result, DialogBoxPresetType preset, object[] args = null)
    {
        DialogBox_Loading = true;
        var message = LocalizationSettings.StringDatabase.GetLocalizedStringAsync(table, key, args);

        StartCoroutine(DoShowDialogBox(message, result, preset));
    }
示例#3
0
        public CM_PopUpBuilder LoadPreset(DialogBoxPresetType presetType, dynamic title, dynamic message, TMP_FontAsset titleFont, TMP_FontAsset messageFont)
        {
            switch (presetType)
            {
            case DialogBoxPresetType.Ok:
                break;

            case DialogBoxPresetType.OkCancel:
                break;

            case DialogBoxPresetType.YesNo:
                break;

            case DialogBoxPresetType.YesNoCancel:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(presetType), presetType, null);

                /*
                 * dialogBox.SetParams(message, result, "OK", null, null, greenFont);
                 * dialogBox.SetParams(message, result, "OK", "Cancel", null, greenFont, goldFont);
                 * dialogBox.SetParams(message, result, "Yes", "No", null, greenFont, redFont);
                 * dialogBox.SetParams(message, result, "Yes", "No", "Cancel", greenFont, redFont, goldFont);
                 */
            }

            return(null);
        }
示例#4
0
    /// <summary>
    /// Show a dialog box created automatically with a preset selection of common uses.
    /// </summary>
    /// <param name="message">Message to display.</param>
    /// <param name="result"Result to invoke, based on the button ID pressed: Left (0), Middle (1), Right (2).</param>
    /// <param name="preset">Preset to automatically set up the rest of the dialog box for you.</param>
    public void ShowDialogBox(string message, Action <int> result, DialogBoxPresetType preset)
    {
        switch (preset)
        {
        case DialogBoxPresetType.Ok:
            dialogBox.SetParams(message, result, "OK", null, null, greenFont);
            break;

        case DialogBoxPresetType.OkCancel:
            dialogBox.SetParams(message, result, "OK", "Cancel", null, greenFont, goldFont);
            break;

        case DialogBoxPresetType.YesNo:
            dialogBox.SetParams(message, result, "Yes", "No", null, greenFont, redFont);
            break;

        case DialogBoxPresetType.YesNoCancel:
            dialogBox.SetParams(message, result, "Yes", "No", "Cancel", greenFont, redFont, goldFont);
            break;
        }
    }
示例#5
0
 public void ShowDialogBox(string message, Action <int> result, DialogBoxPresetType preset)
 {
     Debug.LogWarning($"Dialog box not localized '{message}'");
     DialogBox_Loading = true;
     StartCoroutine(DoShowDialogBox(message, result, preset));
 }
示例#6
0
    /// <summary>
    /// Show a dialog box created automatically with a preset selection of common uses.
    /// </summary>
    /// <param name="message">Message to display.</param>
    /// <param name="result">Result to invoke, based on the button ID pressed: Left (0), Middle (1), Right (2).</param>
    /// <param name="preset">Preset to automatically set up the rest of the dialog box for you.</param>

    private IEnumerator DoShowDialogBox(AsyncOperationHandle <string> message, Action <int> result, DialogBoxPresetType preset)
    {
        yield return(message);

        yield return(DoShowDialogBox(message.Result, result, preset));
    }