Skip to content

Commit

Permalink
Resolve compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ManlyMarco committed Nov 11, 2022
1 parent 8ce230f commit 606e540
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 49 deletions.
18 changes: 10 additions & 8 deletions AI_CheatTools/CheatToolsWindow.cs
Expand Up @@ -5,7 +5,9 @@
using AIProject.Definitions;
using AIProject.SaveData;
using Manager;
using RuntimeUnityEditor.Core.Inspector;
using RuntimeUnityEditor.Core.Inspector.Entries;
using RuntimeUnityEditor.Core.ObjectTree;
using RuntimeUnityEditor.Core.Utils;
using UnityEngine;
using Map = Manager.Map;
Expand Down Expand Up @@ -167,14 +169,14 @@ private static void DrawPlayerCheats(CheatToolsWindow cheatToolsWindow)
if (GUILayout.Button("Navigate to Player's GameObject"))
{
if (_map.Player.transform != null)
cheatToolsWindow.Editor.TreeViewer.SelectAndShowObject(_map.Player.transform);
ObjectTreeViewer.Instance.SelectAndShowObject(_map.Player.transform);
else
CheatToolsPlugin.Logger.Log(BepInEx.Logging.LogLevel.Warning | BepInEx.Logging.LogLevel.Message,
"Player has no body assigned");
}

if (GUILayout.Button("Open Player in inspector"))
cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(_map.Player, "Player"), true);
Inspector.Instance.Push(new InstanceStackEntry(_map.Player, "Player"), true);
}

private static void DrawEnviroControls(CheatToolsWindow cheatToolsWindow)
Expand Down Expand Up @@ -252,7 +254,7 @@ private static void DrawHSceneCheats(CheatToolsWindow cheatToolsWindow)
GUILayout.EndHorizontal();

if (GUILayout.Button("Open HScene Flags in inspector"))
cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(_hScene, "HSceneFlagCtrl"), true);
Inspector.Instance.Push(new InstanceStackEntry(_hScene, "HSceneFlagCtrl"), true);
}

private static void DrawGirlCheatMenu(CheatToolsWindow cheatToolsWindow)
Expand All @@ -270,12 +272,12 @@ private static void DrawGirlCheatMenu(CheatToolsWindow cheatToolsWindow)
GUILayout.Space(6);

if (_currentVisibleGirl != null)
DrawSingleGirlCheats(_currentVisibleGirl, cheatToolsWindow);
DrawSingleGirlCheats(_currentVisibleGirl);
else
GUILayout.Label("Select a heroine to access her stats");
}

private static void DrawSingleGirlCheats(AgentActor currentAdvGirl, CheatToolsWindow cheatToolsWindow)
private static void DrawSingleGirlCheats(AgentActor currentAdvGirl)
{
GUILayout.BeginVertical(GUI.skin.box);
{
Expand Down Expand Up @@ -359,17 +361,17 @@ private static void DrawSingleGirlCheats(AgentActor currentAdvGirl, CheatToolsWi
if (GUILayout.Button("Navigate to Actor's GameObject"))
{
if (currentAdvGirl.transform != null)
cheatToolsWindow.Editor.TreeViewer.SelectAndShowObject(currentAdvGirl.transform);
ObjectTreeViewer.Instance.SelectAndShowObject(currentAdvGirl.transform);
else
CheatToolsPlugin.Logger.Log(BepInEx.Logging.LogLevel.Warning | BepInEx.Logging.LogLevel.Message, "Actor has no body assigned");
}

if (GUILayout.Button("Open Actor in inspector"))
cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(currentAdvGirl, "Actor " + currentAdvGirl.CharaName), true);
Inspector.Instance.Push(new InstanceStackEntry(currentAdvGirl, "Actor " + currentAdvGirl.CharaName), true);

if (GUILayout.Button("Inspect extended data"))
{
cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(ExtensibleSaveFormat.ExtendedSave.GetAllExtendedData(currentAdvGirl.ChaControl?.chaFile), "ExtData for " + currentAdvGirl.CharaName), true);
Inspector.Instance.Push(new InstanceStackEntry(ExtensibleSaveFormat.ExtendedSave.GetAllExtendedData(currentAdvGirl.ChaControl?.chaFile), "ExtData for " + currentAdvGirl.CharaName), true);
}
}
GUILayout.EndVertical();
Expand Down
16 changes: 9 additions & 7 deletions HS2_CheatTools/CheatToolsWindow.cs
Expand Up @@ -4,7 +4,9 @@
using Actor;
using AIChara;
using Manager;
using RuntimeUnityEditor.Core.Inspector;
using RuntimeUnityEditor.Core.Inspector.Entries;
using RuntimeUnityEditor.Core.ObjectTree;
using RuntimeUnityEditor.Core.Utils;
using UnityEngine;
using LogLevel = BepInEx.Logging.LogLevel;
Expand Down Expand Up @@ -110,7 +112,7 @@ private static void DrawHSceneCheats(CheatToolsWindow cheatToolsWindow)
GUILayout.EndHorizontal();

