-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDebugMenu.cs
More file actions
91 lines (67 loc) · 2.99 KB
/
DebugMenu.cs
File metadata and controls
91 lines (67 loc) · 2.99 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
using GreenHellVR_Core.UI;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
#pragma warning disable CS0436 // Type conflicts with imported type
namespace GreenHellVR_Core
{
public class DebugMenu : MonoBehaviour
{
GameObject PanelGO;
public Canvas canvas;
Transform playerTransform;
//Dictionary<string, OptionTypes, object> options = [];
[Header("Variables")]
TextMeshProUGUI coords;
TextMeshProUGUI rot;
// Use this for initialization
void Start()
{
playerTransform = Player.Get().transform;
Logger.Log("Debug Menu at " + transform.position.ToString());
}
public static GameObject ConstructPanel()
{
GameObject PanelGO = GHVRC_UI.CreateCanvas(out Canvas canvas, Player.Get().GetHeadTransform());
DebugMenu debug = PanelGO.AddComponent<DebugMenu>();
debug.PanelGO = PanelGO;
debug.canvas = canvas;
VerticalLayoutGroup group = PanelGO.AddComponent<VerticalLayoutGroup>();
group.padding = new RectOffset(25, 25, 25, 25);
group.spacing = 10f;
group.childForceExpandHeight = false;
group.childForceExpandWidth = false;
// Adding Transform
GHVRC_UI.CreateText("Player pos :", out TextMeshProUGUI coordsComp, PanelGO.transform);
debug.coords = coordsComp;
GHVRC_UI.CreateText("Player rot :", out TextMeshProUGUI rotComp, PanelGO.transform);
debug.rot = rotComp;
return Instantiate(PanelGO);
}
public static GameObject ConstructPanel(out DebugMenu debug)
{
GameObject PanelGO = GHVRC_UI.CreateCanvas(out Canvas canvas, Player.Get().GetHeadTransform());
debug = PanelGO.AddComponent<DebugMenu>();
debug.PanelGO = PanelGO;
debug.canvas = canvas;
VerticalLayoutGroup group = PanelGO.AddComponent<VerticalLayoutGroup>();
group.padding = new(25, 25, 25, 25);
group.spacing = 10f;
group.childForceExpandHeight = false;
group.childForceExpandWidth = false;
// Adding Transform
GHVRC_UI.CreateText("Player pos :", out TextMeshProUGUI coordsComp, PanelGO.transform);
debug.coords = coordsComp;
GHVRC_UI.CreateText("Player rot :", out TextMeshProUGUI rotComp, PanelGO.transform);
debug.rot = rotComp;
return Instantiate(PanelGO);
}
// Update is called once per frame
void Update()
{
coords.text = $"Player coords :\nx: {playerTransform.position.x} | y: {playerTransform.position.y} | z: {playerTransform.position.z}";
rot.text = $"Player rotation :\nx: {playerTransform.rotation.x} | y: {playerTransform.rotation.y} | z: {playerTransform.rotation.z}";
transform.position = playerTransform.position + playerTransform.forward.normalized * 0.1f;
}
}
}