forked from MintLily/VRChat-TeleporterVR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Menu.cs
108 lines (102 loc) · 4.55 KB
/
Menu.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
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
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TeleporterVR.Utils;
using UnityEngine;
using VRC;
using UnityEngine.UI;
using TeleporterVR.Logic;
using TeleporterVR.Rendering;
using System.Diagnostics;
namespace TeleporterVR
{
public class Menu
{
private static Vector3 Pos1, Pos2, Pos3, Pos4;
private static Quaternion Rot1, Rot2, Rot3, Rot4;
internal static void OpenWebpage(string site) => Process.Start("cmd", $"/C start {site}");
internal static void SaveAction(int slot)
{
switch (slot)
{
case 1:
Pos1 = PlayerActions.GetLocalVRCPlayer().transform.position;
Rot1 = PlayerActions.GetLocalVRCPlayer().transform.rotation;
break;
case 2:
Pos2 = PlayerActions.GetLocalVRCPlayer().transform.position;
Rot2 = PlayerActions.GetLocalVRCPlayer().transform.rotation;
break;
case 3:
Pos3 = PlayerActions.GetLocalVRCPlayer().transform.position;
Rot3 = PlayerActions.GetLocalVRCPlayer().transform.rotation;
break;
case 4:
Pos4 = PlayerActions.GetLocalVRCPlayer().transform.position;
Rot4 = PlayerActions.GetLocalVRCPlayer().transform.rotation;
break;
}
}
internal static void LoadAction(int slot)
{
switch (slot)
{
case 1:
if (Pos1 == null || Rot1 == null) return;
if (!WorldActions.WorldAllowed) return;
PlayerActions.GetLocalVRCPlayer().transform.position = Pos1;
PlayerActions.GetLocalVRCPlayer().transform.rotation = Rot1;
break;
case 2:
if (Pos2 == null || Rot2 == null) return;
if (!WorldActions.WorldAllowed) return;
PlayerActions.GetLocalVRCPlayer().transform.position = Pos2;
PlayerActions.GetLocalVRCPlayer().transform.rotation = Rot2;
break;
case 3:
if (Pos3 == null || Rot3 == null) return;
if (!WorldActions.WorldAllowed) return;
PlayerActions.GetLocalVRCPlayer().transform.position = Pos3;
PlayerActions.GetLocalVRCPlayer().transform.rotation = Rot3;
break;
case 4:
if (Pos4 == null || Rot4 == null) return;
if (!WorldActions.WorldAllowed) return;
PlayerActions.GetLocalVRCPlayer().transform.position = Pos4;
PlayerActions.GetLocalVRCPlayer().transform.rotation = Rot4;
break;
}
}
internal static void OpenKeyboardForPlayerTP()
{
PopupManager.ShowInputPopup("Teleport to Player", "", InputField.InputType.Standard, false, "Teleport",
(s, __, ___) =>
{
Player tptgt = PlayerActions.Target(s);
PopupManager.HideCurrentPopup(VRCUiPopupManager.prop_VRCUiPopupManager_0);
if (tptgt != null)
if (WorldActions.WorldAllowed)
PlayerActions.GetLocalVRCPlayer().transform.position = tptgt.transform.position;
}, null, "Enter (partial) Player Name");
}
internal static void OpenKeyboardForCoordTP()
{
PopupManager.ShowInputPopup("Teleport to Postition", "", InputField.InputType.Standard, false, "Teleport",
(s, __, ___) =>
{
string[] coords = s.Split(' ');
if (coords.Length == 3)
{
PopupManager.HideCurrentPopup(VRCUiPopupManager.prop_VRCUiPopupManager_0);
if (WorldActions.WorldAllowed)
PlayerActions.GetLocalVRCPlayer().transform.position = new Vector3(float.Parse(coords[0]), float.Parse(coords[1]), float.Parse(coords[2]));
}
else
Main.Logger.Error("Please input the correct coords as => X[space]Y[space]Z");
}, null, "Enter coords as X[Space]Y[Space]Z");
}
}
}