This repository was archived by the owner on May 9, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 513
Expand file tree
/
Copy pathHookManagerPanel.cs
More file actions
104 lines (81 loc) · 3.7 KB
/
HookManagerPanel.cs
File metadata and controls
104 lines (81 loc) · 3.7 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
using UnityExplorer.Hooks;
using UnityExplorer.UI.Widgets;
using UniverseLib.UI;
namespace UnityExplorer.UI.Panels
{
public class HookManagerPanel : UEPanel
{
public static HookManagerPanel Instance { get; private set; }
public enum Pages
{
ClassMethodSelector,
HookSourceEditor,
GenericArgsSelector,
}
public static HookCreator hookCreator;
public static HookList hookList;
public static GenericConstructorWidget genericArgsHandler;
// Panel
public override UIManager.Panels PanelType => UIManager.Panels.HookManager;
public override string Name => "Hooks";
public override bool ShowByDefault => false;
public override int MinWidth => 400;
public override int MinHeight => 400;
public override Vector2 DefaultAnchorMin => new(0.5f, 0.5f);
public override Vector2 DefaultAnchorMax => new(0.5f, 0.5f);
public Pages CurrentPage { get; private set; } = Pages.ClassMethodSelector;
public HookManagerPanel(UIBase owner) : base(owner)
{
}
public void SetPage(Pages page)
{
switch (page)
{
case Pages.ClassMethodSelector:
HookCreator.AddHooksRoot.SetActive(true);
HookCreator.EditorRoot.SetActive(false);
genericArgsHandler.UIRoot.SetActive(false);
break;
case Pages.HookSourceEditor:
HookCreator.AddHooksRoot.SetActive(false);
HookCreator.EditorRoot.SetActive(true);
genericArgsHandler.UIRoot.SetActive(false);
break;
case Pages.GenericArgsSelector:
HookCreator.AddHooksRoot.SetActive(false);
HookCreator.EditorRoot.SetActive(false);
genericArgsHandler.UIRoot.SetActive(true);
break;
}
}
public override void SetDefaultSizeAndPosition()
{
base.SetDefaultSizeAndPosition();
this.Rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, MinWidth);
this.Rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, MinHeight);
}
protected override void ConstructPanelContent()
{
Instance = this;
hookList = new();
hookCreator = new();
genericArgsHandler = new();
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(ContentRoot, true, false);
// GameObject baseHoriGroup = UIFactory.CreateHorizontalGroup(ContentRoot, "HoriGroup", true, true, true, true);
// UIFactory.SetLayoutElement(baseHoriGroup, flexibleWidth: 9999, flexibleHeight: 9999);
// // Left Group
//GameObject leftGroup = UIFactory.CreateVerticalGroup(ContentRoot, "LeftGroup", true, true, true, true);
UIFactory.SetLayoutElement(ContentRoot.gameObject, minWidth: 300, flexibleWidth: 9999, flexibleHeight: 9999);
hookList.ConstructUI(ContentRoot);
// // Right Group
//GameObject rightGroup = UIFactory.CreateVerticalGroup(ContentRoot, "RightGroup", true, true, true, true);
UIFactory.SetLayoutElement(ContentRoot, minWidth: 300, flexibleWidth: 9999, flexibleHeight: 9999);
hookCreator.ConstructAddHooksView(ContentRoot);
hookCreator.ConstructEditor(ContentRoot);
HookCreator.EditorRoot.SetActive(false);
genericArgsHandler.ConstructUI(ContentRoot);
genericArgsHandler.UIRoot.SetActive(false);
hookCreator.LoadSavedHooks();
}
}
}