Пример #1
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            if (cancelButton.containsPoint(x, y))
            {
                exitThisMenu(playSound);
            }
            else if (okButton.containsPoint(x, y))
            {
                if (_textBox.Text.Length > 0)
                {
                    AddTaskAndExit(false);
                }
            }
            else if (smartOkButton.containsPoint(x, y))
            {
                if (_textBox.Text.Length > 0 && _taskParser.MatchFound())
                {
                    AddTaskAndExit(true);
                }
            }
            else if (optionsButton.containsPoint(x, y))
            {
                IClickableMenu optionsMenu = new TaskOptionsMenu(_previousText, _taskParser, _translation);

                _parentMenu.SetChildMenu(optionsMenu);
                optionsMenu.SetChildMenu(this);
                OnExit();
            }
            else if (closeTipButton.containsPoint(x, y) && DeluxeJournalMod.Instance?.Config is Config config)
            {
                config.ShowSmartAddTip = false;
            }
            else if (textBoxCC.containsPoint(x, y))
            {
                _textBox.SelectMe();

                // HACK: TextBox.Update() will not show the gamepad keyboard immediately after opening
                //  this menu due to Game1.lastCursorMotionWasMouse being true, regardless of the fact
                //  that snapToDefaultClickableComponent() should invalidate this flag. As a workaround,
                //  manually show the keyboard without checking mouse state.
                if (Game1.options.SnappyMenus)
                {
                    Game1.showTextEntry(_textBox);
                }
            }
        }