Skip to content

Commit

Permalink
Stop using obsoleted things (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
ManlyMarco authored May 3, 2024
1 parent f2b50f4 commit a2ca8ae
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
3 changes: 1 addition & 2 deletions archive/FreeHControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions archive/Unlocker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/BuildSettings.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BepInEx.Analyzers" Version="1.0.8" />
<PackageReference Include="Microsoft.Unity.Analyzers" Version="1.18" />
</ItemGroup>
<Import Project="SkipAllRefs.targets" />
</Project>
20 changes: 11 additions & 9 deletions src/DefaultParamEditor.Core/SceneParam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -47,12 +47,14 @@ public static void Save()
if (prop.PropertyExists())
{
_sceneData.ace2No = prop.GetValue<int>();

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;
}
}
}
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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);
}
Expand Down

0 comments on commit a2ca8ae

Please sign in to comment.