master
Mohammad Shoaib Khan 2023-02-22 16:55:54 +05:30
parent ecb256ad57
commit 31f3144bfd
No known key found for this signature in database
GPG Key ID: D8040D966320B620
2 changed files with 9 additions and 31 deletions

View File

@ -48,7 +48,7 @@ namespace stardew_access
harmony.Patch( harmony.Patch(
original: AccessTools.Method(typeof(CharacterCustomization), nameof(CharacterCustomization.draw), new Type[] { typeof(SpriteBatch) }), 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( harmony.Patch(

View File

@ -13,7 +13,8 @@ namespace stardew_access
public class MainClass : Mod public class MainClass : Mod
{ {
#region Global Vars & Properties #region Global Vars & Properties
#pragma warning disable CS8603
#pragma warning disable CS8603
private static int prevDate = -99; private static int prevDate = -99;
private static ModConfig? config; private static ModConfig? config;
private Harmony? harmony; private Harmony? harmony;
@ -101,7 +102,6 @@ namespace stardew_access
return warnings; return warnings;
} }
} }
#pragma warning restore CS8603
#endregion #endregion
/********* /*********
@ -212,54 +212,32 @@ namespace stardew_access
return; return;
#region Simulate left and right clicks #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); bool isCustomizingCharacter = Game1.activeClickableMenu is CharacterCustomization || (TitleMenu.subMenu != null && TitleMenu.subMenu is CharacterCustomization);
#region Mouse Click Simulation #region Mouse Click Simulation
// Main Keybinds if (Config.LeftClickMainKey.JustPressed() || Config.LeftClickAlternateKey.JustPressed())
if (!isAnyTextBoxActive && Config.LeftClickMainKey.JustPressed())
{ {
Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true)); 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 (Config.RightClickMainKey.JustPressed() || Config.RightClickAlternateKey.JustPressed())
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
{ {
Game1.activeClickableMenu.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true)); Game1.activeClickableMenu.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true));
} }
#endregion #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 #region Mouse Click Simulation
// Main Keybinds if (Config.LeftClickMainKey.JustPressed() || Config.LeftClickAlternateKey.JustPressed())
if (Config.LeftClickMainKey.JustPressed())
{ {
Game1.currentMinigame.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true)); 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.RightClickMainKey.JustPressed() || Config.RightClickAlternateKey.JustPressed())
if (Config.LeftClickAlternateKey.JustPressed())
{
Game1.currentMinigame.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true));
}
if (Config.RightClickAlternateKey.JustPressed())
{ {
Game1.currentMinigame.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true)); Game1.currentMinigame.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true));
} }