Пример #1
0
 public override void Awake()
 {
     base.Awake();
     yesButton.OnSelect.AddListener(() => { onYes?.Invoke(); OnYes?.Invoke(); gameObject.SetActive(false); });
     noButton.OnSelect.AddListener(() => { onNo?.Invoke(); OnNo?.Invoke(); gameObject.SetActive(false); });
     yesButton.OnDeselect.AddListener(() => { onYes?.Invoke(); OnYes?.Invoke(); gameObject.SetActive(false); });
     noButton.OnDeselect.AddListener(() => { onNo?.Invoke(); OnNo?.Invoke(); gameObject.SetActive(false); });
 }
Пример #2
0
        private void Create(string message)
        {
            IsDialog = true;
            Message  = message;
            var count      = 0;
            var lines      = BasicOne.SplitToLines(message, Width - 2);
            var enumerable = lines as string[] ?? lines.ToArray();

            Height   = enumerable.Length + 3;
            PostionY = ParentWindow.Height / 2 - Height / 2;
            foreach (var l in enumerable)
            {
                var messageLabel = new Label(l, 1, 2 + count, this);
                Inputs.Add(messageLabel);
                count++;
            }


            /*
             * var messageLabel = new Label(Message, PostionX + 2, PostionY + 2, "messageLabel", this);
             * messageLabel.BackgroundColour = BackgroundColour;*/

            _yesBtn = new Button(Width - 9, Height, "YES", this)
            {
                Action = () =>
                {
                    OnYes?.Invoke();
                    ExitWindow();
                }
            };
            _noBtn = new Button(Width - 4, Height, "NO", this)
            {
                Action = () =>
                {
                    OnNo?.Invoke();
                    ExitWindow();
                }
            };

            Inputs.Add(_yesBtn);
            Inputs.Add(_noBtn);

            CurrentlySelected = _yesBtn;
        }
Пример #3
0
        private void CtrlBtnEdit_Click(object sender, EventArgs e)
        {
            string text = "";
            bool   flag = true;

            while (flag)
            {
                text = RenameForm.Invoke(false, _text);
                if (text != "")
                {
                    flag = false;
                }
                else
                {
                    MessageBox.Show("Если нужно удалить запись - выбирайте опцию" +
                                    " \"Удалить\". Пустые значения вводить нельзя.");
                }
            }
            DialogResult = DialogResult.OK;
            OnYes?.Invoke(text);
            Close();
        }
Пример #4
0
 private void button_Yes_Click(object sender, EventArgs e)
 {
     _isOk = true;
     OnYes?.Invoke();
     FinishForm();
 }