diff --git a/BloonsTD6 Mod Helper/Api/Helpers/FileDialogHelper.cs b/BloonsTD6 Mod Helper/Api/Helpers/FileDialogHelper.cs index 6d72788f4..3140ceb23 100644 --- a/BloonsTD6 Mod Helper/Api/Helpers/FileDialogHelper.cs +++ b/BloonsTD6 Mod Helper/Api/Helpers/FileDialogHelper.cs @@ -7,7 +7,7 @@ namespace BTD_Mod_Helper.Api.Helpers; /// public static class FileDialogHelper { - private static readonly string[] Dlls = {"nfd.dll", "nfd_x86.dll"}; + private static readonly string[] Dlls = ["nfd.dll", "nfd_x86.dll"]; /// /// Ensure that the NFD native dlls are present in the game root folder diff --git a/BloonsTD6 Mod Helper/LATEST.md b/BloonsTD6 Mod Helper/LATEST.md index 984a4e51a..5e73e6799 100644 --- a/BloonsTD6 Mod Helper/LATEST.md +++ b/BloonsTD6 Mod Helper/LATEST.md @@ -1,59 +1,7 @@ -## Misc Updates - -- Added a button that lets you open the Mods Menu from the In Game Pause Screen - - This includes opening Mod Settings menus, but not many settings yet will probably live update in a game -- Added a button in the Mods Menu that can display the SHA 256 hashes of active mods -- Added a new `ModTower.IncludeInMonkeyTeams` override -- Fixed some inconsistencies where some simulation behavior extensions would throw exceptions instead of just returning null -- ModHelperData now supports multiline raw strings for descriptions, [example](https://github.com/doombubbles/ability-choice/blob/699658591855043372a128294de679670600e3c1/ModHelperData.cs#L10) - -## Localization Updates - -### General - -- Added a new button in the Mods Menu to export a mod's localization to a json file, which can be edited to change its - supported displayed text for your language - - This goes to a newly added subfolder `Mods/BloonsTD6 Mod Helper/Localization/[Language]` - - Edits to files here should refresh the text without requiring a game restart -- Added a new [Translation Tool page on the website](https://gurrenm3.github.io/BTD-Mod-Helper/tools/translate) that can - easily put Localization files through Google translate for individual or all supported languages - - Using this tool, Mod Helper now contains Localizations for all supported BTD6 language. If you see a way that - one/many of the Google Translations could be improved for your language, you can help out by submitting edits to - the [corresponding Language file](https://github.com/gurrenm3/BTD-Mod-Helper/tree/master/BloonsTD6%20Mod%20Helper/Localization) through GitHub -- The text in mods that should be automatically supported for localization editing includes - - Names and Descriptions for Towers, Upgrades, Heroes, Bloons etc - - Names and Descriptions for Mod Settings - - General mod info like the description - -### For Modders - -- The standard btd6.targets import will now automatically embed `/Localization/[Language].json` files in your mod - project - - Use the Localization Button on your own mod with active language English to get a starter .json for your mod - - If you paste in the .json content on the website and press the "Translate All" button it will create a .zip file - with all the correctly named .json files you'd need for your mod -- ModHelperText and ModHelperDropdown components now Localize their texts by default -- For Localization Entries, putting text within [Square Brackets] will make it try to fetch existing localization for - that key - - e.g. `The description is [DartMonkey Description]` -> - `The description is Throws a single dart at nearby Bloons. Short range and low pierce but cheap.` -- Added new `ModContent.Localize` methods that can add new mod specific localizations from variables - ```csharp - private static readonly string DoTheThing = ModContent.Localize(nameof(DoTheThing), "Do The Thing!"); - ``` - Or within any method/constructor that's going to run as the game loads - ```csharp - var doTheThing = ModContent.Localize(nameof(DoTheThing), "Do The Thing!"); - ``` - The result assigned to the `DoTheThing` is your mod specific localization key, that you can use in a - `ModHelperText.SetText(DoTheThing)` directly or as `string localizedText = DoTheThing.Localize()` otherwise -- As before, you can still override the `RegisterText` method in any class that extends `NamedModContent` to - directly add extra stuff to the text table - ```csharp - public override void RegisterText(Il2CppSystem.Collections.Generic.Dictionary textTable) - { - base.RegisterText(textTable); // Call the base to still register DisplayName / Description - - textTable[Id + " Long Description"] = LongDescription; // More specific stuff to your ModContent - } - ``` +- Pause Screen Mods Button now shows number of active mods +- Updated icon for Pause Screen mods button +- Made it less likely for other mods to have errors if they tried to use file/folder picker popups outside standard mod settings +- Apopalypse Mode is now correctly affected by the Round Set changer +- Made the Round Changer button also show up in the Challenge Editor Play screen + - Note: The Round Set Changer would always technically apply to challenges, this is just making it clearer and easier + to change without going back to the normal map play screens \ No newline at end of file diff --git a/BloonsTD6 Mod Helper/MelonMain.cs b/BloonsTD6 Mod Helper/MelonMain.cs index 9cd602f0b..d7842638c 100644 --- a/BloonsTD6 Mod Helper/MelonMain.cs +++ b/BloonsTD6 Mod Helper/MelonMain.cs @@ -88,6 +88,15 @@ public override void OnInitialize() loadErrors.Add("MelonLoader versions higher than 0.6.1 are not yet considered stable for BloonsTD6. " + "Please downgrade to MelonLoader 0.6.1 via its installer for best results."); } + + try + { + FileDialogHelper.PrepareNativeDlls(); + } + catch (Exception e) + { + ModHelper.Warning(e); + } } public override void OnUpdate() diff --git a/BloonsTD6 Mod Helper/ModHelper.cs b/BloonsTD6 Mod Helper/ModHelper.cs index 731276d99..613ef553f 100644 --- a/BloonsTD6 Mod Helper/ModHelper.cs +++ b/BloonsTD6 Mod Helper/ModHelper.cs @@ -16,7 +16,7 @@ namespace BTD_Mod_Helper; public static class ModHelper { internal const string Name = "BloonsTD6 Mod Helper"; - internal const string Version = "3.2.0"; + internal const string Version = "3.2.1"; internal const string RepoOwner = "gurrenm3"; internal const string RepoName = "BTD-Mod-Helper"; internal const string Description = diff --git a/BloonsTD6 Mod Helper/Patches/UI/PauseScreen_Open.cs b/BloonsTD6 Mod Helper/Patches/UI/PauseScreen_Open.cs index 4ea9e17e9..348b1ad83 100644 --- a/BloonsTD6 Mod Helper/Patches/UI/PauseScreen_Open.cs +++ b/BloonsTD6 Mod Helper/Patches/UI/PauseScreen_Open.cs @@ -1,4 +1,5 @@ -using BTD_Mod_Helper.Api; +using System.Linq; +using BTD_Mod_Helper.Api; using BTD_Mod_Helper.UI.Menus; using BTD_Mod_Helper.UI.Modded; using Il2CppAssets.Scripts.Unity.UI_New.Pause; @@ -68,7 +69,7 @@ private static void Postfix(PauseScreen __instance) image.SetSprite(sprite); var modsText = modsBtn.GetComponentInChildren(); - modsText.localizeKey = ModsButton.Mods; + modsText.localizeKey = $"[{ModsButton.Mods}] ({ModHelper.Melons.Count()})"; modsText.SetText(ModsButton.Mods.Localize()); } diff --git a/BloonsTD6 Mod Helper/Patches/UI/UI_ApplyExtraNotInSimModelSettings.cs b/BloonsTD6 Mod Helper/Patches/UI/UI_ApplyExtraNotInSimModelSettings.cs new file mode 100644 index 000000000..982815824 --- /dev/null +++ b/BloonsTD6 Mod Helper/Patches/UI/UI_ApplyExtraNotInSimModelSettings.cs @@ -0,0 +1,20 @@ +using BTD_Mod_Helper.UI.Modded; +using Il2CppAssets.Scripts.Models; +using Il2CppAssets.Scripts.Simulation.Track.RoundManagers; +using Il2CppAssets.Scripts.Unity.Bridge; + +namespace BTD_Mod_Helper.Patches.UI; + +[HarmonyPatch(typeof(Il2CppAssets.Scripts.Unity.UI_New.UI), nameof(Il2CppAssets.Scripts.Unity.UI_New.UI.ApplyExtraNotInSimModelSettings))] +internal static class UI_ApplyExtraNotInSimModelSettings +{ + [HarmonyPostfix] + internal static void Postfix(UnityToSimulation uts, GameModel model) + { + if (!string.IsNullOrEmpty(RoundSetChanger.RoundSetOverride) && model.isApopalypse) + { + var roundManager = new DefaultRoundManager(model); + uts.InitRoundSet(roundManager); + } + } +} \ No newline at end of file diff --git a/BloonsTD6 Mod Helper/Resources/IconMinimal.png b/BloonsTD6 Mod Helper/Resources/IconMinimal.png index b07005932..9fb12a01d 100644 Binary files a/BloonsTD6 Mod Helper/Resources/IconMinimal.png and b/BloonsTD6 Mod Helper/Resources/IconMinimal.png differ diff --git a/BloonsTD6 Mod Helper/UI/Modded/RoundSetChanger.cs b/BloonsTD6 Mod Helper/UI/Modded/RoundSetChanger.cs index 35d193dc2..ea9082bdd 100644 --- a/BloonsTD6 Mod Helper/UI/Modded/RoundSetChanger.cs +++ b/BloonsTD6 Mod Helper/UI/Modded/RoundSetChanger.cs @@ -5,12 +5,14 @@ using BTD_Mod_Helper.Api.Bloons; using BTD_Mod_Helper.Api.Components; using BTD_Mod_Helper.Api.Enums; +using Il2CppAssets.Scripts; using Il2CppAssets.Scripts.Unity.Menu; using Il2CppAssets.Scripts.Unity.UI_New; using Il2CppAssets.Scripts.Unity.UI_New.InGame; using Il2CppAssets.Scripts.Unity.UI_New.Main.Facebook; using Il2CppAssets.Scripts.Unity.UI_New.Main.MapSelect; using UnityEngine; +using UnityEngine.SceneManagement; using UnityEngine.UI; namespace BTD_Mod_Helper.UI.Modded; @@ -25,8 +27,9 @@ public static class RoundSetChanger // TODO make this internal, add alt way to g private static readonly string[] ShowOnMenus = { - "DifficultySelectUI", "ModeSelectUI", - "DifficultySelectScreen", "ModeSelectScreen" + SceneNames.DifficultySelectUI, + SceneNames.ModeSelectUI, + SceneNames.ChallengeEditorPlay }; private static ModHelperPanel buttonPanel; diff --git a/Documentation/BTD_Mod_Helper.BloonsMod.md b/Documentation/BTD_Mod_Helper.BloonsMod.md index 366092717..b13035310 100644 --- a/Documentation/BTD_Mod_Helper.BloonsMod.md +++ b/Documentation/BTD_Mod_Helper.BloonsMod.md @@ -251,4 +251,14 @@ public virtual void OnSaveSettings(JObject settings); `settings` [Newtonsoft.Json.Linq.JObject](https://docs.microsoft.com/en-us/dotnet/api/Newtonsoft.Json.Linq.JObject 'Newtonsoft.Json.Linq.JObject') -The json representation of the settings about to be saved \ No newline at end of file +The json representation of the settings about to be saved + + + +## BloonsMod.SaveModSettings() Method + +Saves the current mod settings for this mod + +```csharp +public void SaveModSettings(); +``` \ No newline at end of file