Ejemplo n.º 1
0
    private void SetDialogBoxType(DialogBoxType dialogBoxType)
    {
        HideAllOptionalControls();

        if (dialogBoxType == DialogBoxType.MessageWithOk)
        {
            MessageText.gameObject.SetActive(true);
            MiddleOkButton.gameObject.SetActive(true);
        }
        else if (dialogBoxType == DialogBoxType.MessageWithOkCancel)
        {
            MessageText.gameObject.SetActive(true);
            OkButton.gameObject.SetActive(true);
            CancelButton.gameObject.SetActive(true);
        }
        else if (dialogBoxType == DialogBoxType.PromptWithYesNo)
        {
            PromptInputField.gameObject.SetActive(true);

            SetOkButtonText("Yes");
            OkButton.gameObject.SetActive(true);

            SetCancelButtonText("No");
            CancelButton.gameObject.SetActive(true);
        }
        else
        {
            throw new Exception("SetDialogBoxType being set to invalid type: " + dialogBoxType);
        }
    }
Ejemplo n.º 2
0
    public static void Create(string title, string content, DialogBoxType type, Action callback1, Action callback2, string oneButtonName, string twoButtonName)
    {
        switch (type)
        {
        case DialogBoxType.OneButton:
            C_MonoSingleton <C_UIMgr> .GetInstance().OpenUI("UI_DialogBox_OneButton", content, callback1, oneButtonName);

            break;

        case DialogBoxType.TwoButton:
            C_MonoSingleton <C_UIMgr> .GetInstance().OpenUI("UI_DialogBox_TwoButton", content, callback1, callback2, oneButtonName, twoButtonName);

            break;

        case DialogBoxType.Tile_OneButton:
            C_MonoSingleton <C_UIMgr> .GetInstance().OpenUI("UI_DialogBox_Title_OneButton", title, content, callback1, oneButtonName);

            break;

        case DialogBoxType.Tile_TwoButton:
            C_MonoSingleton <C_UIMgr> .GetInstance().OpenUI("UI_DialogBox_Title_TwoButton", title, content, callback1, callback2, oneButtonName, twoButtonName);

            break;
        }
    }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes the dialog with a custom type, header and message.
        /// </summary>
        /// <param name="type"> Type of the dialog. </param>
        /// <param name="message"> The text of the message. </param>
        public DialogBox(DialogBoxType type, string header, string message)
        {
            InitializeComponent();
            DataContext = this;

            Header  = header;
            Message = message;

            if (type != DialogBoxType.INFORMATION)
            {
                YesVisibility = Visibility.Visible;
                NoVisibility  = Visibility.Visible;
                OkVisibility  = Visibility.Collapsed;
            }
        }
Ejemplo n.º 4
0
        public static void activateButton(Action buttonCallback, DialogBoxType type, string infoText, string buttonText, int infoSize = 30, int buttonTextSize = 25)
        {
            if (ignoreConnectionLostMsg && (type == DialogBoxType.GameServerConnLost || type == DialogBoxType.MasterServerConnLost))
            {
                return;
            }
            if (gameOver && type == DialogBoxType.GameServerConnLost)
            {
                return;
            }

            singleton.currentEvent = new dialogEvent(buttonCallback, infoText, buttonText, infoSize, buttonTextSize, type);
            singleton.showEvent();
            //addToEventQ(new dialogEvent (buttonCallback, infoText, buttonText, infoSize, buttonTextSize, type));
        }
Ejemplo n.º 5
0
    public void ShowDialogBoxAsType(DialogBoxType dialogBoxType)
    {
        SetDialogBoxType(dialogBoxType);

        ShowDialogBox();
    }
Ejemplo n.º 6
0
 private void ShowDialogBoxAsType(DialogBoxType dialogBoxType)
 {
     _dialogBoxScript.ShowDialogBoxAsType(dialogBoxType);
 }
