Skip to content

Commit

Permalink
v4.3.3 (#90)
Browse files Browse the repository at this point in the history
* e1.5.9 compatibility fix

* Update EditValueGauntletScreen.cs

* Update changelog.txt

* Update common.props

* Update changelog.txt
  • Loading branch information
Aragas authored Mar 12, 2021
1 parent 66bb62f commit 7b127eb
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>

<PropertyGroup>
<Version>4.3.2</Version>
<Version>4.3.3</Version>
<GameVersion>1.4.3</GameVersion>
<HarmonyVersion>2.0.2</HarmonyVersion>
<ButterLibVersion>1.0.21</ButterLibVersion>
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---------------------------------------------------------------------------------------------------
Version: 4.3.3
Game Versions: e1.4.3,e1.5.0,e1.5.1,e1.5.2,e1.5.3,e1.5.4,e1.5.5,e1.5.6,e1.5.7,e1.5.8,e1.5.9
* Adapted to e1.5.9
---------------------------------------------------------------------------------------------------
Version: 4.3.2
Game Versions: e1.4.3,e1.5.0,e1.5.1,e1.5.2,e1.5.3,e1.5.4,e1.5.5,e1.5.6,e1.5.7,e1.5.8
* Better ButterLib integration when available
Expand Down
12 changes: 9 additions & 3 deletions src/MCM.UI/GUI/GauntletUI/EditValueGauntletScreen.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using MCM.UI.GUI.ViewModels;
using Bannerlord.ButterLib.Common.Helpers;

using MCM.UI.GUI.ViewModels;

using TaleWorlds.Engine;
using TaleWorlds.Engine.GauntletUI;
Expand All @@ -11,10 +13,13 @@ namespace MCM.UI.GUI.GauntletUI
{
internal sealed class EditValueGauntletScreen : ScreenBase
{
private delegate void ReleaseMovieDelegate(object movie);

private readonly SettingsPropertyVM _settingProperty;
private GauntletLayer _gauntletLayer = default!;
private GauntletMovie _gauntletMovie = default!;
private object _gauntletMovie = default!;
private EditValueVM _dataSource = default!;
private ReleaseMovieDelegate? _releaseMovie;

public EditValueGauntletScreen(SettingsPropertyVM settingProperty)
{
Expand All @@ -26,6 +31,7 @@ protected override void OnInitialize()
base.OnInitialize();
_dataSource = new EditValueVM(_settingProperty);
_gauntletLayer = new GauntletLayer(4000, "GauntletLayer");
_releaseMovie = AccessTools2.GetDelegate<ReleaseMovieDelegate>(typeof(GauntletLayer), "ReleaseMovie");
_gauntletMovie = _gauntletLayer.LoadMovie("EditValueView_MCM", _dataSource);
_gauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("ChatLogHotKeyCategory"));
_gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All);
Expand Down Expand Up @@ -53,7 +59,7 @@ protected override void OnFinalize()
{
base.OnFinalize();
RemoveLayer(_gauntletLayer);
_gauntletLayer.ReleaseMovie(_gauntletMovie);
_releaseMovie?.Invoke(_gauntletMovie);
_gauntletLayer = null!;
_gauntletMovie = null!;
_dataSource.SettingProperty = null!;
Expand Down
13 changes: 9 additions & 4 deletions src/MCM.UI/GUI/GauntletUI/ModOptionsGauntletScreen.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using MCM.UI.GUI.ViewModels;
using Bannerlord.ButterLib.Common.Helpers;

using MCM.UI.GUI.ViewModels;

using Microsoft.Extensions.Logging;

using TaleWorlds.Engine.GauntletUI;
using TaleWorlds.Engine.Screens;
using TaleWorlds.GauntletUI.Data;
using TaleWorlds.InputSystem;
using TaleWorlds.Library;
using TaleWorlds.TwoDimension;
Expand All @@ -16,12 +17,15 @@ namespace MCM.UI.GUI.GauntletUI
/// </summary>
internal sealed class ModOptionsGauntletScreen : ScreenBase, IMCMOptionsScreen
{
private delegate void ReleaseMovieDelegate(object movie);

private readonly ILogger<ModOptionsGauntletScreen> _logger;

private GauntletLayer _gauntletLayer = default!;
private GauntletMovie _gauntletMovie = default!;
private object _gauntletMovie = default!;
private ModOptionsVM _dataSource = default!;
private SpriteCategory _spriteCategoryEncyclopedia = default!;
private ReleaseMovieDelegate? _releaseMovie;

public ModOptionsGauntletScreen(ILogger<ModOptionsGauntletScreen> logger)
{
Expand All @@ -38,6 +42,7 @@ protected override void OnInitialize()
_spriteCategoryEncyclopedia.Load(resourceContext, uiresourceDepot);
_dataSource = new ModOptionsVM();
_gauntletLayer = new GauntletLayer(4000, "GauntletLayer");
_releaseMovie = AccessTools2.GetDelegate<ReleaseMovieDelegate>(typeof(GauntletLayer), "ReleaseMovie");
_gauntletMovie = _gauntletLayer.LoadMovie("ModOptionsView_MCM", _dataSource);
_gauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericPanelGameKeyCategory"));
_gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All);
Expand All @@ -63,7 +68,7 @@ protected override void OnFinalize()
// TODO: There was a report that the encyclopedia UI is bugged
//_spriteCategoryEncyclopedia.Unload();
RemoveLayer(_gauntletLayer);
_gauntletLayer.ReleaseMovie(_gauntletMovie);
_releaseMovie?.Invoke(_gauntletMovie);
_gauntletLayer = null!;
_gauntletMovie = null!;
_dataSource.ExecuteSelect(null);
Expand Down
2 changes: 1 addition & 1 deletion src/Mod Configuration Menu.sln
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ Global
{8A92126A-70CA-47BF-B208-E49E47A9E707} = {6DA59EA7-D40B-4C02-B0CC-64875B4064CD}
{94DECE01-AE9B-476C-82BE-0DE680E38FA2} = {C08D87A6-8ADC-4600-9CA1-2B18F9BDD133}
{01264F42-8EC3-4920-AF18-FB316F5BFB9A} = {87702001-50A1-4159-AF31-4848D018490E}
{560DE987-D9C8-431C-A197-08C925905C24} = {6DA59EA7-D40B-4C02-B0CC-64875B4064CD}
{560DE987-D9C8-431C-A197-08C925905C24} = {8A92126A-70CA-47BF-B208-E49E47A9E707}
{FB5D85DA-B398-4820-AD1F-C79D83543921} = {560DE987-D9C8-431C-A197-08C925905C24}
{A8BBD326-8B9E-41E4-8219-030B8E42EBBA} = {560DE987-D9C8-431C-A197-08C925905C24}
{FFCD62E1-D894-4A2C-AAFD-9CEAF3B47410} = {560DE987-D9C8-431C-A197-08C925905C24}
Expand Down

0 comments on commit 7b127eb

Please sign in to comment.