From 31f3144bfded7a37bbce6369a06a40e3aa7a08c2 Mon Sep 17 00:00:00 2001 From: Mohammad Shoaib Khan Date: Wed, 22 Feb 2023 16:55:54 +0530 Subject: [PATCH] Bug fix --- stardew-access/HarmonyPatches.cs | 2 +- stardew-access/ModEntry.cs | 38 +++++++------------------------- 2 files changed, 9 insertions(+), 31 deletions(-) diff --git a/stardew-access/HarmonyPatches.cs b/stardew-access/HarmonyPatches.cs index 692ce38..2a76ff6 100644 --- a/stardew-access/HarmonyPatches.cs +++ b/stardew-access/HarmonyPatches.cs @@ -48,7 +48,7 @@ namespace stardew_access harmony.Patch( original: AccessTools.Method(typeof(CharacterCustomization), nameof(CharacterCustomization.draw), new Type[] { typeof(SpriteBatch) }), - postfix: new HarmonyMethod(typeof(TitleMenuPatches), nameof(CharacterCustomizationPatches.CharacterCustomizationMenuPatch)) + postfix: new HarmonyMethod(typeof(CharacterCustomizationPatches), nameof(CharacterCustomizationPatches.CharacterCustomizationMenuPatch)) ); harmony.Patch( diff --git a/stardew-access/ModEntry.cs b/stardew-access/ModEntry.cs index 03364ed..658db41 100644 --- a/stardew-access/ModEntry.cs +++ b/stardew-access/ModEntry.cs @@ -13,7 +13,8 @@ namespace stardew_access public class MainClass : Mod { #region Global Vars & Properties -#pragma warning disable CS8603 + + #pragma warning disable CS8603 private static int prevDate = -99; private static ModConfig? config; private Harmony? harmony; @@ -101,7 +102,6 @@ namespace stardew_access return warnings; } } -#pragma warning restore CS8603 #endregion /********* @@ -212,54 +212,32 @@ namespace stardew_access return; #region Simulate left and right clicks - if (Game1.activeClickableMenu != null) + if (Game1.activeClickableMenu != null && !isAnyTextBoxActive) { bool isCustomizingCharacter = Game1.activeClickableMenu is CharacterCustomization || (TitleMenu.subMenu != null && TitleMenu.subMenu is CharacterCustomization); #region Mouse Click Simulation - // Main Keybinds - if (!isAnyTextBoxActive && Config.LeftClickMainKey.JustPressed()) + if (Config.LeftClickMainKey.JustPressed() || Config.LeftClickAlternateKey.JustPressed()) { Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true)); } - if (!isAnyTextBoxActive && Config.RightClickMainKey.JustPressed()) - { - Game1.activeClickableMenu.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true)); - } - // Alternate Keybinds - if (!isAnyTextBoxActive && Config.LeftClickAlternateKey.JustPressed()) // Excluding the character creation menu - { - Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true)); - } - if (!isAnyTextBoxActive && Config.RightClickAlternateKey.JustPressed()) // Excluding the character creation menu + if (Config.RightClickMainKey.JustPressed() || Config.RightClickAlternateKey.JustPressed()) { Game1.activeClickableMenu.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true)); } #endregion } - if (Game1.currentMinigame != null) + if (Game1.currentMinigame != null && !isAnyTextBoxActive) { - bool isCustomizingCharacter = Game1.activeClickableMenu is CharacterCustomization || (TitleMenu.subMenu != null && TitleMenu.subMenu is CharacterCustomization); - #region Mouse Click Simulation - // Main Keybinds - if (Config.LeftClickMainKey.JustPressed()) + if (Config.LeftClickMainKey.JustPressed() || Config.LeftClickAlternateKey.JustPressed()) { Game1.currentMinigame.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true)); } - if (Config.RightClickMainKey.JustPressed()) - { - Game1.currentMinigame.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true)); - } - // Alternate Keybinds - if (Config.LeftClickAlternateKey.JustPressed()) - { - Game1.currentMinigame.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true)); - } - if (Config.RightClickAlternateKey.JustPressed()) + if (Config.RightClickMainKey.JustPressed() || Config.RightClickAlternateKey.JustPressed()) { Game1.currentMinigame.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true)); }