Ejemplo n.º 7
0
 private void ShowDialogBoxAsType(DialogBoxType dialogBoxType)
 {
     _dialogBoxScript.ShowDialogBoxAsType(dialogBoxType);
 }
Ejemplo n.º 8
0
        public DialogBox(Vector2 size, DialogBoxType type, string header, string description, Vector2? location = null)
        {
            this.Size = size;
            this.type = type;

            //eventsCompleted = false;

            if (location != null)
                this.Location = (Vector2)location;
            else
                this.Alignment = ControlAlignment.Center;

            // Header container
            Container headerContainer = new Container();
            headerContainer.Size = new Vector2(this.Size.X, this.Size.Y * .13f);
            Add(headerContainer);

            // Header lbl
            Label headerLabel = new Label();
            headerLabel.Alignment = ControlAlignment.Center;
            headerLabel.Text = header;
            headerContainer.Add(headerLabel);

            // Close dialog button.
            Button closeButton = new Button();
            closeButton.Alignment = ControlAlignment.Right;
            closeButton.Size = new Vector2(this.Size.Y * .10f, this.Size.Y * .10f);
            closeButton.Click += closeButton_Click;
            closeButton.Text = "X";
            headerContainer.Add(closeButton);

            // Fill (description)
            Container fillContainer = new Container();
            fillContainer.Fill = new FillInfo(Color.DarkGray);
            fillContainer.Border = null;
            fillContainer.Alignment = ControlAlignment.Center;
            fillContainer.Size = new Vector2(this.Size.X * .90f, this.Size.Y * .72f);
            //fillContainer.Location = new Vector2(0, headerContainer.Size.Y);
            Add(fillContainer);

            // Fill description
            Label dialogDescriptionLabel = new Label();
            dialogDescriptionLabel.WordWrap = true;
            dialogDescriptionLabel.Text = description;
            dialogDescriptionLabel.Alignment = ControlAlignment.Center;
            fillContainer.Add(dialogDescriptionLabel);

            // Button container
            Container buttonsContainer = new Container();
            buttonsContainer.Size = new Vector2(this.Size.X, this.Size.Y * .15f);
            buttonsContainer.Location = new Vector2(0, headerContainer.Size.Y + fillContainer.Size.Y);
            Add(buttonsContainer);

            // Buttons
            Button firstActionButton;
            Button secondActionButton;
            switch(type)
            {
                case DialogBoxType.Ok:
                    firstActionButton = new Button();
                    firstActionButton.Text = "OK";
                    firstActionButton.Alignment = ControlAlignment.Center;
                    firstActionButton.Size = new Vector2(buttonsContainer.Size.X * .50f, buttonsContainer.Size.Y * .80f);
                    firstActionButton.Click += firstActionButton_Click;
                    buttonsContainer.Add(firstActionButton);
                    break;

                case DialogBoxType.OkCancel:
                    firstActionButton = new Button();
                    firstActionButton.Text = "OK";
                    firstActionButton.Alignment = ControlAlignment.Center;
                    firstActionButton.Location = new Vector2(-buttonsContainer.Size.X * .25f, 0);
                    firstActionButton.Size = new Vector2(buttonsContainer.Size.X * .25f, buttonsContainer.Size.Y * .80f);
                    firstActionButton.Click += firstActionButton_Click;
                    buttonsContainer.Add(firstActionButton);

                    secondActionButton = new Button();
                    secondActionButton.Text = "Cancel";
                    secondActionButton.Alignment = ControlAlignment.Center;
                    secondActionButton.Location = new Vector2(buttonsContainer.Size.X * .25f, 0);
                    secondActionButton.Size = new Vector2(buttonsContainer.Size.X * .25f, buttonsContainer.Size.Y * .80f);
                    secondActionButton.Click += secondActionButton_Click;
                    buttonsContainer.Add(secondActionButton);
                    break;

                case DialogBoxType.YesNo:
                    firstActionButton = new Button();
                    firstActionButton.Text = "Yes";
                    firstActionButton.Alignment = ControlAlignment.Center;
                    firstActionButton.Location = new Vector2(-buttonsContainer.Size.X * .25f, 0);
                    firstActionButton.Size = new Vector2(buttonsContainer.Size.X * .25f, buttonsContainer.Size.Y * .80f);
                    firstActionButton.Click += firstActionButton_Click;
                    buttonsContainer.Add(firstActionButton);

                    secondActionButton = new Button();
                    secondActionButton.Text = "No";
                    secondActionButton.Alignment = ControlAlignment.Center;
                    secondActionButton.Location = new Vector2(buttonsContainer.Size.X * .25f, 0);
                    secondActionButton.Size = new Vector2(buttonsContainer.Size.X * .25f, buttonsContainer.Size.Y * .80f);
                    secondActionButton.Click += secondActionButton_Click;
                    buttonsContainer.Add(secondActionButton);
                    break;
            }
        }
