From a2ca8aee1f4cd34e0f71e5395c1f3bb6189bccfa Mon Sep 17 00:00:00 2001 From: ManlyMarco <39247311+ManlyMarco@users.noreply.github.com> Date: Fri, 3 May 2024 23:42:27 +0200 Subject: [PATCH] Stop using obsoleted things (#42) --- archive/FreeHControl.cs | 3 +-- archive/Unlocker.cs | 3 +-- src/BuildSettings.Common.props | 2 +- src/DefaultParamEditor.Core/SceneParam.cs | 20 +++++++++++--------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/archive/FreeHControl.cs b/archive/FreeHControl.cs index 65b333f..dfb05d2 100644 --- a/archive/FreeHControl.cs +++ b/archive/FreeHControl.cs @@ -22,8 +22,7 @@ public class FreeHControl : BaseUnityPlugin private void Awake() { - harmony = new Harmony($"{GUID}.harmony"); - HarmonyWrapper.PatchAll(typeof(Hooks), harmony); + harmony = Harmony.CreateAndPatchAll(typeof(Hooks), $"{GUID}.harmony"); } #if DEBUG diff --git a/archive/Unlocker.cs b/archive/Unlocker.cs index f761b7e..bf5042d 100644 --- a/archive/Unlocker.cs +++ b/archive/Unlocker.cs @@ -34,8 +34,7 @@ private Unlocker() private void Awake() { - var harmony = new Harmony("keelhauled.unlockhpositions.harmony"); - HarmonyWrapper.PatchAll(typeof(Hooks)); + Harmony.CreateAndPatchAll(typeof(Hooks), "keelhauled.unlockhpositions.harmony"); } private class Hooks diff --git a/src/BuildSettings.Common.props b/src/BuildSettings.Common.props index 541e7a4..a284399 100644 --- a/src/BuildSettings.Common.props +++ b/src/BuildSettings.Common.props @@ -7,7 +7,7 @@ true - + diff --git a/src/DefaultParamEditor.Core/SceneParam.cs b/src/DefaultParamEditor.Core/SceneParam.cs index 31d702e..91d0c9f 100644 --- a/src/DefaultParamEditor.Core/SceneParam.cs +++ b/src/DefaultParamEditor.Core/SceneParam.cs @@ -30,7 +30,7 @@ public static void Save() _sceneData.aceNo = sceneInfo.aceNo; _sceneData.aceBlend = sceneInfo.aceBlend; - var aceInfo = UniversalAutoResolver.LoadedStudioResolutionInfo.FirstOrDefault(x => x.ResolveItem && x.LocalSlot == sceneInfo.aceNo); + var aceInfo = UniversalAutoResolver.GetStudioResolveInfos(sceneInfo.aceNo, true).FirstOrDefault(); if(aceInfo != null) { _sceneData.aceNo = aceInfo.Slot; @@ -47,12 +47,14 @@ public static void Save() if (prop.PropertyExists()) { _sceneData.ace2No = prop.GetValue(); - - var ace2Info = UniversalAutoResolver.LoadedStudioResolutionInfo.FirstOrDefault(x => x.ResolveItem && x.LocalSlot == _sceneData.ace2No); - if (ace2Info != null) + if (_sceneData.ace2No.HasValue) { - _sceneData.ace2No = ace2Info.Slot; - _sceneData.ace2No_GUID = ace2Info.GUID; + var ace2Info = UniversalAutoResolver.GetStudioResolveInfos(_sceneData.ace2No.Value, true).FirstOrDefault(); + if (ace2Info != null) + { + _sceneData.ace2No = ace2Info.Slot; + _sceneData.ace2No_GUID = ace2Info.GUID; + } } } } @@ -121,7 +123,7 @@ private static void SetSceneInfoValues(SceneInfo sceneInfo) sceneInfo.aceNo = _sceneData.aceNo; if(!string.IsNullOrEmpty(_sceneData.aceNo_GUID)) { - var aceInfo = UniversalAutoResolver.LoadedStudioResolutionInfo.FirstOrDefault(x => x.GUID == _sceneData.aceNo_GUID && x.Slot == _sceneData.aceNo); + var aceInfo = UniversalAutoResolver.GetStudioResolveInfos(_sceneData.aceNo_GUID, _sceneData.aceNo, false).FirstOrDefault(); if(aceInfo != null) sceneInfo.aceNo = aceInfo.LocalSlot; } @@ -142,9 +144,9 @@ private static void SetSceneInfoValues(SceneInfo sceneInfo) { prop.SetValue(_sceneData.ace2No); - if (!string.IsNullOrEmpty(_sceneData.ace2No_GUID)) + if (!string.IsNullOrEmpty(_sceneData.ace2No_GUID) && _sceneData.ace2No.HasValue) { - var ace2Info = UniversalAutoResolver.LoadedStudioResolutionInfo.FirstOrDefault(x => x.GUID == _sceneData.ace2No_GUID && x.Slot == _sceneData.ace2No); + var ace2Info = UniversalAutoResolver.GetStudioResolveInfos(_sceneData.ace2No_GUID, _sceneData.ace2No.Value, false).FirstOrDefault(); if (ace2Info != null) prop.SetValue(ace2Info.LocalSlot); }