From 881e8ed83cdab324da72451617fb3bb2a9b64bac Mon Sep 17 00:00:00 2001 From: mend-dev Date: Mon, 30 Dec 2024 11:59:45 -0600 Subject: [PATCH] Fixes for v46 --- .gitignore | 1 + Game/RogueGame.cs | 2 ++ Gamemode/RogueGamemode.cs | 10 ++++--- .../Menu/StartGameMenus/RogueGameMenu.cs | 2 -- .../Menu/StartGameMenus/SelectGamemodeMenu.cs | 8 +++--- ModHelperData.cs | 4 +-- .../BossBloonManager_OnRoundStart.cs | 10 ------- .../BossBloonManager_SpawnBoss.cs | 14 ++++++++++ Patch/InGame/InGame_Initialise.cs | 17 ++++++++++++ Patch/InGame/InGame_StartMatch.cs | 19 +------------- Patch/InGame/InGame_Testing.cs | 22 ---------------- Patch/MainMenu/MainMenu_Open.cs | 26 +++++++++++++++++++ .../MenuManager_CloseMenuInternal.cs | 2 +- .../MenuManager/MenuManager_LoadSceneAsync.cs | 2 +- .../MenuManager_OpenMenuInternal.cs | 2 +- .../MenuManager_UnloadSceneAsync.cs | 7 +---- ...eMoabsAction_InstantiateReanimatedBloon.cs | 2 +- .../SpawnChildren_CreatedChildren.cs | 22 ++++++++++++++++ Patch/Spawner/Spawner_Emit.cs | 18 ------------- 19 files changed, 100 insertions(+), 90 deletions(-) create mode 100644 Patch/BossBloonManager/BossBloonManager_SpawnBoss.cs create mode 100644 Patch/InGame/InGame_Initialise.cs delete mode 100644 Patch/InGame/InGame_Testing.cs create mode 100644 Patch/SpawnChildren/SpawnChildren_CreatedChildren.cs diff --git a/.gitignore b/.gitignore index 37876ad..1435f0b 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ bld/ # Visual Studio 2015/2017 cache/options directory .vs/ +.vscode/ # Uncomment if you have tasks that create the project's static files in wwwroot #wwwroot/ diff --git a/Game/RogueGame.cs b/Game/RogueGame.cs index 15ae8c8..545f3a8 100644 --- a/Game/RogueGame.cs +++ b/Game/RogueGame.cs @@ -172,5 +172,7 @@ public void GameStarted(InGame game) { rerolls = 3; roundManager.GenerateRound(0, true); roundManager.GenerateBossBag(); + + gamemode.OnMatchStart(); } } diff --git a/Gamemode/RogueGamemode.cs b/Gamemode/RogueGamemode.cs index 0b11afd..ee9d14e 100644 --- a/Gamemode/RogueGamemode.cs +++ b/Gamemode/RogueGamemode.cs @@ -1,7 +1,5 @@ -using BTD_Mod_Helper.Api; -using BTD_Mod_Helper.Api.Enums; +using BTD_Mod_Helper.Api.Enums; using BTD_Mod_Helper.Api.Scenarios; -using BTD_Mod_Helper.Extensions; using Il2CppAssets.Scripts.Models; using Il2CppAssets.Scripts.Models.Difficulty; @@ -25,4 +23,10 @@ public override void ModifyGameModel(GameModel gameModel) { base.ModifyGameModel(gameModel); this.gameModel = gameModel; } + + public virtual void OnMatchStart() { } + + public virtual void OnRoundStart() { } + + public virtual void OnRoundEnd() { } } diff --git a/Interface/Menu/StartGameMenus/RogueGameMenu.cs b/Interface/Menu/StartGameMenus/RogueGameMenu.cs index 3cac81c..d117996 100644 --- a/Interface/Menu/StartGameMenus/RogueGameMenu.cs +++ b/Interface/Menu/StartGameMenus/RogueGameMenu.cs @@ -2,8 +2,6 @@ using BTD_Mod_Helper.Api.Components; using BTD_Mod_Helper.Api.Enums; using BTD_Mod_Helper.Extensions; -using Il2CppAssets.Scripts.Data; -using Il2CppAssets.Scripts.Unity.Map; using Il2CppAssets.Scripts.Unity.UI_New.ChallengeEditor; using System; using System.Collections.Generic; diff --git a/Interface/Menu/StartGameMenus/SelectGamemodeMenu.cs b/Interface/Menu/StartGameMenus/SelectGamemodeMenu.cs index f8fe49c..bfff675 100644 --- a/Interface/Menu/StartGameMenus/SelectGamemodeMenu.cs +++ b/Interface/Menu/StartGameMenus/SelectGamemodeMenu.cs @@ -7,9 +7,7 @@ using UnityEngine; using System; using Object = Il2CppSystem.Object; -using Il2CppAssets.Scripts.Data.Skins; using Il2CppAssets.Scripts.Unity.UI_New.Popups; -using Il2CppAssets.Scripts.Data.Boss; namespace BTD6Rogue; @@ -17,7 +15,7 @@ namespace BTD6Rogue; public class SelectGamemodeMenu : ModGameMenu { public override bool OnMenuOpened(Object data) { - + // Remove base ExtraSettingsScreen UI CommonForegroundHeader.SetText("Select Gamemode"); RectTransform panelTransform = GameMenu.gameObject.GetComponentInChildrenByName("Panel"); GameObject panel = panelTransform.gameObject; @@ -29,6 +27,8 @@ public override bool OnMenuOpened(Object data) { List gamemodes = GetContent(); + // Make a large image button for each of the RogueGamemodes + // TODO: Turn this into a horizontal scroll panel foreach (RogueGamemode gamemode in gamemodes) { ModHelperButton borderPanel = gamemodesPanel.AddButton(new Info("", InfoPreset.Flex), VanillaSprites.BrownInsertPanelDark, new Action(() => { @@ -50,11 +50,9 @@ public override bool OnMenuOpened(Object data) { ModHelperText gamemodeName = gamemodeImage.AddText(new Info("Name", InfoPreset.Flex) { FlexHeight = 1 }, gamemode.DisplayName, 128, Il2CppTMPro.TextAlignmentOptions.Top); - ModHelperText gamemodeDescription = gamemodeImage.AddText(new Info("Description", InfoPreset.Flex) { FlexHeight = 1 }, gamemode.Description, 72, Il2CppTMPro.TextAlignmentOptions.Bottom); } - return false; } } \ No newline at end of file diff --git a/ModHelperData.cs b/ModHelperData.cs index d85327f..1b0bd3e 100644 --- a/ModHelperData.cs +++ b/ModHelperData.cs @@ -1,8 +1,8 @@ namespace BTD6Rogue; public static class ModHelperData { - public const string WorksOnVersion = "45"; - public const string Version = "3.0.0"; + public const string WorksOnVersion = "46"; + public const string Version = "3.1.0"; public const string Name = "BTD6Rogue"; public const string Description = "Turn BTD6 into a Roguelike!" + diff --git a/Patch/BossBloonManager/BossBloonManager_OnRoundStart.cs b/Patch/BossBloonManager/BossBloonManager_OnRoundStart.cs index 4a2864e..0d2baee 100644 --- a/Patch/BossBloonManager/BossBloonManager_OnRoundStart.cs +++ b/Patch/BossBloonManager/BossBloonManager_OnRoundStart.cs @@ -12,13 +12,3 @@ private static bool Prefix(BossBloonManager __instance, int spawnedRound) { return false; } } - -[HarmonyPatch(typeof(BossBloonManager), nameof(BossBloonManager.SpawnBoss))] -internal static class BossBloonManager_SpawnBoss { - - [HarmonyPostfix] - private static bool Prefix(BossBloonManager __instance) { - return false; - } -} - diff --git a/Patch/BossBloonManager/BossBloonManager_SpawnBoss.cs b/Patch/BossBloonManager/BossBloonManager_SpawnBoss.cs new file mode 100644 index 0000000..168b72e --- /dev/null +++ b/Patch/BossBloonManager/BossBloonManager_SpawnBoss.cs @@ -0,0 +1,14 @@ +using HarmonyLib; +using Il2CppAssets.Scripts.Simulation.Track; + +namespace BTD6Rogue; + +[HarmonyPatch(typeof(BossBloonManager), nameof(BossBloonManager.SpawnBoss))] +internal static class BossBloonManager_SpawnBoss { + + [HarmonyPostfix] + private static bool Prefix(BossBloonManager __instance) { + return false; + } +} + diff --git a/Patch/InGame/InGame_Initialise.cs b/Patch/InGame/InGame_Initialise.cs new file mode 100644 index 0000000..c4edf23 --- /dev/null +++ b/Patch/InGame/InGame_Initialise.cs @@ -0,0 +1,17 @@ +using HarmonyLib; +using Il2CppAssets.Scripts.Unity.UI_New.InGame; +using Il2CppSystem; +using Il2CppSystem.Collections; + +namespace BTD6Rogue; + +[HarmonyPatch(typeof(InGame), nameof(InGame.Initialise))] +internal static class InGame_Initialise { + + [HarmonyPostfix] + private static void Postfix(InGame __instance) { + IEnumerator enumer = __instance.InstantiateUiObject(__instance.inGameMenuDefs[15]); + enumer.MoveNext(); + enumer.MoveNext(); + } +} diff --git a/Patch/InGame/InGame_StartMatch.cs b/Patch/InGame/InGame_StartMatch.cs index 40b6567..2e00249 100644 --- a/Patch/InGame/InGame_StartMatch.cs +++ b/Patch/InGame/InGame_StartMatch.cs @@ -1,15 +1,10 @@ -using BTD_Mod_Helper.Api.Helpers; -using BTD_Mod_Helper.Extensions; +using BTD_Mod_Helper.Extensions; using HarmonyLib; using Il2CppAssets.Scripts.Models.Profile; using Il2CppAssets.Scripts.Simulation.Track; -using Il2CppAssets.Scripts.Unity.UI_New; using Il2CppAssets.Scripts.Unity.UI_New.InGame; using Il2CppAssets.Scripts.Unity.UI_New.InGame.Races; using Il2CppNinjaKiwi.Common; -using Il2CppSystem; -using Il2CppSystem.Collections; -using MelonLoader; using UnityEngine; namespace BTD6Rogue; @@ -39,15 +34,3 @@ private static void Postfix(InGame __instance, MapSaveDataModel mapSaveData, boo } } } - - -[HarmonyPatch(typeof(InGame), nameof(InGame.Initialise))] -internal static class InGame_StartMatcah { - - [HarmonyPostfix] - private static void Postfix(InGame __instance) { - IEnumerator enumer = __instance.InstantiateUiObject(__instance.inGameMenuDefs[15]); - enumer.MoveNext(); - enumer.MoveNext(); - } -} diff --git a/Patch/InGame/InGame_Testing.cs b/Patch/InGame/InGame_Testing.cs deleted file mode 100644 index b42229c..0000000 --- a/Patch/InGame/InGame_Testing.cs +++ /dev/null @@ -1,22 +0,0 @@ -/*using HarmonyLib; -using Il2CppAssets.Scripts.Simulation.Track; -using Il2CppAssets.Scripts.Unity.Bridge; -using Il2CppAssets.Scripts.Unity.UI_New.InGame; - -namespace BTD6Rogue; - -[HarmonyPatch(typeof(UnityToSimulation), nameof(UnityToSimulation.MatchReady))] -internal static class InGame_StartMatcasdh { - - [HarmonyPostfix] - private static void Postfix(UnityToSimulation __instance) { - InGame game = InGame.instance; - BossBloonManager bbm = new BossBloonManager() { - spawnRounds = new int[] { 20, 40, 60, 80, 100, 120 }, - currentBossTier = 0, - }; - __instance.simulation.map.spawner.bossBloonManager = bbm; - //bbm.Init(__instance.simulation); - } -} -*/ \ No newline at end of file diff --git a/Patch/MainMenu/MainMenu_Open.cs b/Patch/MainMenu/MainMenu_Open.cs index 34e4c04..ba9475a 100644 --- a/Patch/MainMenu/MainMenu_Open.cs +++ b/Patch/MainMenu/MainMenu_Open.cs @@ -8,6 +8,13 @@ using BTD_Mod_Helper.Api; using UnityEngine.UI; using Il2CppNinjaKiwi.Common.ResourceUtils; +using Il2CppAssets.Scripts.Unity.UI_New; +using Il2CppAssets.Scripts.Data.Quests; +using Il2CppAssets.Scripts.Unity; +using Il2CppAssets.Scripts.Data.Quests.UI; +using System.Linq; +using System.Collections.Generic; +using Il2CppNinjaKiwi.Common; namespace BTD6Rogue; @@ -26,5 +33,24 @@ private static void Postfix(MainMenu __instance) { rogueButton.GetComponentInChildrenByName("Button").SetSprite(sprite.ToString()); rogueButton.GetComponentInChildren().localizeKey = $"Rogue"; rogueButton.GetComponentInChildren