Ejemplo n.º 9
0
 public dialogEvent(Action callback, string infoText, string buttonText, int infoSize, int buttonTextSize, DialogBoxType type)
 {
     this.callback  = callback; this.infoText = infoText; this.buttonText = buttonText; this.infoSize = infoSize; this.buttonTextSize = buttonTextSize;
     this.eventType = type;
 }
Ejemplo n.º 10
0
    public void ShowDialogBoxAsType(DialogBoxType dialogBoxType)
    {
        SetDialogBoxType(dialogBoxType);

        ShowDialogBox();
    }
Ejemplo n.º 11
0
    private void SetDialogBoxType(DialogBoxType dialogBoxType)
    {
        HideAllOptionalControls();

        if (dialogBoxType == DialogBoxType.MessageWithOk)
        {
            MessageText.gameObject.SetActive(true);
            MiddleOkButton.gameObject.SetActive(true);
        }
        else if (dialogBoxType == DialogBoxType.MessageWithOkCancel)
        {
            MessageText.gameObject.SetActive(true);
            OkButton.gameObject.SetActive(true);
            CancelButton.gameObject.SetActive(true);
        }
        else if (dialogBoxType == DialogBoxType.PromptWithYesNo)
        {
            PromptInputField.gameObject.SetActive(true);

            SetOkButtonText("Yes");
            OkButton.gameObject.SetActive(true);

            SetCancelButtonText("No");
            CancelButton.gameObject.SetActive(true);
        }
        else
        {
            throw new Exception("SetDialogBoxType being set to invalid type: " + dialogBoxType);
        }
    }
Ejemplo n.º 12
0
 // Display
 public void DisplayDialogBox(DialogBoxType dialogBox)
 {
     UserDialogs.Instance.ActionSheet(DialogBoxes[dialogBox].Config);
 }
