Example #1
0
    public void OnToggleDialog(bool forceClose)
    {
        bool isBuildingModeDialog = dialogType.Equals(DialogType.BuildingModeDialog);

        GameStore.SetOpenedDialog(dialogType);
        Tooltip.OnHideTooltip();
        // hide dialog
        if (gameObject.activeSelf)
        {
            GameStore.SetOpenedDialog(DialogType.Hidden);
            gameObject.SetActive(false);

            // Toggle off build mode
            if (isBuildingModeDialog)
            {
                GridBuildMode.OnToggleBuildMode();
            }

            return;
        }

        if (!forceClose)
        {
            if (isBuildingModeDialog)
            {
                GridBuildMode.OnToggleBuildMode();
            }
            gameObject.SetActive(true);
        }
    }
        private DialogBox GetDialogType()
        {
            if (DialogType.Equals("NoIcons"))
            {
                return(new DialogBox("Any text message", "Title"));
            }

            if (DialogType.Equals("Question"))
            {
                return new QuestionDialogBox("Question?")
                       {
                       }
            }
            ;

            if (DialogType.Equals("Warning"))
            {
                return new WarningDialogBox("Warning!")
                       {
                       }
            }
            ;

            if (DialogType.Equals("Information"))
            {
                return new InformationDialogBox("Information")
                       {
                       }
            }
            ;

            if (DialogType.Equals("Error"))
            {
                return new ErrorDialogBox("Error")
                       {
                       }
            }
            ;

            if (DialogType.Equals("Password"))
            {
                return new PasswordDialogBox("Enter password")
                       {
                       }
            }
            ;

            if (DialogType.Equals("PasswordConfirm"))
            {
                return new PasswordCofirmDialogBox("Enter password")
                       {
                       }
            }
            ;

            return(null);
        }