-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTopMenu.cs
More file actions
114 lines (106 loc) · 5.09 KB
/
TopMenu.cs
File metadata and controls
114 lines (106 loc) · 5.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
using HarmonyLib;
using Develop;
using TMPro;
using BepInEx;
namespace aitsf2fix;
public class TopMenu {
public static bool aging_active = false;
public static bool debug_active = false;
// public static DevelopManager Instance = null;
// public static Game.RootManager rooti = null;
// public static TextMeshProUGUI fpstext = null;
// [HarmonyPatch(typeof(Game.RootManager), nameof(Game.RootManager.Awake))]
// [HarmonyPostfix]
// public static void RootAwake(Game.RootManager __instance) {
// rooti = __instance;
// }
[HarmonyPatch(typeof(DevelopManager), nameof(DevelopManager.Awake))]
[HarmonyPostfix]
public static void Awake(DevelopManager __instance) {
// Hide the shitter
UnityEngine.GameObject.Find("_root/#Canvas/SafeArea/InGameMenu/RightPane/Windows/EventCall").SetActive(false);
// In post all static stuff should be set...
// Utter retardation idk how to cast in this language
// Instance = __instance;
__instance.topMenuButton.onPointerClick += new System.Action<UnityEngine.EventSystems.PointerEventData>((e) => {
SDevelopManager.Instance.ShowMenu();
});
__instance.debugInfoButton.onPointerClick += new System.Action<UnityEngine.EventSystems.PointerEventData>((e) => {
debug_active = !debug_active;
// I can't get normal to work so I am recreating it...
DevelopSaveData.develop.display = debug_active;
// AAAAAAAAAAAAAAAAAAaaaaaaaaaaaaaaaaaaaaaaaa
(new DevelopManager(SDevelopManager.Instance.Pointer)).inGameMenu.SetActive(debug_active);
});
__instance.motionButton.onPointerClick += new System.Action<UnityEngine.EventSystems.PointerEventData>((e) => {
SDevelopManager.Instance.ToggleMotion();
});
__instance.agingButton.onPointerClick += new System.Action<UnityEngine.EventSystems.PointerEventData>((e) => {
// ???
aging_active = !aging_active;
Game.SAgingManager.Instance.SetActive(aging_active);
});
__instance.resetButton.onPointerClick += new System.Action<UnityEngine.EventSystems.PointerEventData>((e) => {
// This barely works tbh...
SDevelopManager.Instance.Reset();
// Maybe this?
// This resets Static BGViewer or something like that
// Game.RootManager.StaticReset();
(new Game.RootManager(Game.SRootManager.Instance.Pointer)).Restart();
});
__instance.saveLoadButton.onPointerClick += new System.Action<UnityEngine.EventSystems.PointerEventData>((e) => {
// ???
// This is joystick input related
// Instance.SaveLoadKey();
var i = new DevelopManager(SDevelopManager.Instance.Pointer);
Game.SSaveDataManager.Instance.Save(i.saveloadMode.ToString());
Game.SSaveDataManager.Instance.Load(i.saveloadMode.ToString());
});
for(var i = 0; i<5; i++) {
__instance.saveButtons[i].onPointerClick += new System.Action<UnityEngine.EventSystems.PointerEventData>((e) => {
Game.SSaveDataManager.Instance.Save(i.ToString());
});
__instance.loadButtons[i].onPointerClick += new System.Action<UnityEngine.EventSystems.PointerEventData>((e) => {
Game.SSaveDataManager.Instance.Load(i.ToString());
});
}
__instance.menuButton.onPointerClick += new System.Action<UnityEngine.EventSystems.PointerEventData>((e) => {
// TODO: blergh?
// (new Game.RootManager(Game.SRootManager.Instance.Pointer)).JumpTitle();
// This should be more correct?
var i = new DevelopManager(SDevelopManager.Instance.Pointer);
var c = i.developCanvasGroup;
if (c.alpha != 1) {
c.alpha = 1;
c.blocksRaycasts = true;
} else {
c.alpha = 0;
c.blocksRaycasts = false;
}
});
// fpstext = UnityEngine.GameObject.Find("_root/#Canvas/SafeArea/TopButtons/FPS/Text").GetComponent<TextMeshProUGUI>();
// Plugin.logger.LogInfo(fpstext);
}
// Dead locks the game after a while...
// UniFPSCounter doesn't have anything other than a constructor redefined...
[HarmonyPatch(typeof(Game.RootManager), nameof(Game.RootManager.Update))]
[HarmonyPostfix]
public static void Update() {
// try {
// if (fpstext)
// fpstext.SetText((1.0f/UnityEngine.Time.unscaledDeltaTime).ToString("F1"), true);
// } catch {
// try {
// fpstext = UnityEngine.GameObject.Find("_root/#Canvas/SafeArea/TopButtons/FPS/Text").GetComponent<TextMeshProUGUI>();
// } catch {}
// }
if(FlagViewerFix.dirty_flag) {
if (FlagViewerFix.Instance) {
if (FlagViewerFix.Instance.enabled && FlagViewerFix.Instance.gameObject.active) {
FlagViewerFix.dirty_flag = false;
FlagViewerFix.hkReload();
}
}
}
}
}