if (GUILayout.Button("Open HScene Flags in inspector"))
cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(_hScene, "HSceneFlagCtrl"), true);
Inspector.Instance.Push(new InstanceStackEntry(_hScene, "HSceneFlagCtrl"), true);
}

private static void DrawGirlCheatMenu(CheatToolsWindow cheatToolsWindow)
Expand All @@ -132,12 +134,12 @@ private static void DrawGirlCheatMenu(CheatToolsWindow cheatToolsWindow)
}

if (_currentVisibleGirl != null)
DrawSingleGirlCheats(_currentVisibleGirl, cheatToolsWindow);
DrawSingleGirlCheats(_currentVisibleGirl);
else
GUILayout.Label("Select a character to edit their stats");
}

private static void DrawSingleGirlCheats(Heroine currentAdvGirl, CheatToolsWindow cheatToolsWindow)
private static void DrawSingleGirlCheats(Heroine currentAdvGirl)
{
GUILayout.BeginVertical(GUI.skin.box);
{
Expand Down Expand Up @@ -240,25 +242,25 @@ void ShowSingleTextfield(string name, Action<int> set, Func<int> get)
_onGirlStatsChanged(_currentVisibleGirl);

if (GUILayout.Button("View more stats and flags"))
cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(gi2, "Heroine " + GetHeroineName(currentAdvGirl)), true);
Inspector.Instance.Push(new InstanceStackEntry(gi2, "Heroine " + GetHeroineName(currentAdvGirl)), true);
}

GUILayout.Space(6);

if (GUILayout.Button("Navigate to Heroine's GameObject"))
{
if (currentAdvGirl.transform != null)
cheatToolsWindow.Editor.TreeViewer.SelectAndShowObject(currentAdvGirl.transform);
ObjectTreeViewer.Instance.SelectAndShowObject(currentAdvGirl.transform);
else
CheatToolsPlugin.Logger.Log(LogLevel.Warning | LogLevel.Message, "Heroine has no body assigned");
}

if (GUILayout.Button("Open Heroine in inspector"))
cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(currentAdvGirl, "Heroine " + GetHeroineName(currentAdvGirl)), true);
Inspector.Instance.Push(new InstanceStackEntry(currentAdvGirl, "Heroine " + GetHeroineName(currentAdvGirl)), true);

