Skip to content

Commit 6c07dd2

Browse files
authored
Merge pull request #490 from ow-mods/dev
2.7.2
2 parents 789e548 + 30783b2 commit 6c07dd2

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

src/OWML.Launcher/OWML.Launcher.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</ItemGroup>
2525

2626
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
27-
<Exec Command="xcopy /i /y &quot;$(SolutionDir)src\OWML.ModHelper.Events\bin\Debug\net48\0Harmony.dll&quot; $(TargetDir)&#xD;&#xA;xcopy /i /y &quot;$(SolutionDir)src\OWML.ModHelper.Assets\bin\Debug\net48\NAudio-Unity.dll&quot; $(TargetDir)&#xD;&#xA;xcopy /i /y &quot;$(SolutionDir)src\OWML.Temp\bin\Debug\net48\Newtonsoft.Json.dll&quot; $(TargetDir)" />
27+
<Exec Command="xcopy /i /y &quot;$(SolutionDir)src\OWML.ModHelper.Events\bin\Debug\net48\0Harmony.dll&quot; &quot;$(TargetDir)&quot;&#xD;&#xA;xcopy /i /y &quot;$(SolutionDir)src\OWML.ModHelper.Assets\bin\Debug\net48\NAudio-Unity.dll&quot; &quot;$(TargetDir)&quot;&#xD;&#xA;xcopy /i /y &quot;$(SolutionDir)src\OWML.Temp\bin\Debug\net48\Newtonsoft.Json.dll&quot; &quot;$(TargetDir)&quot;" />
2828
</Target>
2929

3030
</Project>

src/OWML.Launcher/OWML.Manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"author": "Alek",
44
"name": "OWML",
55
"uniqueName": "Alek.OWML",
6-
"version": "2.7.1",
6+
"version": "2.7.2",
77
"minGameVersion": "1.1.10.47",
88
"maxGameVersion": "1.1.13.393"
99
}

src/OWML.ModLoader/Owo.cs

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
5-
using System.Net;
6-
using System.Reflection;
7-
using Newtonsoft.Json;
1+
using HarmonyLib;
82
using OWML.Common;
93
using OWML.Common.Enums;
104
using OWML.Common.Interfaces;
@@ -15,9 +9,16 @@
159
using OWML.ModHelper.Events;
1610
using OWML.ModHelper.Interaction;
1711
using OWML.Utils;
12+
using System;
13+
using System.Collections.Generic;
14+
using System.IO;
15+
using System.Linq;
16+
using System.Reflection;
17+
using UnityEngine.UI;
1818

1919
namespace OWML.ModLoader
2020
{
21+
[HarmonyPatch]
2122
public class Owo
2223
{
2324
private readonly IModFinder _modFinder;
@@ -85,7 +86,7 @@ public void LoadMods()
8586

8687
EnumUtils.Initialize(_console, _harmonyHelper);
8788

88-
_harmonyHelper.AddPrefix<TabbedMenu>(nameof(TabbedMenu.OnUpdateInputDevice), typeof(Owo), nameof(TabbedMenu_OnUpdateInputDevice));
89+
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly());
8990

9091
var mods = _modFinder.GetMods();
9192

@@ -268,6 +269,8 @@ private IModBehaviour InitializeMod(Type modType, IModHelper helper)
268269
}
269270
}
270271

272+
[HarmonyPrefix]
273+
[HarmonyPatch(typeof(TabbedMenu), nameof(TabbedMenu.OnUpdateInputDevice))]
271274
private static bool TabbedMenu_OnUpdateInputDevice(TabbedMenu __instance)
272275
{
273276
if ((object)__instance == null) return false;
@@ -276,5 +279,22 @@ private static bool TabbedMenu_OnUpdateInputDevice(TabbedMenu __instance)
276279
if (Utils.TypeExtensions.GetValue<UnityEngine.UI.Image>(__instance, "_tabLeftButtonImg") == null || Utils.TypeExtensions.GetValue<UnityEngine.UI.Image>(__instance, "_tabRightButtonImg") == null) return false;
277280
return true;
278281
}
282+
283+
[HarmonyReversePatch]
284+
[HarmonyPatch(typeof(Menu), nameof(Menu.Deactivate))]
285+
private static void Menu_Deactivate(Menu __instance, bool remainVisible = false) { }
286+
287+
[HarmonyPrefix]
288+
[HarmonyPatch(typeof(TabbedMenu), nameof(TabbedMenu.Deactivate))]
289+
private static bool TabbedMenu_Deactivate(TabbedMenu __instance, bool keepPreviousMenuVisible = false)
290+
{
291+
if (Locator.GetEventSystem().currentSelectedGameObject)
292+
Utils.TypeExtensions.SetValue(__instance, "_lastSelectableOnDeactivate", Locator.GetEventSystem().currentSelectedGameObject.GetComponent<Selectable>());
293+
foreach (var tabSelectablePair in Utils.TypeExtensions.GetValue<TabbedMenu.TabSelectablePair[]>(__instance, "_tabSelectablePairs"))
294+
tabSelectablePair.tabButton.Enable(false);
295+
Menu_Deactivate(__instance, keepPreviousMenuVisible);
296+
Locator.GetMenuInputModule().OnInputModuleTab -= __instance.OnInputModuleTabEvent;
297+
return false;
298+
}
279299
}
280300
}

0 commit comments

Comments
 (0)