From 4206b74d1206e323ba180a5102e05694169dd776 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Wed, 26 Aug 2026 00:24:02 -0500 Subject: [PATCH] Fix localization being applied --- .../Buttons/Freezer/FreezeButton.cs | 2 +- MiraAPI.Example/Buttons/MeetingButton.cs | 2 +- .../Buttons/NeutralKillerButton.cs | 2 +- .../Buttons/Teleporter/TeleportButton.cs | 2 +- MiraAPI.Example/Buttons/ThinkButton.cs | 4 +- MiraAPI.Example/ExampleLocalSetings.cs | 2 +- MiraAPI.Example/Modifiers/CaptainModifier.cs | 2 +- .../Modifiers/Freezer/FreezeModifier.cs | 2 +- .../Modifiers/HighPriorityModifier.cs | 2 +- MiraAPI.Example/Options/ExampleOptions.cs | 2 +- MiraAPI.Example/Options/ExampleOptions2.cs | 2 +- .../Modifiers/CaptainModifierSettings.cs | 2 +- .../Modifiers/FreezeModifierSettings.cs | 2 +- .../Modifiers/GeneralModifierOptions.cs | 2 +- .../Options/Roles/FreezerRoleSettings.cs | 6 +- .../Options/Roles/TeleporterOptions.cs | 8 +- MiraAPI.Example/Resources/Locale/en_US.xml | 139 ++++++++++-------- MiraAPI.Example/Resources/Locale/zh_CN.xml | 60 ++++---- MiraAPI.Example/Roles/NeutralKillerRole.cs | 2 +- MiraAPI/GameModes/AbstractGameMode.cs | 6 +- MiraAPI/GameModes/GameModeOption.cs | 4 +- MiraAPI/MiraApiSettings.cs | 40 ++--- MiraAPI/Patches/GameModes/HudPatches.cs | 3 +- .../Patches/Options/LobbyViewPanePatches.cs | 2 +- MiraAPI/Resources/Locale/en_US.xml | 4 +- MiraAPI/Resources/Locale/zh_CN.xml | 4 +- 26 files changed, 163 insertions(+), 145 deletions(-) diff --git a/MiraAPI.Example/Buttons/Freezer/FreezeButton.cs b/MiraAPI.Example/Buttons/Freezer/FreezeButton.cs index 8d02a29..34fce19 100644 --- a/MiraAPI.Example/Buttons/Freezer/FreezeButton.cs +++ b/MiraAPI.Example/Buttons/Freezer/FreezeButton.cs @@ -13,7 +13,7 @@ namespace MiraAPI.Example.Buttons.Freezer; public class FreezeButton : CustomActionButton { - public override string Name => "button.freeze.name"; + public override string Name => "button.freeze"; public override float Cooldown => OptionGroupSingleton.Instance.FreezeDuration; public override bool PauseTimerInVent => true; diff --git a/MiraAPI.Example/Buttons/MeetingButton.cs b/MiraAPI.Example/Buttons/MeetingButton.cs index 9949ae2..d43bda6 100644 --- a/MiraAPI.Example/Buttons/MeetingButton.cs +++ b/MiraAPI.Example/Buttons/MeetingButton.cs @@ -9,7 +9,7 @@ namespace MiraAPI.Example.Buttons; public class MeetingButton : CustomActionButton { - public override string Name => "button.callMeeting.name"; + public override string Name => "button.callMeeting"; public override float Cooldown => 15; diff --git a/MiraAPI.Example/Buttons/NeutralKillerButton.cs b/MiraAPI.Example/Buttons/NeutralKillerButton.cs index 0d40183..3771c58 100644 --- a/MiraAPI.Example/Buttons/NeutralKillerButton.cs +++ b/MiraAPI.Example/Buttons/NeutralKillerButton.cs @@ -10,7 +10,7 @@ namespace MiraAPI.Example.Buttons; public class NeutralKillerButton : CustomActionButton { - public override string Name => "button.winGame.name"; + public override string Name => "button.winGame"; public override float Cooldown => 0f; public override LoadableAsset Sprite => ExampleAssets.ExampleButton; public override MiraKeybind Keybind => ExampleKeybinds.NeutralWinKeybind; diff --git a/MiraAPI.Example/Buttons/Teleporter/TeleportButton.cs b/MiraAPI.Example/Buttons/Teleporter/TeleportButton.cs index 681a7dc..8dead81 100644 --- a/MiraAPI.Example/Buttons/Teleporter/TeleportButton.cs +++ b/MiraAPI.Example/Buttons/Teleporter/TeleportButton.cs @@ -12,7 +12,7 @@ namespace MiraAPI.Example.Buttons.Teleporter; public class TeleportButton : CustomActionButton { - public override string Name => "button.teleport.name"; + public override string Name => "button.teleport"; public override float Cooldown => OptionGroupSingleton.Instance.TeleportCooldown.Value; diff --git a/MiraAPI.Example/Buttons/ThinkButton.cs b/MiraAPI.Example/Buttons/ThinkButton.cs index 8cc0c63..71013e9 100644 --- a/MiraAPI.Example/Buttons/ThinkButton.cs +++ b/MiraAPI.Example/Buttons/ThinkButton.cs @@ -7,7 +7,7 @@ namespace MiraAPI.Example.Buttons; public class ThinkButton : CustomActionButton { - public override string Name => "button.think.name"; + public override string Name => "button.think"; public override float Cooldown => 15f; public override float EffectDuration => 10f; public override int MaxUses => 1; @@ -20,7 +20,7 @@ public class ThinkButton : CustomActionButton public override void OnEffectEnd() { - Button!.OverrideText("button.think.name".Translate()); + Button!.OverrideText("button.think".Translate()); } public override bool IsEffectCancellable() diff --git a/MiraAPI.Example/ExampleLocalSetings.cs b/MiraAPI.Example/ExampleLocalSetings.cs index 5825914..319e2cf 100644 --- a/MiraAPI.Example/ExampleLocalSetings.cs +++ b/MiraAPI.Example/ExampleLocalSetings.cs @@ -8,7 +8,7 @@ namespace MiraAPI.Example; public class ExampleLocalSettings(ConfigFile config) : LocalSettingsTab(config) { - public override string TabName => "settings.miraExample.name"; + public override string TabName => "settings.miraExample"; protected override bool ShouldCreateLabels => false; public override LocalSettingTabAppearance TabAppearance => new() diff --git a/MiraAPI.Example/Modifiers/CaptainModifier.cs b/MiraAPI.Example/Modifiers/CaptainModifier.cs index 4cf16b5..20e3872 100644 --- a/MiraAPI.Example/Modifiers/CaptainModifier.cs +++ b/MiraAPI.Example/Modifiers/CaptainModifier.cs @@ -10,7 +10,7 @@ namespace MiraAPI.Example.Modifiers; public class CaptainModifier : GameModifier { - public override string ModifierName => "modifier.captain.name"; + public override string ModifierName => "modifier.captain"; public override LoadableAsset? ModifierIcon => ExampleAssets.CallMeetingButton; public override void OnDeath(DeathReason reason) diff --git a/MiraAPI.Example/Modifiers/Freezer/FreezeModifier.cs b/MiraAPI.Example/Modifiers/Freezer/FreezeModifier.cs index 678707f..8cc961b 100644 --- a/MiraAPI.Example/Modifiers/Freezer/FreezeModifier.cs +++ b/MiraAPI.Example/Modifiers/Freezer/FreezeModifier.cs @@ -7,7 +7,7 @@ namespace MiraAPI.Example.Modifiers.Freezer; public class FreezeModifier : TimedModifier { - public override string ModifierName => "modifier.freezed.name"; + public override string ModifierName => "modifier.freezed"; public override bool HideOnUi => false; public override float Duration => 15f; public override bool AutoStart => true; diff --git a/MiraAPI.Example/Modifiers/HighPriorityModifier.cs b/MiraAPI.Example/Modifiers/HighPriorityModifier.cs index 3d7c444..a637df5 100644 --- a/MiraAPI.Example/Modifiers/HighPriorityModifier.cs +++ b/MiraAPI.Example/Modifiers/HighPriorityModifier.cs @@ -4,7 +4,7 @@ namespace MiraAPI.Example.Modifiers; public class HighPriorityModifier : GameModifier { - public override string ModifierName => "modifier.highPriority.name"; + public override string ModifierName => "modifier.highPriority"; public override string GetDescription() { diff --git a/MiraAPI.Example/Options/ExampleOptions.cs b/MiraAPI.Example/Options/ExampleOptions.cs index 055bdb3..aff6ccf 100644 --- a/MiraAPI.Example/Options/ExampleOptions.cs +++ b/MiraAPI.Example/Options/ExampleOptions.cs @@ -7,7 +7,7 @@ namespace MiraAPI.Example.Options; public class ExampleOptions : AbstractOptionGroup { - public override string GroupName => "options.exampleOptions1.name"; + public override string GroupName => "options.exampleOptions1"; public override Color GroupColor => Color.green; [ModdedToggleOption("options.exampleOptions1.toggleOpt1")] diff --git a/MiraAPI.Example/Options/ExampleOptions2.cs b/MiraAPI.Example/Options/ExampleOptions2.cs index 92f0c15..6acba04 100644 --- a/MiraAPI.Example/Options/ExampleOptions2.cs +++ b/MiraAPI.Example/Options/ExampleOptions2.cs @@ -6,7 +6,7 @@ namespace MiraAPI.Example.Options; public class ExampleOptions2 : AbstractOptionGroup { - public override string GroupName => "options.exampleOptions2.name"; + public override string GroupName => "options.exampleOptions2"; public override uint GroupPriority => 0; // This group will be displayed first. The default value is uint.MaxValue. diff --git a/MiraAPI.Example/Options/Modifiers/CaptainModifierSettings.cs b/MiraAPI.Example/Options/Modifiers/CaptainModifierSettings.cs index 73ef735..e850385 100644 --- a/MiraAPI.Example/Options/Modifiers/CaptainModifierSettings.cs +++ b/MiraAPI.Example/Options/Modifiers/CaptainModifierSettings.cs @@ -6,7 +6,7 @@ namespace MiraAPI.Example.Options.Modifiers; public class CaptainModifierSettings : AbstractOptionGroup { - public override string GroupName => "options.captainSettings.name"; + public override string GroupName => "options.captainSettings"; [ModdedNumberOption("options.captainSettings.amount", 0, 5)] public float Amount { get; set; } = 1; diff --git a/MiraAPI.Example/Options/Modifiers/FreezeModifierSettings.cs b/MiraAPI.Example/Options/Modifiers/FreezeModifierSettings.cs index 8cd0117..f6296ba 100644 --- a/MiraAPI.Example/Options/Modifiers/FreezeModifierSettings.cs +++ b/MiraAPI.Example/Options/Modifiers/FreezeModifierSettings.cs @@ -6,7 +6,7 @@ namespace MiraAPI.Example.Options.Modifiers; public class FreezeModifierSettings : AbstractOptionGroup { - public override string GroupName => "options.freezeModifierSettings.name"; + public override string GroupName => "options.freezeModifierSettings"; [ModdedToggleOption("options.freezeModifierSettings.useColor")] public bool UseColor { get; set; } = true; diff --git a/MiraAPI.Example/Options/Modifiers/GeneralModifierOptions.cs b/MiraAPI.Example/Options/Modifiers/GeneralModifierOptions.cs index 6744d5d..8d0f82d 100644 --- a/MiraAPI.Example/Options/Modifiers/GeneralModifierOptions.cs +++ b/MiraAPI.Example/Options/Modifiers/GeneralModifierOptions.cs @@ -5,7 +5,7 @@ namespace MiraAPI.Example.Options.Modifiers; public class GeneralModifierOptions : AbstractOptionGroup { - public override string GroupName => "options.generalModifier.name"; + public override string GroupName => "options.generalModifier"; public override uint GroupPriority => 0; diff --git a/MiraAPI.Example/Options/Roles/FreezerRoleSettings.cs b/MiraAPI.Example/Options/Roles/FreezerRoleSettings.cs index f42edf5..b87b84e 100644 --- a/MiraAPI.Example/Options/Roles/FreezerRoleSettings.cs +++ b/MiraAPI.Example/Options/Roles/FreezerRoleSettings.cs @@ -13,11 +13,11 @@ public class FreezerRoleSettings : AbstractOptionGroup TmpSpriteUtils.CreateSpriteAsset( MiraAssets.ImpostorFile.LoadAsset(), "ApiExample.Role.Impostor.FreezerRole")); - public override string GroupName => "options.freezerRoleSettings.name"; + public override string GroupName => "ApiExample.Role.Freezer"; - [ModdedNumberOption("options.freezerRoleSettings.freezeDuration", 1, 15, 1, MiraNumberSuffixes.Seconds)] + [ModdedNumberOption("ApiExample.Role.Freezer.Settings.FreezeDuration", 1, 15, 1, MiraNumberSuffixes.Seconds)] public float FreezeDuration { get; set; } = 5; - [ModdedNumberOption("options.freezerRoleSettings.freezeUses", 1, 5)] + [ModdedNumberOption("ApiExample.Role.Freezer.Settings.FreezeUses", 1, 5)] public float FreezeUses { get; set; } = 1; } diff --git a/MiraAPI.Example/Options/Roles/TeleporterOptions.cs b/MiraAPI.Example/Options/Roles/TeleporterOptions.cs index 2f8450e..4a4f694 100644 --- a/MiraAPI.Example/Options/Roles/TeleporterOptions.cs +++ b/MiraAPI.Example/Options/Roles/TeleporterOptions.cs @@ -8,13 +8,13 @@ namespace MiraAPI.Example.Options.Roles; public class TeleporterOptions : AbstractRoleOptionGroup { - public override string GroupName => "options.teleporterOptions.name"; + public override string GroupName => "ApiExample.Role.Teleporter"; - public ModdedNumberOption TeleportCooldown { get; set; } = new("options.teleporterOptions.teleportCooldown", 10, 5, 60, 2.5f, MiraNumberSuffixes.Seconds); + public ModdedNumberOption TeleportCooldown { get; set; } = new("ApiExample.Role.Teleporter.Settings.TeleportCooldown", 10, 5, 60, 2.5f, MiraNumberSuffixes.Seconds); - [ModdedNumberOption("options.teleporterOptions.teleportDuration", 5, 25, 1, MiraNumberSuffixes.Seconds)] + [ModdedNumberOption("ApiExample.Role.Teleporter.Settings.TeleportDuration", 5, 25, 1, MiraNumberSuffixes.Seconds)] public float TeleportDuration { get; set; } = 10; - [ModdedNumberOption("options.teleporterOptions.zoomDistance", 4, 15)] + [ModdedNumberOption("ApiExample.Role.Teleporter.Settings.ZoomDistance", 4, 15)] public float ZoomDistance { get; set; } = 6; } diff --git a/MiraAPI.Example/Resources/Locale/en_US.xml b/MiraAPI.Example/Resources/Locale/en_US.xml index 4039ad9..5951728 100644 --- a/MiraAPI.Example/Resources/Locale/en_US.xml +++ b/MiraAPI.Example/Resources/Locale/en_US.xml @@ -1,69 +1,82 @@ - Teleporter + Teleporter Zoom out and teleport across the map! - Zoom out and teleport across the map! + Zoom out and teleport across the map! Zoom out and teleport across the map! The Teleporter is a Crewmate role that can move around the map using their dope-ass ability. - Freezer - Freeze another player for a duration of time. - Mayor - You get extra votes! - Chamelon - Stay invisible while not moving. - Outcast Killer - Outcast who can kill. - Outcast - OUTCAST - You are an Outcast. You do not have a team. - Think - Thinking... - Freeze - Teleport - Call Meeting - Win Game - Captain - You can call a meeting from anywhere on the map. - Freezed - High Priority - You are high priority! Idrk what this means either tbh... - Example Options 1 - Toggle Opt 1 - Toggle Opt 2 - Number Opt - Best API - Example Options 2 - YOU MUST CHOSE A PLAYER - Eh whatever - Toggle Option 1 - Toggle Option 2 - Enum Opt - Captain Settings - Amount - Chance - Uses - Freeze - Use Color - General - Some Boolean Option - Number Option - Custom Role - Freeze Duration - Freeze Uses - Teleporter - Teleport Cooldown - Teleport Duration - Zoom Distance - Mira Example - Example Bool - Example Bool 2 - Slider - Example Number - Example Multplier - Example Enum - Example Button - Outcast Killer Wins! - Cerulean - Rose - Gold + Freezer + Get iced, nerd. + Freeze others for a duration of time. + Freeze another player for a duration of time. + The Freezer is an Impostor role that can freeze players. Or something along those lines. + Mayor + Democracy is the best policy. + Vote out the Impostors with more votes. +Your votes have double the power. + You get one extra vote in the meeting! + The Mayor is a Crewmate role that gets two votes in the meeting, instead of the singular vote other Crewmates get. + Chamelon + Become one with the environment. + Fade out of everyone's vision by not moving. + Stay invisible while not moving. + The Chamelon is a Crewmate role that slowly becomes invisible while standing still. + Outcast Killer + Kill everyone else. + Be the last outcast standing. +Eliminate every other faction. + Outcast who can kill. + The Outcast Killer is an Outcast role that can kill, like some sort of neutral killer... + Outcast + OUTCAST + You are an Outcast. You do not have a team. + Think + Thinking... + Freeze + Teleport + Call Meeting + Win Game + Captain + You can call a meeting from anywhere on the map. + Freezed + High Priority + You are high priority! Idrk what this means either tbh... + Example Options 1 + Toggle Opt 1 + Toggle Opt 2 + Number Opt + Best API + Example Options 2 + YOU MUST CHOSE A PLAYER + Eh whatever + Toggle Option 1 + Toggle Option 2 + Enum Opt + Captain Settings + Amount + Chance + Uses + Freeze + Use Color + General + Some Boolean Option + Number Option + Custom Role + Freeze Duration + Freeze Uses + Teleport Cooldown + Teleport Duration + Zoom Distance + Mira Example + Example Bool + Example Bool 2 + Slider + Example Number + Example Multplier + Example Enum + Example Button + Outcast Killer Wins! + Cerulean + Rose + Gold diff --git a/MiraAPI.Example/Resources/Locale/zh_CN.xml b/MiraAPI.Example/Resources/Locale/zh_CN.xml index 3b5a53e..aa9f7eb 100644 --- a/MiraAPI.Example/Resources/Locale/zh_CN.xml +++ b/MiraAPI.Example/Resources/Locale/zh_CN.xml @@ -1,57 +1,59 @@ - 传送者 - 缩小视野并在地图上传送! - 冰冻者 - 将其他玩家冰冻一段时间。 - 市长 + 传送者 + 缩小视野并在地图上传送! + 缩小视野并在地图上传送! + 缩小视野并在地图上传送! + 冰冻者 + 将其他玩家冰冻一段时间。 + 市长 你拥有额外投票权! - 变色龙 + 变色龙 静止不动时保持隐身。 - 流放杀手 + 流放杀手 可以击杀的流放者。 - 流放者 + 流放者 流放者 你是流放者,你没有队伍。 - 思考 + 思考 思考中... - 冰冻 - 传送 - 召集会议 - 赢得游戏 - 队长 + 冰冻 + 传送 + 召集会议 + 赢得游戏 + 队长 你可以在地图上任意位置召集会议。 - 已被冰冻 - 高优先级 + 已被冰冻 + 高优先级 你是高优先级!老实说我也不太清楚这是什么意思…… - 示例选项组 1 + 示例选项组 1 开关选项 1 开关选项 2 数字选项 谁是最好的API - 示例选项组 2 + 示例选项组 2 你必须选择一个玩家 咕咕嘎嘎 开关选项 1 开关选项 2 枚举选项 - 队长设置 + 队长设置 数量 概率 使用次数 - 冰冻 + 冰冻 使用颜色 - 通用 + 通用 某个布尔选项 数字选项 - 自定义职业 - 冰冻时长 - 冰冻次数 - 传送者 - 传送冷却 - 传送持续时间 - 缩放距离 - Mira 示例插件 + 自定义职业 + 冰冻时长 + 冰冻次数 + 传送者 + 传送冷却 + 传送持续时间 + 缩放距离 + Mira 示例插件 示例布尔 示例布尔 2 滑块 diff --git a/MiraAPI.Example/Roles/NeutralKillerRole.cs b/MiraAPI.Example/Roles/NeutralKillerRole.cs index e952703..9ccec19 100644 --- a/MiraAPI.Example/Roles/NeutralKillerRole.cs +++ b/MiraAPI.Example/Roles/NeutralKillerRole.cs @@ -19,7 +19,7 @@ public class NeutralKillerRole : ImpostorRole, ICustomRole CanUseVent = true, }; - public RoleOptionsGroup RoleOptionsGroup { get; } = new("outcast.name", Color.gray); + public RoleOptionsGroup RoleOptionsGroup { get; } = new("outcast", Color.gray); [HideFromIl2Cpp] public TeamIntroConfiguration? IntroConfiguration { get; } = new( diff --git a/MiraAPI/GameModes/AbstractGameMode.cs b/MiraAPI/GameModes/AbstractGameMode.cs index 37bbd39..10dd377 100644 --- a/MiraAPI/GameModes/AbstractGameMode.cs +++ b/MiraAPI/GameModes/AbstractGameMode.cs @@ -33,7 +33,7 @@ public abstract class AbstractGameMode : IOptionable public abstract string Description { get; } /// - /// Gets the game mode description. + /// Gets the game mode color to display on the lobby pane. /// public virtual Color Color { get; } = Color.white; @@ -43,14 +43,14 @@ public abstract class AbstractGameMode : IOptionable public virtual LoadableAsset? Icon => null; /// - /// Gets the icon of the gamemode for use on the options pop-up. + /// Gets or sets the icon of the gamemode for use on the options pop-up. /// public TMP_SpriteAsset TmpIcon { get; set; } = null!; /// /// Gets the colored game mode name, using the color and name properties. /// - public string ColoredName => $"{MiraLocaleManager.Get(Name)}"; + public string ColoredName => $"{MiraLocaleManager.Get(Name)}"; /// /// Gets the game mode id. diff --git a/MiraAPI/GameModes/GameModeOption.cs b/MiraAPI/GameModes/GameModeOption.cs index 180103d..792eabd 100644 --- a/MiraAPI/GameModes/GameModeOption.cs +++ b/MiraAPI/GameModes/GameModeOption.cs @@ -53,13 +53,13 @@ public static class GameModeOption internal static readonly StringNames CustomName = MiraLocaleManager.GetOrCreateLocaleString("Custom"); internal static readonly Dictionary Values = new() { - [0] = MiraLocaleManager.GetOrCreateLocaleString("Classic"), + [0] = MiraLocaleManager.GetOrCreateLocaleString("gamemode.classic"), }; internal static void AddOption(AbstractGameMode mode) { if (!Values.ContainsKey(mode.ID)) - Values.Add(mode.ID, MiraLocaleManager.GetOrCreateLocaleString(mode + ".colored")); + Values.Add(mode.ID, MiraLocaleManager.GetOrCreateLocaleString(mode.Name)); } /*[HarmonyPatch(typeof(GameOptionsMenu), nameof(GameOptionsMenu.CreateSettings))] [HarmonyPostfix] diff --git a/MiraAPI/MiraApiSettings.cs b/MiraAPI/MiraApiSettings.cs index 8259e7b..955be0e 100644 --- a/MiraAPI/MiraApiSettings.cs +++ b/MiraAPI/MiraApiSettings.cs @@ -17,7 +17,7 @@ namespace MiraAPI; public class MiraApiSettings(ConfigFile config) : LocalSettingsTab(config) { /// - public override string TabName => "miraApi.name".Translate(); + public override string TabName => "miraApi"; /// public override LocalSettingTabAppearance TabAppearance => new() @@ -205,58 +205,58 @@ public class MiraApiSettings(ConfigFile config) : LocalSettingsTab(config) } } - /// - /// Gets whether the modifiers hud should be on the left side of the screen (under roles/task tab). Recommended for streamers. - /// - [LocalToggleSetting] - public ConfigEntry ModifiersHudLeftSide { get; private set; } = config.Bind("Visuals/UI", "Show Modifiers HUD on Left Side", false); - - /// - /// Gets whether to show keybinds on buttons. - /// - [LocalToggleSetting] - public ConfigEntry ShowKeybinds { get; private set; } = config.Bind("Visuals/UI", "Show Keybinds on Buttons", true); - /// /// Gets the scale of the ability buttons. /// [LocalSliderSetting(min: 0.5f, max: 1.5f, suffixType: MiraNumberSuffixes.Multiplier, formatString: "0.00", displayValue: true)] public ConfigEntry ButtonUIFactorSlider { get; private set; } = - config.Bind("Visuals/UI", "Button Scale Factor", 0.75f); + config.Bind("miraApi.visualsUi", "miraApi.buttonScaleFactor", 0.75f); /// /// Gets the scale of the UI buttons. /// [LocalSliderSetting(min: 0.3f, max: 2f, suffixType: MiraNumberSuffixes.Multiplier, formatString: "0.00", displayValue: true)] public ConfigEntry TopRightButtonsFactorSlider { get; private set; } = - config.Bind("Visuals/UI", "Top-Right UI Scale Factor", 1f); + config.Bind("miraApi.visualsUi", "miraApi.topRightButtonScaleFactor", 1f); /// /// Gets the fps specified by the player. /// [LocalSliderSetting(min: 60f, max: 240f, suffixType: MiraNumberSuffixes.None, formatString: "0", displayValue: true, roundValue: true)] public ConfigEntry SetFpsSlider { get; private set; } = - config.Bind("Visuals/UI", "Max FPS", 120f); + config.Bind("miraApi.visualsUi", "Max FPS", 120f); + + /// + /// Gets whether the modifiers hud should be on the left side of the screen (under roles/task tab). Recommended for streamers. + /// + [LocalToggleSetting] + public ConfigEntry ModifiersHudLeftSide { get; private set; } = config.Bind("miraApi.visualsUi", "miraApi.showModifiersHudOnLeftSide", false); + + /// + /// Gets whether to show keybinds on buttons. + /// + [LocalToggleSetting] + public ConfigEntry ShowKeybinds { get; private set; } = config.Bind("miraApi.visualsUi", "miraApi.showKeybindsOnButtons", true); [LocalToggleSetting] public ConfigEntry WikiOnBottomRow { get; private set; } = - config.Bind("Visuals/UI", "Display Wiki on Bottom Row", true); + config.Bind("miraApi.visualsUi", "miraApi.wikiOnBottomRow", true); /// /// Gets whether to apply cosmetic changes to the TaskAdder. /// [LocalToggleSetting] - public ConfigEntry PrettyTaskAdder { get; private set; } = config.Bind("Freeplay", "Pretty Task Laptop", true); + public ConfigEntry PrettyTaskAdder { get; private set; } = config.Bind("miraApi.freeplay", "miraApi.prettyTaskLaptop", true); /// /// Gets whether to show the red flash from sabotages. /// [LocalToggleSetting] - public ConfigEntry EnableSabotageFlashes { get; private set; } = config.Bind("Accessibility", "Enable Sabotage Flashes", true); + public ConfigEntry EnableSabotageFlashes { get; private set; } = config.Bind("miraApi.accessibility", "miraApi.enableSabotageFlashes", true); /// /// Gets whether to enable the sabotage sound effects or not. /// [LocalToggleSetting] - public ConfigEntry EnableSabotageBlares { get; private set; } = config.Bind("Accessibility", "Enable Sabotage Blare", true); + public ConfigEntry EnableSabotageBlares { get; private set; } = config.Bind("miraApi.accessibility", "miraApi.enableSabotageBlare", true); } diff --git a/MiraAPI/Patches/GameModes/HudPatches.cs b/MiraAPI/Patches/GameModes/HudPatches.cs index 735d198..dba4731 100644 --- a/MiraAPI/Patches/GameModes/HudPatches.cs +++ b/MiraAPI/Patches/GameModes/HudPatches.cs @@ -2,6 +2,7 @@ using System.Collections; using HarmonyLib; using Il2CppSystem; using MiraAPI.GameModes; +using MiraAPI.Translation; using Reactor.Utilities; using Reactor.Utilities.Extensions; using TMPro; @@ -49,7 +50,7 @@ internal static class HudPatches gmText.SetActive(false); modelText.SetActive(false); _text = gmTextClone.GetComponent(); - _text.text = CustomGameModeManager.ActiveMode != null ? $"{CustomGameModeManager.ActiveMode.Name}" : "Classic"; + _text.text = CustomGameModeManager.ActiveMode != null ? CustomGameModeManager.ActiveMode.ColoredName : MiraLocaleManager.Get("gamemode.classic"); CustomGameModeManager.ActiveMode?.HudStart(instance); } diff --git a/MiraAPI/Patches/Options/LobbyViewPanePatches.cs b/MiraAPI/Patches/Options/LobbyViewPanePatches.cs index 0a5acee..7c673d0 100644 --- a/MiraAPI/Patches/Options/LobbyViewPanePatches.cs +++ b/MiraAPI/Patches/Options/LobbyViewPanePatches.cs @@ -151,7 +151,7 @@ public static class LobbyViewPanePatches var cgm = GetCustomGamemode(); ModifiersTabButton?.gameObject.SetActive(false); menu.rolesTabButton.gameObject.SetActive(cgm is null or { ShowNormalRoleSettings: true }); - menu.gameModeText.text = cgm is null ? "Main" : cgm.ColoredName; + menu.gameModeText.text = cgm is null ? MiraLocaleManager.Get("gamemode.classic") : cgm.ColoredName; } else { diff --git a/MiraAPI/Resources/Locale/en_US.xml b/MiraAPI/Resources/Locale/en_US.xml index 5ee4b83..68c78c9 100644 --- a/MiraAPI/Resources/Locale/en_US.xml +++ b/MiraAPI/Resources/Locale/en_US.xml @@ -1,6 +1,6 @@ - Mira API + Mira API Visuals/UI Freeplay Accessibility @@ -8,7 +8,9 @@ Show Modifiers HUD on Left Side Show Keybinds on Buttons Button Scale Factor + Top-Right UI Scale Factor Max FPS + Display Wiki on Bottom Row Pretty Task Laptop Enable Sabotage Flashes Enable Sabotage Blare diff --git a/MiraAPI/Resources/Locale/zh_CN.xml b/MiraAPI/Resources/Locale/zh_CN.xml index 17df36e..89848c4 100644 --- a/MiraAPI/Resources/Locale/zh_CN.xml +++ b/MiraAPI/Resources/Locale/zh_CN.xml @@ -1,6 +1,6 @@ - Mira API + Mira API 界面/视觉 自由模式 无障碍 @@ -17,7 +17,7 @@ 自定义类别 2 在此配置附加职业及其设置! 为此模组应用游戏设置! - 默认 + 默认 默认原版游戏模式 点击关闭 为本游戏选择或创建一个预设