-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettings.cs
More file actions
95 lines (82 loc) · 2.69 KB
/
Copy pathSettings.cs
File metadata and controls
95 lines (82 loc) · 2.69 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
using UnityEngine;
using UnityModManagerNet;
using static UnityModManagerNet.UnityModManager;
namespace DamageUI
{
public class Settings : ModSettings, IDrawable
{
readonly static Color Brown = new Color(0.75f, 0.5f, 0.25f);
public enum ColorTag
{
White,
Grey,
Black,
Red,
Green,
Blue,
Yellow,
Magenta,
Cyan,
Brown
}
[Draw(DrawType.Auto)]
public ColorTag goodColor = ColorTag.Green;
[Draw(DrawType.Auto)]
public ColorTag badColor = ColorTag.Red;
[Draw(DrawType.Slider, Min = -1, Max = 1, Precision = 3)]
public float xPositionPercent = -0.6f;
[Draw(DrawType.Slider, Min = 0, Max = 1, Precision = 3)]
public float yPositionPercent = 0.1f;
[Draw(DrawType.Slider, Min = 0.1f, Max = 1f, Precision = 2)]
public float uiScale = 0.35f;
[Header("Debug")]
[Draw(DrawType.Toggle)]
public bool disableInfoLogs = true;
public override void Save(ModEntry modEntry) => Save(this, modEntry);
public void OnChange() => DamagePanel.Refresh();
public void OnGUI()
{
if (GUILayout.Button("Reset settings", GUILayout.Width(200)))
{
goodColor = ColorTag.Green;
badColor = ColorTag.Red;
xPositionPercent = -0.6f;
yPositionPercent = 0.1f;
uiScale = 0.35f;
OnChange();
}
}
public static Color GetColor(ColorTag tag)
{
switch (tag)
{
case ColorTag.White:
return Color.white;
case ColorTag.Grey:
return Color.grey;
case ColorTag.Black:
return Color.black;
case ColorTag.Red:
return Color.red;
case ColorTag.Green:
return Color.green;
case ColorTag.Blue:
return Color.blue;
case ColorTag.Yellow:
return Color.yellow;
case ColorTag.Magenta:
return Color.magenta;
case ColorTag.Cyan:
return Color.cyan;
case ColorTag.Brown:
return Brown;
default:
return Color.clear;
}
}
public static Vector2 GetUIPosition()
{
return new Vector2(Main.settings.xPositionPercent * Screen.width / 2, Main.settings.yPositionPercent * Screen.height);
}
}
}