Skip to content

Commit

Permalink
Use latest RuntimeUnityEditor features
Browse files Browse the repository at this point in the history
  • Loading branch information
ManlyMarco committed Nov 11, 2022
1 parent da607b7 commit 444c779
Show file tree
Hide file tree
Showing 19 changed files with 120 additions and 155 deletions.
4 changes: 2 additions & 2 deletions AI_CheatTools/AI_CheatTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
<HintPath>..\packages\IllusionLibs.BepInEx.MonoMod.21.8.5.1\lib\net35\MonoMod.Utils.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RuntimeUnityEditor.Core, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RuntimeUnityEditor.Core.4.0.0\lib\net35\RuntimeUnityEditor.Core.dll</HintPath>
<Reference Include="RuntimeUnityEditor.Core, Version=4.0.0.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RuntimeUnityEditor.Core.4.0.0.1\lib\net35\RuntimeUnityEditor.Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Sirenix.Serialization, Version=2.0.13.0, Culture=neutral, processorArchitecture=MSIL">
Expand Down
32 changes: 18 additions & 14 deletions AI_CheatTools/CheatToolsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static class CheatToolsWindowInit

public static void Initialize()
{
CheatToolsWindow.OnShown = window =>
CheatToolsWindow.OnInitialize += window =>
{
_studioInstance = Studio.Studio.IsInstance() ? Studio.Studio.Instance : null;
_soundInstance = Manager.Sound.Instance;
Expand All @@ -41,20 +41,24 @@ public static void Initialize()

_gameTimeText = null;

_openInInspectorButtons = new[]
CheatToolsWindow.OnShown += _ =>
{
new KeyValuePair<object, string>(_map != null && _map.AgentTable.Count > 0 ? (Func<object>) (() => _map.AgentTable.Values.Select(x => new ReadonlyCacheEntry(x.CharaName, x))) : null, "Heroine list"),
new KeyValuePair<object, string>(Manager.ADV.IsInstance() ? Manager.ADV.Instance : null, "Manager.ADV.Instance"),
new KeyValuePair<object, string>(AnimalManager.IsInstance() ? AnimalManager.Instance : null, "Manager.AnimalManager.Instance"),
new KeyValuePair<object, string>(_map, "Manager.Map.Instance"),
new KeyValuePair<object, string>(Character.IsInstance() ? Character.Instance : null, "Manager.Character.Instance"),
new KeyValuePair<object, string>(Config.IsInstance() ? Config.Instance : null, "Manager.Config.Instance"),
new KeyValuePair<object, string>(_gameMgr, "Manager.Game.Instance"),
new KeyValuePair<object, string>(Manager.Housing.IsInstance() ? Manager.Housing.Instance : null, "Manager.Housing.Instance"),
new KeyValuePair<object, string>(_sceneInstance, "Manager.Scene.Instance"),
new KeyValuePair<object, string>(_soundInstance, "Manager.Sound.Instance"),
new KeyValuePair<object, string>(_studioInstance, "Studio.Instance"),
new KeyValuePair<object, string>((Func<object>) EditorUtilities.GetRootGoScanner, "Root Objects")
_openInInspectorButtons = new[]
{
new KeyValuePair<object, string>(_map != null && _map.AgentTable.Count > 0 ? (Func<object>)(() => _map.AgentTable.Values.Select(x => new ReadonlyCacheEntry(x.CharaName, x))) : null,
"Heroine list"),
new KeyValuePair<object, string>(Manager.ADV.IsInstance() ? Manager.ADV.Instance : null, "Manager.ADV.Instance"),
new KeyValuePair<object, string>(AnimalManager.IsInstance() ? AnimalManager.Instance : null, "Manager.AnimalManager.Instance"),
new KeyValuePair<object, string>(_map, "Manager.Map.Instance"),
new KeyValuePair<object, string>(Character.IsInstance() ? Character.Instance : null, "Manager.Character.Instance"),
new KeyValuePair<object, string>(Config.IsInstance() ? Config.Instance : null, "Manager.Config.Instance"),
new KeyValuePair<object, string>(_gameMgr, "Manager.Game.Instance"),
new KeyValuePair<object, string>(Manager.Housing.IsInstance() ? Manager.Housing.Instance : null, "Manager.Housing.Instance"),
new KeyValuePair<object, string>(_sceneInstance, "Manager.Scene.Instance"),
new KeyValuePair<object, string>(_soundInstance, "Manager.Sound.Instance"),
new KeyValuePair<object, string>(_studioInstance, "Studio.Instance"),
new KeyValuePair<object, string>((Func<object>)EditorUtilities.GetRootGoScanner, "Root Objects")
};
};
};

Expand Down
2 changes: 1 addition & 1 deletion AI_CheatTools/Hooks/BuildAnywhereHooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static bool Enabled
_hInstance = Harmony.CreateAndPatchAll(typeof(BuildAnywhereHooks));
else
{
_hInstance.UnpatchAll(_hInstance.Id);
_hInstance.UnpatchSelf();
_hInstance = null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion AI_CheatTools/Hooks/BuildOverlapHooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static bool Enabled
_hInstance = Harmony.CreateAndPatchAll(typeof(BuildOverlapHooks));
else
{
_hInstance.UnpatchAll(_hInstance.Id);
_hInstance.UnpatchSelf();
_hInstance = null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion AI_CheatTools/Hooks/FishingHackHooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static bool Enabled
_hInstance = Harmony.CreateAndPatchAll(typeof(FishingHackHooks));
else
{
_hInstance.UnpatchAll(_hInstance.Id);
_hInstance.UnpatchSelf();
_hInstance = null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion AI_CheatTools/Hooks/UnlockCraftingHooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static bool Enabled
}
else
{
_hInstance.UnpatchAll(_hInstance.Id);
_hInstance.UnpatchSelf();
_hInstance = null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion AI_CheatTools/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
<package id="Mono.Cecil" version="0.11.4" targetFramework="net46" />
<package id="MonoMod.RuntimeDetour" version="21.11.1.1" targetFramework="net46" />
<package id="MonoMod.Utils" version="21.11.1.1" targetFramework="net46" />
<package id="RuntimeUnityEditor.Core" version="4.0.0" targetFramework="net46" developmentDependency="true" />
<package id="RuntimeUnityEditor.Core" version="4.0.0.1" targetFramework="net46" developmentDependency="true" />
<package id="Unity.InputSystem" version="1.5.0" targetFramework="net46" />
</packages>
30 changes: 17 additions & 13 deletions HS2_CheatTools/CheatToolsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal static string GetHeroineName(Heroine heroine)

public static void InitializeCheats()
{
CheatToolsWindow.OnShown = window =>
CheatToolsWindow.OnInitialize += window =>
{
_studioInstance = Studio.Studio.IsInstance() ? Studio.Studio.Instance : null;
_soundInstance = Manager.Sound.instance;
Expand All @@ -40,19 +40,23 @@ public static void InitializeCheats()
_baseMap = BaseMap.instance;
_hScene = HSceneFlagCtrl.IsInstance() ? HSceneFlagCtrl.Instance : null;

_openInInspectorButtons = new[]
CheatToolsWindow.OnShown += _ =>
{
new KeyValuePair<object, string>(_gameMgr != null && _gameMgr.heroineList.Count > 0 ? (Func<object>) (() => _gameMgr.heroineList.Select(x => new ReadonlyCacheEntry(GetHeroineName(x), x))) : null, "Heroine list"),
new KeyValuePair<object, string>(ADVManager.IsInstance() ? ADVManager.Instance : null, "Manager.ADVManager.Instance"),
new KeyValuePair<object, string>(_baseMap, "Manager.BaseMap.instance"),
new KeyValuePair<object, string>(Character.IsInstance() ? Character.Instance : null, "Manager.Character.Instance"),
new KeyValuePair<object, string>(typeof(Manager.Config), "Manager.Config"),
new KeyValuePair<object, string>(_gameMgr, "Manager.Game.Instance"),
new KeyValuePair<object, string>(GameSystem.IsInstance() ? GameSystem.Instance : null, "Manager.GameSystem.Instance"),
new KeyValuePair<object, string>(_sceneInstance, "Manager.Scene.instance"),
new KeyValuePair<object, string>(_soundInstance, "Manager.Sound.instance"),
new KeyValuePair<object, string>(_studioInstance, "Studio.Instance"),
new KeyValuePair<object, string>((Func<object>) EditorUtilities.GetRootGoScanner, "Root Objects")
_openInInspectorButtons = new[]
{
new KeyValuePair<object, string>(
_gameMgr != null && _gameMgr.heroineList.Count > 0 ? (Func<object>)(() => _gameMgr.heroineList.Select(x => new ReadonlyCacheEntry(GetHeroineName(x), x))) : null, "Heroine list"),
new KeyValuePair<object, string>(ADVManager.IsInstance() ? ADVManager.Instance : null, "Manager.ADVManager.Instance"),
new KeyValuePair<object, string>(_baseMap, "Manager.BaseMap.instance"),
new KeyValuePair<object, string>(Character.IsInstance() ? Character.Instance : null, "Manager.Character.Instance"),
new KeyValuePair<object, string>(typeof(Manager.Config), "Manager.Config"),
new KeyValuePair<object, string>(_gameMgr, "Manager.Game.Instance"),
new KeyValuePair<object, string>(GameSystem.IsInstance() ? GameSystem.Instance : null, "Manager.GameSystem.Instance"),
new KeyValuePair<object, string>(_sceneInstance, "Manager.Scene.instance"),
new KeyValuePair<object, string>(_soundInstance, "Manager.Sound.instance"),
new KeyValuePair<object, string>(_studioInstance, "Studio.Instance"),
new KeyValuePair<object, string>((Func<object>)EditorUtilities.GetRootGoScanner, "Root Objects")
};
};
};

Expand Down
4 changes: 2 additions & 2 deletions HS2_CheatTools/HS2_CheatTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
<HintPath>..\packages\IllusionLibs.BepInEx.MonoMod.21.8.5.1\lib\net35\MonoMod.Utils.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RuntimeUnityEditor.Core, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RuntimeUnityEditor.Core.4.0.0\lib\net35\RuntimeUnityEditor.Core.dll</HintPath>
<Reference Include="RuntimeUnityEditor.Core, Version=4.0.0.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RuntimeUnityEditor.Core.4.0.0.1\lib\net35\RuntimeUnityEditor.Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Sirenix.Serialization, Version=2.0.13.0, Culture=neutral, processorArchitecture=MSIL">
Expand Down
2 changes: 1 addition & 1 deletion HS2_CheatTools/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
<package id="Mono.Cecil" version="0.11.4" targetFramework="net46" />
<package id="MonoMod.RuntimeDetour" version="21.11.1.1" targetFramework="net46" />
<package id="MonoMod.Utils" version="21.11.1.1" targetFramework="net46" />
<package id="RuntimeUnityEditor.Core" version="4.0.0" targetFramework="net46" developmentDependency="true" />
<package id="RuntimeUnityEditor.Core" version="4.0.0.1" targetFramework="net46" developmentDependency="true" />
<package id="Unity.InputSystem" version="1.5.0" targetFramework="net46" />
</packages>
24 changes: 14 additions & 10 deletions KKS_CheatTools/CheatToolsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static class CheatToolsWindowInit

public static void InitializeCheats()
{
CheatToolsWindow.OnShown = window =>
CheatToolsWindow.OnInitialize += window =>
{
_hFlag = Object.FindObjectOfType<HFlag>();
_talkScene = Object.FindObjectOfType<TalkScene>();
Expand All @@ -87,16 +87,20 @@ public static void InitializeCheats()
_sceneInstance = Scene.instance;
_gameMgr = Game.instance;

_openInInspectorButtons = new[]
CheatToolsWindow.OnShown += _ =>
{
new KeyValuePair<object, string>(_gameMgr != null && Game.HeroineList.Count > 0 ? (Func<object>) (() => Game.HeroineList.Select(x => new ReadonlyCacheEntry(x.ChaName, x))) : null, "Heroine list"),
new KeyValuePair<object, string>(_gameMgr, "Manager.Game.Instance"),
new KeyValuePair<object, string>(_sceneInstance, "Manager.Scene.Instance"),
new KeyValuePair<object, string>(_soundInstance, "Manager.Sound.instance"),
new KeyValuePair<object, string>(_hFlag, "HFlag"),
new KeyValuePair<object, string>(_talkScene, "TalkScene"),
new KeyValuePair<object, string>(_studioInstance, "Studio.Instance"),
new KeyValuePair<object, string>((Func<object>) EditorUtilities.GetRootGoScanner, "Root Objects")
_openInInspectorButtons = new[]
{
new KeyValuePair<object, string>(_gameMgr != null && Game.HeroineList.Count > 0 ? (Func<object>)(() => Game.HeroineList.Select(x => new ReadonlyCacheEntry(x.ChaName, x))) : null,
"Heroine list"),
new KeyValuePair<object, string>(_gameMgr, "Manager.Game.Instance"),
new KeyValuePair<object, string>(_sceneInstance, "Manager.Scene.Instance"),
new KeyValuePair<object, string>(_soundInstance, "Manager.Sound.instance"),
new KeyValuePair<object, string>(_hFlag, "HFlag"),
new KeyValuePair<object, string>(_talkScene, "TalkScene"),
new KeyValuePair<object, string>(_studioInstance, "Studio.Instance"),
new KeyValuePair<object, string>((Func<object>)EditorUtilities.GetRootGoScanner, "Root Objects")
};
};
};

Expand Down
4 changes: 2 additions & 2 deletions KKS_CheatTools/KKS_CheatTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
<HintPath>..\packages\IllusionLibs.BepInEx.MonoMod.21.8.5.1\lib\net35\MonoMod.Utils.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RuntimeUnityEditor.Core, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RuntimeUnityEditor.Core.4.0.0\lib\net35\RuntimeUnityEditor.Core.dll</HintPath>
<Reference Include="RuntimeUnityEditor.Core, Version=4.0.0.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RuntimeUnityEditor.Core.4.0.0.1\lib\net35\RuntimeUnityEditor.Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Sirenix.Serialization, Version=2.1.13.0, Culture=neutral, processorArchitecture=MSIL">
Expand Down
2 changes: 1 addition & 1 deletion KKS_CheatTools/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
<package id="Mono.Cecil" version="0.11.4" targetFramework="net46" />
<package id="MonoMod.RuntimeDetour" version="21.11.1.1" targetFramework="net46" />
<package id="MonoMod.Utils" version="21.11.1.1" targetFramework="net46" />
<package id="RuntimeUnityEditor.Core" version="4.0.0" targetFramework="net46" developmentDependency="true" />
<package id="RuntimeUnityEditor.Core" version="4.0.0.1" targetFramework="net46" developmentDependency="true" />
<package id="Unity.InputSystem" version="1.5.0" targetFramework="net46" />
</packages>
26 changes: 15 additions & 11 deletions KK_CheatTools/CheatToolsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static class CheatToolsWindowInit

public static void InitializeCheats()
{
CheatToolsWindow.OnShown = window =>
CheatToolsWindow.OnInitialize += window =>
{
_hFlag = Object.FindObjectOfType<HFlag>();
_talkScene = Object.FindObjectOfType<TalkScene>();
Expand All @@ -47,17 +47,21 @@ public static void InitializeCheats()
_sceneInstance = Scene.Instance;
_gameMgr = Game.Instance;

_openInInspectorButtons = new[]
CheatToolsWindow.OnShown += _ =>
{
new KeyValuePair<object, string>(_gameMgr != null && _gameMgr.HeroineList.Count > 0 ? (Func<object>) (() => _gameMgr.HeroineList.Select(x => new ReadonlyCacheEntry(x.ChaName, x))) : null, "Heroine list"),
new KeyValuePair<object, string>(_gameMgr, "Manager.Game.Instance"),
new KeyValuePair<object, string>(_sceneInstance, "Manager.Scene.Instance"),
new KeyValuePair<object, string>(_communicationInstance, "Manager.Communication.Instance"),
new KeyValuePair<object, string>(_soundInstance, "Manager.Sound.Instance"),
new KeyValuePair<object, string>(_hFlag, "HFlag"),
new KeyValuePair<object, string>(_talkScene, "TalkScene"),
new KeyValuePair<object, string>(_studioInstance, "Studio.Instance"),
new KeyValuePair<object, string>((Func<object>) EditorUtilities.GetRootGoScanner, "Root Objects")
_openInInspectorButtons = new[]
{
new KeyValuePair<object, string>(_gameMgr != null && _gameMgr.HeroineList.Count > 0 ? (Func<object>)(() => _gameMgr.HeroineList.Select(x => new ReadonlyCacheEntry(x.ChaName, x))) : null,
"Heroine list"),
new KeyValuePair<object, string>(_gameMgr, "Manager.Game.Instance"),
new KeyValuePair<object, string>(_sceneInstance, "Manager.Scene.Instance"),
new KeyValuePair<object, string>(_communicationInstance, "Manager.Communication.Instance"),
new KeyValuePair<object, string>(_soundInstance, "Manager.Sound.Instance"),
new KeyValuePair<object, string>(_hFlag, "HFlag"),
new KeyValuePair<object, string>(_talkScene, "TalkScene"),
new KeyValuePair<object, string>(_studioInstance, "Studio.Instance"),
new KeyValuePair<object, string>((Func<object>)EditorUtilities.GetRootGoScanner, "Root Objects")
};
};
};

Expand Down
4 changes: 2 additions & 2 deletions KK_CheatTools/KK_CheatTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
<HintPath>..\packages\IllusionLibs.BepInEx.MonoMod.21.8.5.1\lib\net35\MonoMod.Utils.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RuntimeUnityEditor.Core, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RuntimeUnityEditor.Core.4.0.0\lib\net35\RuntimeUnityEditor.Core.dll</HintPath>
<Reference Include="RuntimeUnityEditor.Core, Version=4.0.0.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RuntimeUnityEditor.Core.4.0.0.1\lib\net35\RuntimeUnityEditor.Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion KK_CheatTools/UnlockPositionsHooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static bool Enabled
}
else
{
_hInstance.UnpatchAll(_hInstance.Id);
_hInstance.UnpatchSelf();
_hInstance = null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion KK_CheatTools/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
<package id="Mono.Cecil" version="0.10.4" targetFramework="net35" />
<package id="MonoMod.RuntimeDetour" version="21.11.1.1" targetFramework="net35" />
<package id="MonoMod.Utils" version="21.11.1.1" targetFramework="net35" />
<package id="RuntimeUnityEditor.Core" version="4.0.0" targetFramework="net35" developmentDependency="true" />
<package id="RuntimeUnityEditor.Core" version="4.0.0.1" targetFramework="net35" developmentDependency="true" />
<package id="Unity.InputSystem" version="1.5.0" targetFramework="net35" />
</packages>
Loading

0 comments on commit 444c779

Please sign in to comment.