-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMODMenuCommon.cs
78 lines (67 loc) · 2.65 KB
/
MODMenuCommon.cs
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
using Assets.Scripts.Core.Buriko;
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
namespace MOD.Scripts.UI
{
static class MODMenuCommon
{
public static bool anyButtonPressed;
public static void Label(string label, params GUILayoutOption[] options)
{
GUILayout.Label(label, MODStyleManager.OnGUIInstance.Group.label, options);
}
public static void LabelRightAlign(string label, params GUILayoutOption[] options)
{
GUILayout.Label(label, MODStyleManager.OnGUIInstance.Group.labelRightAlign, options);
}
public static void Label(GUIContent content, params GUILayoutOption[] options)
{
GUILayout.Label(content, MODStyleManager.OnGUIInstance.Group.label, options);
}
public static void SelectableLabel(string label, params GUILayoutOption[] options)
{
GUILayout.TextArea(label, MODStyleManager.OnGUIInstance.Group.label, options);
}
public static void HeadingLabel(string label, bool alignLeft = false, params GUILayoutOption[] options)
{
GUILayout.Label(label, alignLeft ? MODStyleManager.OnGUIInstance.Group.upperLeftHeadingLabel : MODStyleManager.OnGUIInstance.Group.headingLabel, options);
}
public static bool ButtonNoExpandWithPadding(string label, bool selected = false)
{
return Button(new GUIContent($" {label} "), selected, false, GUILayout.ExpandWidth(false));
}
public static bool Button(string label, bool selected = false, bool stlyeAsLabel = false, params GUILayoutOption[] options)
{
return Button(new GUIContent(label), selected, stlyeAsLabel, options);
}
public static bool Button(GUIContent guiContent, bool selected = false, bool stlyeAsLabel = false, params GUILayoutOption[] options)
{
GUIStyle style = selected ? MODStyleManager.OnGUIInstance.Group.selectedButton : MODStyleManager.OnGUIInstance.Group.button;
if(stlyeAsLabel)
{
style = MODStyleManager.OnGUIInstance.Group.label;
}
if (GUILayout.Button(guiContent, style, options))
{
anyButtonPressed = true;
return true;
}
else
{
return false;
}
}
public static string TextField(string text, params GUILayoutOption[] options)
{
return GUILayout.TextField(text, MODStyleManager.OnGUIInstance.Group.textField, options);
}
public static string TextField(string text, int maxLength, params GUILayoutOption[] options)
{
return GUILayout.TextField(text, maxLength, MODStyleManager.OnGUIInstance.Group.textField, options);
}
public static int GetGlobal(string flagName) => BurikoMemory.Instance.GetGlobalFlag(flagName).IntValue();
public static void SetGlobal(string flagName, int flagValue) => BurikoMemory.Instance.SetGlobalFlag(flagName, flagValue);
}
}