From 7f212012d1e340267e558cd795776dcd6fa63a1b Mon Sep 17 00:00:00 2001 From: Zhenhuan Li Date: Sun, 28 Aug 2022 12:31:08 +0800 Subject: [PATCH] Fix the issue that battle map may block order of battle panel during deployment; replace 'Show Map When Commanding' with 'Toggle Map When Commanding --- .github/resources/config.env | 2 +- CHANGELOG.md | 16 ++++++++++++++++ .../Languages/CNs/BattleMiniMap-zho-CN.xml | 2 +- .../BattleMiniMap/ModuleData/module_strings.xml | 2 +- .../Modules/BattleMiniMap/SubModule.xml | 2 +- .../src/Config/BattleMiniMapConfig.cs | 4 ++-- .../Config/BattleMiniMapOptionClassFactory.cs | 6 +++--- .../src/View/Interaction/MapControlWidget.cs | 7 ++++--- .../src/View/Map/BattleMiniMapView.cs | 12 ++++++------ 9 files changed, 35 insertions(+), 18 deletions(-) diff --git a/.github/resources/config.env b/.github/resources/config.env index e1e8eef..6cb53a4 100644 --- a/.github/resources/config.env +++ b/.github/resources/config.env @@ -1,3 +1,3 @@ GAME_VERSION=e1.8.0 GAME_BRANCH=master -MOD_VERSION=v1.1.1 \ No newline at end of file +MOD_VERSION=v1.1.2 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a0af43..2155a59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## [v1.1.2] - 2022-08-28 +### Fixed +- Fix the issue that minimap may block deployment UI. + +### Changed +- Change "Show Map When Commanding" option to "Toggle Map When Commanding" option. + +## [v1.1.0] - 2022-08-23 +### Fixed +- Keep compatible with Bannerlord e1.8.0. + +## [v1.0.13] - 2022-08-25 +### Fixed +- Keep compatible with Bannerlord e1.7.2. + + ## [v1.0.8] - 2020-03-15 ### Fixed - Adjust the shape of corpse marker. diff --git a/source/BattleMiniMap/Modules/BattleMiniMap/ModuleData/Languages/CNs/BattleMiniMap-zho-CN.xml b/source/BattleMiniMap/Modules/BattleMiniMap/ModuleData/Languages/CNs/BattleMiniMap-zho-CN.xml index 9a34275..f3cadd7 100644 --- a/source/BattleMiniMap/Modules/BattleMiniMap/ModuleData/Languages/CNs/BattleMiniMap-zho-CN.xml +++ b/source/BattleMiniMap/Modules/BattleMiniMap/ModuleData/Languages/CNs/BattleMiniMap-zho-CN.xml @@ -11,7 +11,7 @@ - + diff --git a/source/BattleMiniMap/Modules/BattleMiniMap/ModuleData/module_strings.xml b/source/BattleMiniMap/Modules/BattleMiniMap/ModuleData/module_strings.xml index f4b7c24..b4caaee 100644 --- a/source/BattleMiniMap/Modules/BattleMiniMap/ModuleData/module_strings.xml +++ b/source/BattleMiniMap/Modules/BattleMiniMap/ModuleData/module_strings.xml @@ -6,7 +6,7 @@ - + diff --git a/source/BattleMiniMap/Modules/BattleMiniMap/SubModule.xml b/source/BattleMiniMap/Modules/BattleMiniMap/SubModule.xml index 2d788ca..b4b0c72 100644 --- a/source/BattleMiniMap/Modules/BattleMiniMap/SubModule.xml +++ b/source/BattleMiniMap/Modules/BattleMiniMap/SubModule.xml @@ -3,7 +3,7 @@ - + diff --git a/source/BattleMiniMap/src/Config/BattleMiniMapConfig.cs b/source/BattleMiniMap/src/Config/BattleMiniMapConfig.cs index f8c7e2d..1a0bca5 100644 --- a/source/BattleMiniMap/src/Config/BattleMiniMapConfig.cs +++ b/source/BattleMiniMap/src/Config/BattleMiniMapConfig.cs @@ -21,7 +21,7 @@ public class BattleMiniMapConfig : MissionConfigBase public bool EnableToggleMapLongPressKey { get; set; } = true; - public bool ShowMapWhenCommanding { get; set; } = true; + public bool ToggleMapWhenCommanding { get; set; } = true; public int WidgetWidth { get; set; } = 400; public bool FollowMode { get; set; } = false; @@ -56,7 +56,7 @@ protected override void CopyFrom(BattleMiniMapConfig other) ConfigVersion = other.ConfigVersion; ShowMap = other.ShowMap; EnableToggleMapLongPressKey = other.EnableToggleMapLongPressKey; - ShowMapWhenCommanding = other.ShowMapWhenCommanding; + ToggleMapWhenCommanding = other.ToggleMapWhenCommanding; WidgetWidth = other.WidgetWidth; FollowMode = other.FollowMode; FollowModeScale = other.FollowModeScale; diff --git a/source/BattleMiniMap/src/Config/BattleMiniMapOptionClassFactory.cs b/source/BattleMiniMap/src/Config/BattleMiniMapOptionClassFactory.cs index e1be2d3..ee3bfd8 100644 --- a/source/BattleMiniMap/src/Config/BattleMiniMapOptionClassFactory.cs +++ b/source/BattleMiniMap/src/Config/BattleMiniMapOptionClassFactory.cs @@ -25,9 +25,9 @@ public static IIdProvider CreateOptionClassProvider(IMenuClassColl optionCategory.AddOption(new BoolOptionViewModel(GameTexts.FindText("str_battle_mini_map_enable_toggle_map_long_press_key"), null, () => BattleMiniMapConfig.Get().EnableToggleMapLongPressKey, b => BattleMiniMapConfig.Get().EnableToggleMapLongPressKey = b)); optionCategory.AddOption(new BoolOptionViewModel( - GameTexts.FindText("str_battle_mini_map_show_map_when_commanding"), null, - () => BattleMiniMapConfig.Get().ShowMapWhenCommanding, - b => BattleMiniMapConfig.Get().ShowMapWhenCommanding = b)); + GameTexts.FindText("str_battle_mini_map_toggle_map_when_commanding"), null, + () => BattleMiniMapConfig.Get().ToggleMapWhenCommanding, + b => BattleMiniMapConfig.Get().ToggleMapWhenCommanding = b)); optionCategory.AddOption(new NumericOptionViewModel(GameTexts.FindText("str_battle_mini_map_map_width"), null, () => diff --git a/source/BattleMiniMap/src/View/Interaction/MapControlWidget.cs b/source/BattleMiniMap/src/View/Interaction/MapControlWidget.cs index 166495a..b8a672c 100644 --- a/source/BattleMiniMap/src/View/Interaction/MapControlWidget.cs +++ b/source/BattleMiniMap/src/View/Interaction/MapControlWidget.cs @@ -29,9 +29,10 @@ protected override bool OnPreviewMouseScroll() protected override void OnMouseScroll() { base.OnMouseScroll(); - - float num = this.EventManager.DeltaMouseScroll * 0.001f; - BattleMiniMapConfig.Get().FollowModeScale = MathF.Clamp(BattleMiniMapConfig.Get().FollowModeScale * (1 + num), 0.1f, 3f); + + float num = EventManager.DeltaMouseScroll * 0.001f; + if (BattleMiniMapConfig.Get().FollowMode) + BattleMiniMapConfig.Get().FollowModeScale = MathF.Clamp(BattleMiniMapConfig.Get().FollowModeScale * (1 + num), 0.1f, 3f); } private void OnEventFire(Widget widget, string eventName, object[] args) diff --git a/source/BattleMiniMap/src/View/Map/BattleMiniMapView.cs b/source/BattleMiniMap/src/View/Map/BattleMiniMapView.cs index 5c0e772..b190df2 100644 --- a/source/BattleMiniMap/src/View/Map/BattleMiniMapView.cs +++ b/source/BattleMiniMap/src/View/Map/BattleMiniMapView.cs @@ -17,7 +17,7 @@ public class BattleMiniMapView : MissionView private GauntletLayer _layer; private MissionTimer _timer; private bool _boundaryChanged; - private bool _isOrderViewOpened; + private bool _isOrderViewEnabled; public override void OnBehaviorInitialize() { @@ -33,7 +33,7 @@ public override void OnMissionScreenInitialize() { base.OnMissionScreenInitialize(); - _layer = new GauntletLayer(20); + _layer = new GauntletLayer(12); _layer.LoadMovie(nameof(BattleMiniMapView), _dataSource); _layer.InputRestrictions.SetInputRestrictions(false, InputUsageMask.Mouse); MissionScreen.AddLayer(_layer); @@ -63,15 +63,15 @@ public override void OnMissionScreenTick(float dt) else if(toggleMapKey.IsKeyPressed(Input)) { BattleMiniMapConfig.Get().ShowMap = !BattleMiniMapConfig.Get().ShowMap; - if (BattleMiniMapConfig.Get().ShowMap) + if (BattleMiniMapConfig.Get().ShowMap ^ (_isOrderViewEnabled && BattleMiniMapConfig.Get().ToggleMapWhenCommanding)) { BattleMiniMapConfig.Get().FollowMode = !BattleMiniMapConfig.Get().FollowMode; } } _dataSource.UpdateEnabled(dt, MiniMap.Instance.IsValid && - ((BattleMiniMapConfig.Get().ShowMap ^ toggleMapKeyDown) || - _isOrderViewOpened && BattleMiniMapConfig.Get().ShowMapWhenCommanding)); + (BattleMiniMapConfig.Get().ShowMap ^ toggleMapKeyDown ^ + (_isOrderViewEnabled && BattleMiniMapConfig.Get().ToggleMapWhenCommanding))); _dataSource.UpdateCamera(); @@ -106,7 +106,7 @@ private void BoundariesOnCollectionChanged(object sender, NotifyCollectionChange private void OnOrderViewToggled(MissionPlayerToggledOrderViewEvent obj) { - _isOrderViewOpened = obj.IsOrderEnabled; + _isOrderViewEnabled = obj.IsOrderEnabled; } } } \ No newline at end of file