/***
         * Event Listeners
         ***/

        /// <summary>
        /// Window resized event listener. Re-creates the menu to make it fit in the new window.
        /// </summary>
        /// <param name="sender">Event sender</param>
        /// <param name="e">Event arguments</param>
        private void WindowResized(object sender, EventArgs e)
        {
            if (Game1.activeClickableMenu is GeodeMenu)
            {
                this.menuStateInfo = (Game1.activeClickableMenu as GeodeMenu).SaveState();
                GeodeMenu menu = new GeodeMenu(this, this.config, GetNextDropsForGeodes(this.config.NumberOfNextGeodeDropsToShow), this.menuStateInfo, true);
                Game1.activeClickableMenu = menu;
            }
        }
Beispiel #2
0
        /// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnButtonPressed(object sender, ButtonPressedEventArgs e)
        {
            // open the menu if activation key pressed
            bool canOpen = Game1.activeClickableMenu == null || Game1.activeClickableMenu is StardewValley.Menus.GeodeMenu;

            if (Game1.activeClickableMenu is StardewValley.Menus.GeodeMenu)
            {
                this.GeodeBreakingMenu = Game1.activeClickableMenu;
            }
            if (e.Button == this.config.ActivationKey && canOpen)
            {
                GeodeMenu menu = new GeodeMenu(this, this.config, this.GetNextDropsForGeodes(this.config.NumberOfNextGeodeDropsToShow), this.config.RememberMenuStateAfterClose ? this.menuStateInfo : null);
                Game1.activeClickableMenu = menu;
                menu.SetSearchTabSearchBoxSelectedStatus(true);
            }
        }
        /// <summary>
        /// Key pressed event listener. Listens for the activation key and opens the menu.
        /// </summary>
        /// <param name="sender">Event sender</param>
        /// <param name="e">Event arguments</param>
        private void KeyPressed(object sender, EventArgsKeyPressed e)
        {
            bool canOpen = Game1.activeClickableMenu == null || Game1.activeClickableMenu is StardewValley.Menus.GeodeMenu;

            if (Game1.activeClickableMenu is StardewValley.Menus.GeodeMenu)
            {
                this.GeodeBreakingMenu = Game1.activeClickableMenu;
            }

            if (e.KeyPressed.ToString().ToLower() == this.config.ActivationKey.ToLower() && canOpen)
            {
                GeodeMenu menu = new GeodeMenu(this, this.config, GetNextDropsForGeodes(this.config.NumberOfNextGeodeDropsToShow), this.config.RememberMenuStateAfterClose ? this.menuStateInfo : null);
                Game1.activeClickableMenu = menu;
                menu.SetSearchTabSearchBoxSelectedStatus(true);
            }
        }