Skip to content

Commit 0909b88

Browse files
committed
[StudioCustomMasking] Use Screencap events for compatibility
1 parent 7f3aa2c commit 0909b88

File tree

6 files changed

+8
-24
lines changed

6 files changed

+8
-24
lines changed

src/StudioCustomMasking.AI/AI.StudioCustomMasking.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
<PackageReference Include="IllusionLibs.BepInEx.MonoMod" Version="22.1.29.1" />
3838
<PackageReference Include="IllusionModdingAPI.AIAPI" Version="1.38.0" />
3939
<PackageReference Include="Microsoft.Unity.Analyzers" Version="1.21.0" />
40+
<PackageReference Include="ScreenshotManager.AIGirl" Version="19.3.3" />
4041
</ItemGroup>
4142
<Import Project="..\UIUtility\UIUtility.projitems" Label="Shared" />
4243
<Import Project="..\Shared\Shared.projitems" Label="Shared" />

src/StudioCustomMasking.Core/Core.StudioCustomMasking.Hooks.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,5 @@ IEnumerator Reset()
3434
StudioCustomMasking.HideLines = false;
3535
}
3636
}
37-
38-
internal static void ScreencapHook()
39-
{
40-
StudioCustomMasking.HideLines = true;
41-
42-
StudioCustomMasking.Instance.StartCoroutine(Reset());
43-
IEnumerator Reset()
44-
{
45-
yield return null;
46-
StudioCustomMasking.HideLines = false;
47-
}
48-
}
4937
}
5038
}

src/StudioCustomMasking.Core/Core.StudioCustomMasking.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System.IO;
1010
using System.Reflection;
1111
using KKAPI.Utilities;
12+
using Screencap;
1213
using UILib;
1314
using UnityEngine;
1415
using UnityEngine.SceneManagement;
@@ -19,6 +20,7 @@ namespace KK_Plugins.StudioCustomMasking
1920
[BepInProcess(Constants.StudioProcessName)]
2021
[BepInDependency(KoikatuAPI.GUID, KoikatuAPI.VersionConst)]
2122
[BepInDependency(StudioSceneSettings.StudioSceneSettings.GUID, StudioSceneSettings.StudioSceneSettings.Version)]
23+
[BepInDependency(ScreenshotManager.GUID, ScreenshotManager.Version)]
2224
[BepInPlugin(GUID, PluginName, Version)]
2325
public class StudioCustomMasking : BaseUnityPlugin
2426
{
@@ -58,18 +60,8 @@ internal void Main()
5860

5961
ColliderColor.SettingChanged += ColliderColor_SettingChanged;
6062

61-
Type ScreencapType = Type.GetType("Screencap.ScreenshotManager, Screencap");
62-
if (ScreencapType == null)
63-
ScreencapType = Type.GetType($"Screencap.ScreenshotManager, {Constants.Prefix}_Screencap");
64-
65-
if (ScreencapType != null)
66-
{
67-
#if KK || KKS
68-
harmony.Patch(ScreencapType.GetMethod("TakeCharScreenshot", AccessTools.all), new HarmonyMethod(typeof(Hooks).GetMethod(nameof(Hooks.ScreencapHook), AccessTools.all)));
69-
#else
70-
harmony.Patch(ScreencapType.GetMethod("CaptureAndWrite", AccessTools.all), new HarmonyMethod(typeof(Hooks).GetMethod(nameof(Hooks.ScreencapHook), AccessTools.all)));
71-
#endif
72-
}
63+
ScreenshotManager.OnPreCapture += () => HideLines = true;
64+
ScreenshotManager.OnPostCapture += () => HideLines = false;
7365
}
7466

7567
private static void ColliderColor_SettingChanged(object sender, EventArgs e)

src/StudioCustomMasking.HS2/HS2.StudioCustomMasking.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
<PackageReference Include="IllusionLibs.HoneySelect2.UnityEngine.UIModule" Version="2018.4.11.4" />
3838
<PackageReference Include="IllusionModdingAPI.HS2API" Version="1.38.0" />
3939
<PackageReference Include="Microsoft.Unity.Analyzers" Version="1.21.0" />
40+
<PackageReference Include="ScreenshotManager.HoneySelect2" Version="19.3.3" />
4041
</ItemGroup>
4142
<Import Project="..\Shared\Shared.projitems" Label="Shared" />
4243
<Import Project="..\UIUtility\UIUtility.projitems" Label="Shared" />

src/StudioCustomMasking.KK/KK.StudioCustomMasking.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<PackageReference Include="IllusionModdingAPI.KKAPI" Version="1.38.0" />
3030
<PackageReference Include="KoikatuCompatibilityAnalyzer" Version="1.1.0" />
3131
<PackageReference Include="Microsoft.Unity.Analyzers" Version="1.21.0" />
32+
<PackageReference Include="ScreenshotManager.Koikatu" Version="19.3.3" />
3233
</ItemGroup>
3334
<Import Project="..\Shared\Shared.projitems" Label="Shared" />
3435
<Import Project="..\UIUtility\UIUtility.projitems" Label="Shared" />

src/StudioCustomMasking.KKS/KKS.StudioCustomMasking.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<PackageReference Include="IllusionLibs.KoikatsuSunshine.UnityEngine.UIModule" Version="2019.4.9" />
3737
<PackageReference Include="IllusionModdingAPI.KKSAPI" Version="1.38.0" />
3838
<PackageReference Include="Microsoft.Unity.Analyzers" Version="1.21.0" />
39+
<PackageReference Include="ScreenshotManager.KoikatsuSunshine" Version="19.3.3" />
3940
</ItemGroup>
4041
<Import Project="..\StudioCustomMasking.Core\StudioCustomMasking.Core.projitems" Label="Shared" />
4142
<Import Project="..\Shared\Shared.projitems" Label="Shared" />

0 commit comments

Comments
 (0)