if (GUILayout.Button("Inspect extended data"))
{
cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(ExtensibleSaveFormat.ExtendedSave.GetAllExtendedData(currentAdvGirl.chaFile), "ExtData for " + currentAdvGirl.Name), true);
Inspector.Instance.Push(new InstanceStackEntry(ExtensibleSaveFormat.ExtendedSave.GetAllExtendedData(currentAdvGirl.chaFile), "ExtData for " + currentAdvGirl.Name), true);
}
}
GUILayout.EndVertical();
Expand Down
45 changes: 21 additions & 24 deletions KKS_CheatTools/CheatToolsWindow.cs
@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using ActionGame;
using ActionGame.Chara;
using ADV;
using Illusion.Component;
using Illusion.Game;
using Manager;
using RuntimeUnityEditor.Core.Inspector;
using RuntimeUnityEditor.Core.Inspector.Entries;
using RuntimeUnityEditor.Core.ObjectTree;
using RuntimeUnityEditor.Core.Utils;
using SaveData;
using UnityEngine;
Expand All @@ -19,7 +19,7 @@ namespace CheatTools
{
public static class CheatToolsWindowInit
{
private static SaveData.Heroine _currentVisibleGirl;
private static Heroine _currentVisibleGirl;
private static bool _showSelectHeroineList;

private static HFlag _hFlag;
Expand All @@ -35,8 +35,7 @@ public static class CheatToolsWindowInit
private static string _setdesireValue;
private static KeyValuePair<object, string>[] _openInInspectorButtons;

private static readonly string[] _prayerNames = new[]
{
private static readonly string[] _prayerNames = {
"Nothing",
"Topic drop bonus",
"Find more topics?",
Expand All @@ -51,8 +50,7 @@ public static class CheatToolsWindowInit
"Ask for sex bonus",
};

private static readonly int[] _prayerIds = new[]
{
private static readonly int[] _prayerIds = {
0,
1,
2,
Expand All @@ -67,8 +65,7 @@ public static class CheatToolsWindowInit
1003,
};

private static readonly string[] _relationNames = new[]
{
private static readonly string[] _relationNames = {
"Casual",
"Friend",
"Lover",
Expand Down Expand Up @@ -182,7 +179,7 @@ private static void DrawGirlCheatMenu(CheatToolsWindow cheatToolsWindow)
if (_currentVisibleGirl != null)
{
GUILayout.Space(6);
DrawHeroineCheats(_currentVisibleGirl, cheatToolsWindow);
DrawHeroineCheats(_currentVisibleGirl);
}
else
{
Expand Down Expand Up @@ -296,7 +293,7 @@ private static void DrawGirlCheatMenu(CheatToolsWindow cheatToolsWindow)
}
}

private static void DrawHeroineCheats(SaveData.Heroine currentAdvGirl, CheatToolsWindow cheatToolsWindow)
private static void DrawHeroineCheats(Heroine currentAdvGirl)
{
GUILayout.BeginVertical();
{
Expand Down Expand Up @@ -497,56 +494,56 @@ private static void DrawHeroineCheats(SaveData.Heroine currentAdvGirl, CheatTool
if (GUILayout.Button("Navigate to heroine's GameObject"))
{
if (currentAdvGirl.transform != null)
cheatToolsWindow.Editor.TreeViewer.SelectAndShowObject(currentAdvGirl.transform);
ObjectTreeViewer.Instance.SelectAndShowObject(currentAdvGirl.transform);
else
CheatToolsPlugin.Logger.Log(LogLevel.Warning | LogLevel.Message, "Heroine has no body assigned");
}

if (GUILayout.Button("Open Heroine in inspector"))
{
cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(currentAdvGirl, "Heroine " + currentAdvGirl.Name), true);
Inspector.Instance.Push(new InstanceStackEntry(currentAdvGirl, "Heroine " + currentAdvGirl.Name), true);
}

if (GUILayout.Button("Inspect extended data"))
{
cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(ExtensibleSaveFormat.ExtendedSave.GetAllExtendedData(currentAdvGirl.charFile), "ExtData for " + currentAdvGirl.Name), true);
Inspector.Instance.Push(new InstanceStackEntry(ExtensibleSaveFormat.ExtendedSave.GetAllExtendedData(currentAdvGirl.charFile), "ExtData for " + currentAdvGirl.Name), true);
}
}
GUILayout.EndVertical();
}

private static void MakeHorny(SaveData.Heroine currentAdvGirl)
private static void MakeHorny(Heroine currentAdvGirl)
{
currentAdvGirl.hCount = Mathf.Max(1, currentAdvGirl.hCount);
currentAdvGirl.isVirgin = false;
SetGirlHExp(currentAdvGirl, 100f);
currentAdvGirl.lewdness = 100;
}

private static void MakeExperienced(SaveData.Heroine currentAdvGirl)
private static void MakeExperienced(Heroine currentAdvGirl)
{
currentAdvGirl.hCount = Mathf.Max(1, currentAdvGirl.hCount);
currentAdvGirl.isVirgin = false;
SetGirlHExp(currentAdvGirl, 100f);
currentAdvGirl.lewdness = Mathf.Min(99, currentAdvGirl.lewdness);
}

private static void MakeInexperienced(SaveData.Heroine currentAdvGirl)
private static void MakeInexperienced(Heroine currentAdvGirl)
{
currentAdvGirl.hCount = Mathf.Max(1, currentAdvGirl.hCount);
currentAdvGirl.isVirgin = false;
currentAdvGirl.countKokanH = 50;
SetGirlHExp(currentAdvGirl, 0);
}

private static void MakeVirgin(SaveData.Heroine currentAdvGirl)
private static void MakeVirgin(Heroine currentAdvGirl)
{
currentAdvGirl.hCount = 0;
currentAdvGirl.isVirgin = true;
SetGirlHExp(currentAdvGirl, 0);
}

private static void SetGirlHExp(SaveData.Heroine girl, float amount)
private static void SetGirlHExp(Heroine girl, float amount)
{
girl.houshiExp = amount;
girl.countKokanH = amount;
Expand Down Expand Up @@ -653,7 +650,7 @@ private static void DrawPlayerCheats(CheatToolsWindow cheatToolsWindow)

if (GUILayout.Button("Open player data in inspector"))
{
cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(Game.saveData.player, "Player data"), true);
Inspector.Instance.Push(new InstanceStackEntry(Game.saveData.player, "Player data"), true);
}

GUILayout.BeginVertical(GUI.skin.box);
Expand All @@ -672,7 +669,7 @@ private static void DrawPlayerCheats(CheatToolsWindow cheatToolsWindow)
GUILayout.EndVertical();
}

private static SaveData.Heroine[] GetCurrentVisibleGirls()
private static Heroine[] GetCurrentVisibleGirls()
{
if (_talkScene != null)
{
Expand All @@ -697,10 +694,10 @@ private static SaveData.Heroine[] GetCurrentVisibleGirls()
return new[] { s.targetHeroine };
}

return new SaveData.Heroine[0];
return Array.Empty<Heroine>();
}

private static string GetHExpText(SaveData.Heroine currentAdvGirl)
private static string GetHExpText(Heroine currentAdvGirl)
{
return ((HExperienceKindEng)currentAdvGirl.HExperience).ToString();
}
Expand All @@ -711,7 +708,7 @@ private static int GetRelationSafe(Heroine heroine)
if (heroine.isGirlfriend)
{
// This check crashes outside of main game because it needs an instance
// todo turn this into an universal fix?
// todo turn this into a universal fix?
if (heroine.favor >= 150)
return 3;
return 2;
Expand Down
14 changes: 8 additions & 6 deletions KK_CheatTools/CheatToolsWindow.cs
Expand Up @@ -7,7 +7,9 @@
using Illusion.Component;
using Illusion.Game;
using Manager;
using RuntimeUnityEditor.Core.Inspector;
using RuntimeUnityEditor.Core.Inspector.Entries;
using RuntimeUnityEditor.Core.ObjectTree;
using RuntimeUnityEditor.Core.Utils;
using UnityEngine;
using LogLevel = BepInEx.Logging.LogLevel;
Expand Down Expand Up @@ -159,7 +161,7 @@ private static void DrawGirlCheatMenu(CheatToolsWindow cheatToolsWindow)
if (_currentVisibleGirl != null)
{
GUILayout.Space(6);
DrawHeroineCheats(_currentVisibleGirl, cheatToolsWindow);
DrawHeroineCheats(_currentVisibleGirl);
}
else
{
Expand Down Expand Up @@ -269,7 +271,7 @@ private static void DrawGirlCheatMenu(CheatToolsWindow cheatToolsWindow)
}
}

private static void DrawHeroineCheats(SaveData.Heroine currentAdvGirl, CheatToolsWindow cheatToolsWindow)
private static void DrawHeroineCheats(SaveData.Heroine currentAdvGirl)
{
GUILayout.BeginVertical();
{
Expand Down Expand Up @@ -486,19 +488,19 @@ private static void DrawHeroineCheats(SaveData.Heroine currentAdvGirl, CheatTool
if (GUILayout.Button("Navigate to heroine's GameObject"))
{
if (currentAdvGirl.transform != null)
cheatToolsWindow.Editor.TreeViewer.SelectAndShowObject(currentAdvGirl.transform);
ObjectTreeViewer.Instance.SelectAndShowObject(currentAdvGirl.transform);
else
CheatToolsPlugin.Logger.Log(LogLevel.Warning | LogLevel.Message, "Heroine has no body assigned");
}

if (GUILayout.Button("Open Heroine in inspector"))
{
cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(currentAdvGirl, "Heroine " + currentAdvGirl.Name), true);
Inspector.Instance.Push(new InstanceStackEntry(currentAdvGirl, "Heroine " + currentAdvGirl.Name), true);
}

if (GUILayout.Button("Inspect extended data"))
{
cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(ExtensibleSaveFormat.ExtendedSave.GetAllExtendedData(currentAdvGirl.charFile), "ExtData for " + currentAdvGirl.Name), true);
Inspector.Instance.Push(new InstanceStackEntry(ExtensibleSaveFormat.ExtendedSave.GetAllExtendedData(currentAdvGirl.charFile), "ExtData for " + currentAdvGirl.Name), true);
}
}
GUILayout.EndVertical();
Expand Down Expand Up @@ -650,7 +652,7 @@ private static void DrawPlayerCheats(CheatToolsWindow cheatToolsWindow)

if (GUILayout.Button("Open player data in inspector"))
{
cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(_gameMgr.saveData.player, "Player data"), true);
Inspector.Instance.Push(new InstanceStackEntry(_gameMgr.saveData.player, "Player data"), true);
}
}

Expand Down

0 comments on commit 606e540

Please sign in to comment.