Ejemplo n.º 13
0
        public event EventHandler noEvent;  // also cancel

        public DialogBox(Vector2 size, DialogBoxType type, string header, string description, Vector2?location = null)
        {
            this.Size = size;
            this.type = type;

            //eventsCompleted = false;

            if (location != null)
            {
                this.Location = (Vector2)location;
            }
            else
            {
                this.Alignment = ControlAlignment.Center;
            }

            // Header container
            Container headerContainer = new Container();

            headerContainer.Size = new Vector2(this.Size.X, this.Size.Y * .13f);
            Add(headerContainer);

            // Header lbl
            Label headerLabel = new Label();

            headerLabel.Alignment = ControlAlignment.Center;
            headerLabel.Text      = header;
            headerContainer.Add(headerLabel);

            // Close dialog button.
            Button closeButton = new Button();

            closeButton.Alignment = ControlAlignment.Right;
            closeButton.Size      = new Vector2(this.Size.Y * .10f, this.Size.Y * .10f);
            closeButton.Click    += closeButton_Click;
            closeButton.Text      = "X";
            headerContainer.Add(closeButton);

            // Fill (description)
            Container fillContainer = new Container();

            fillContainer.Fill      = new FillInfo(Color.DarkGray);
            fillContainer.Border    = null;
            fillContainer.Alignment = ControlAlignment.Center;
            fillContainer.Size      = new Vector2(this.Size.X * .90f, this.Size.Y * .72f);
            //fillContainer.Location = new Vector2(0, headerContainer.Size.Y);
            Add(fillContainer);

            // Fill description
            Label dialogDescriptionLabel = new Label();

            dialogDescriptionLabel.WordWrap  = true;
            dialogDescriptionLabel.Text      = description;
            dialogDescriptionLabel.Alignment = ControlAlignment.Center;
            fillContainer.Add(dialogDescriptionLabel);

            // Button container
            Container buttonsContainer = new Container();

            buttonsContainer.Size     = new Vector2(this.Size.X, this.Size.Y * .15f);
            buttonsContainer.Location = new Vector2(0, headerContainer.Size.Y + fillContainer.Size.Y);
            Add(buttonsContainer);

            // Buttons
            Button firstActionButton;
            Button secondActionButton;

            switch (type)
            {
            case DialogBoxType.Ok:
                firstActionButton           = new Button();
                firstActionButton.Text      = "OK";
                firstActionButton.Alignment = ControlAlignment.Center;
                firstActionButton.Size      = new Vector2(buttonsContainer.Size.X * .50f, buttonsContainer.Size.Y * .80f);
                firstActionButton.Click    += firstActionButton_Click;
                buttonsContainer.Add(firstActionButton);
                break;

            case DialogBoxType.OkCancel:
                firstActionButton           = new Button();
                firstActionButton.Text      = "OK";
                firstActionButton.Alignment = ControlAlignment.Center;
                firstActionButton.Location  = new Vector2(-buttonsContainer.Size.X * .25f, 0);
                firstActionButton.Size      = new Vector2(buttonsContainer.Size.X * .25f, buttonsContainer.Size.Y * .80f);
                firstActionButton.Click    += firstActionButton_Click;
                buttonsContainer.Add(firstActionButton);

                secondActionButton           = new Button();
                secondActionButton.Text      = "Cancel";
                secondActionButton.Alignment = ControlAlignment.Center;
                secondActionButton.Location  = new Vector2(buttonsContainer.Size.X * .25f, 0);
                secondActionButton.Size      = new Vector2(buttonsContainer.Size.X * .25f, buttonsContainer.Size.Y * .80f);
                secondActionButton.Click    += secondActionButton_Click;
                buttonsContainer.Add(secondActionButton);
                break;

            case DialogBoxType.YesNo:
                firstActionButton           = new Button();
                firstActionButton.Text      = "Yes";
                firstActionButton.Alignment = ControlAlignment.Center;
                firstActionButton.Location  = new Vector2(-buttonsContainer.Size.X * .25f, 0);
                firstActionButton.Size      = new Vector2(buttonsContainer.Size.X * .25f, buttonsContainer.Size.Y * .80f);
                firstActionButton.Click    += firstActionButton_Click;
                buttonsContainer.Add(firstActionButton);

                secondActionButton           = new Button();
                secondActionButton.Text      = "No";
                secondActionButton.Alignment = ControlAlignment.Center;
                secondActionButton.Location  = new Vector2(buttonsContainer.Size.X * .25f, 0);
                secondActionButton.Size      = new Vector2(buttonsContainer.Size.X * .25f, buttonsContainer.Size.Y * .80f);
                secondActionButton.Click    += secondActionButton_Click;
                buttonsContainer.Add(secondActionButton);
                break;
            }
        }
Ejemplo n.º 14
0
        public DialogBox(DialogBoxType type)
        {
            this.DialogType = type;

            InitializeComponent();
        }