Skip to content

Commit

Permalink
Fix the issue that battle map may block order of battle panel during …
Browse files Browse the repository at this point in the history
…deployment; replace 'Show Map When Commanding' with 'Toggle Map When Commanding
  • Loading branch information
LiZhenhuan1019 committed Aug 28, 2022
1 parent a991c40 commit 7f21201
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/resources/config.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
GAME_VERSION=e1.8.0
GAME_BRANCH=master
MOD_VERSION=v1.1.1
MOD_VERSION=v1.1.2
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<string id="BattleMiniMap_map_options" text="地图选项" />
<string id="BattleMiniMap_show_map" text="显示地图" />
<string id="BattleMiniMap_enable_toggle_map_long_press_key" text="启用长按切换地图按键" />
<string id="BattleMiniMap_show_map_when_commanding" text="指挥时显示地图" />
<string id="BattleMiniMap_toggle_map_when_commanding" text="指挥时切换地图" />
<string id="BattleMiniMap_map_width" text="地图宽度" />

<string id="BattleMiniMap_horizontal_alignment" text="水平对齐方向" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<string id="str_battle_mini_map_map_options" text="{=BattleMiniMap_map_options}Map options" />
<string id="str_battle_mini_map_show_map" text="{=BattleMiniMap_show_map}Show Map" />
<string id="str_battle_mini_map_enable_toggle_map_long_press_key" text="{=BattleMiniMap_enable_toggle_map_long_press_key}Enable the Toggle Map (Long Press) key" />
<string id="str_battle_mini_map_show_map_when_commanding" text="{=BattleMiniMap_show_map_when_commanding}Show Map When Commanding" />
<string id="str_battle_mini_map_toggle_map_when_commanding" text="{=BattleMiniMap_toggle_map_when_commanding}Toggle Map When Commanding" />
<string id="str_battle_mini_map_map_width" text="{=BattleMiniMap_map_width}Map Width" />

<string id="str_battle_mini_map_horizontal_alignment" text="{=BattleMiniMap_horizontal_alignment}Horizontal Alignment" />
Expand Down
2 changes: 1 addition & 1 deletion source/BattleMiniMap/Modules/BattleMiniMap/SubModule.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Module>
<Name value="Battle Mini Map" />
<Id value="BattleMiniMap" />
<Version value="v1.1.1" />
<Version value="v1.1.2" />
<SingleplayerModule value="true" />
<MultiplayerModule value="false" />
<DependedModules>
Expand Down
4 changes: 2 additions & 2 deletions source/BattleMiniMap/src/Config/BattleMiniMapConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class BattleMiniMapConfig : MissionConfigBase<BattleMiniMapConfig>

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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public static IIdProvider<AOptionClass> 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,
() =>
Expand Down
7 changes: 4 additions & 3 deletions source/BattleMiniMap/src/View/Interaction/MapControlWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions source/BattleMiniMap/src/View/Map/BattleMiniMapView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -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);
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -106,7 +106,7 @@ private void BoundariesOnCollectionChanged(object sender, NotifyCollectionChange

private void OnOrderViewToggled(MissionPlayerToggledOrderViewEvent obj)
{
_isOrderViewOpened = obj.IsOrderEnabled;
_isOrderViewEnabled = obj.IsOrderEnabled;
}
}
}

0 comments on commit 7f21201

Please sign in to comment.