Пример #1
0
        public override void receiveLeftClick(int x, int y)
        {
            if (!this.bounds.Contains(x, y))
            {
                return;
            }

            var namingMenu = new NamingMenu(this.ChangeName, $"Pick a new name for {_pylon.Name}", _pylon.Name);

            Game1.activeClickableMenu = namingMenu;
        }
Пример #2
0
        private static void Postfix(NamingMenu __instance, ref TextBox ___textBox)
        {
            //replace TextBox
            TextBox_ textBox_ = new TextBox_(null, null, Game1.dialogueFont, Game1.textColor);

            textBox_.OnEnterPressed += new TextBoxEvent(__instance.textBoxEnter);
            textBox_.X      = ___textBox.X;
            textBox_.Y      = ___textBox.Y;
            textBox_.Width  = ___textBox.Width;
            textBox_.Height = ___textBox.Height;
            textBox_.SetText(___textBox.Text);
            ___textBox = textBox_;
        }
Пример #3
0
        internal static void NamingMenuPatch(NamingMenu __instance, TextBox ___textBox, string ___title)
        {
            try
            {
                string toSpeak = "";
                int    x = Game1.getMouseX(true), y = Game1.getMouseY(true);                                               // Mouse x and y position
                bool   isEscPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape); // For escaping/unselecting from the animal name text box

                if (firstTimeInNamingMenu)
                {
                    firstTimeInNamingMenu = false;
                    ___textBox.Selected   = false;
                }

                if (___textBox.Selected)
                {
                    ___textBox.Update();
                    toSpeak = ___textBox.Text;

                    if (isEscPressed)
                    {
                        ___textBox.Selected = false;
                    }
                }
                else
                {
                    if (__instance.textBoxCC != null && __instance.textBoxCC.containsPoint(x, y))
                    {
                        toSpeak = $"{___title} text box";
                    }
                    else if (__instance.doneNamingButton != null && __instance.doneNamingButton.containsPoint(x, y))
                    {
                        toSpeak = $"Done naming button";
                    }
                    else if (__instance.randomButton != null && __instance.randomButton.containsPoint(x, y))
                    {
                        toSpeak = $"Random button";
                    }
                }

                if (toSpeak != "")
                {
                    MainClass.ScreenReader.SayWithChecker(toSpeak, true);
                }
            }
            catch (Exception e)
            {
                MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
            }
        }