Exemplo n.º 1
0
        public static void Setup(MonoBehaviour og = null)
        {
            obj = new GameObject();
            #region Colliders
            bool flag = UnityEngine.Object.FindObjectsOfType <Collider>().Count <Collider>() > 0;
            if (flag)
            {
                GeneralUtils.Colliders = UnityEngine.Object.FindObjectsOfType <Collider>();
            }
            bool flag2 = VRCPlayer.Instance.GetComponents(typeof(Collider)).Count <Component>() > 0;
            if (flag2)
            {
                GeneralUtils.component = VRCPlayer.Instance.GetComponents(typeof(Collider))[0];
            }
            #endregion
            #region Debugger UI
            obj.AddComponent <GuiConsole>();
            #endregion
            #region Patching and Controls
            InformControls();
            HookManager.Hook();
            PatchManager.ApplyPatches();
            #endregion
            #region VR UI Setup
            new ButtonMenu();
            #endregion
            #region KOS
            KOSService.LoadKOS();
            #endregion
            #region Dynamic Bone Touching
            obj.AddComponent <GlobalDynamicBones>(); //Thanks greengray
            #endregion

            #region Color Module
            obj.AddComponent <ColorModule>();
            #endregion

            #region Timers
            System.Timers.Timer timer = new System.Timers.Timer();
            timer.Elapsed  += Check_Elapsed;
            timer.Interval  = 1000;
            timer.AutoReset = true;
            timer.Enabled   = true;

            new Thread(() =>
            {
                System.Timers.Timer timer2 = new System.Timers.Timer();
                timer2.Elapsed            += PortalDisabler;
                timer2.Interval            = 100;
                timer2.AutoReset           = true;
                timer2.Enabled             = true;
            }).Start();
            UnityEngine.Object.DontDestroyOnLoad(obj);
            #endregion
        }
Exemplo n.º 2
0
        public void Update()
        {
            #region UI Checking
            if (Resources.FindObjectsOfTypeAll <GuiConsole>().Count() == 0)
            {
                if (GuiConsole.toggleGuiConsole)
                {
                    GeneralUtils.obj.AddComponent <GuiConsole>();
                }
            }
            #endregion

            #region Flight
            if (GeneralUtils.Flight)
            {
                //Thanks Null!
                GameObject gameObject   = GameObject.Find("Camera (eye)");
                var        currentSpeed = (Input.GetKey(KeyCode.LeftShift) ? GeneralUtils.FlightRunSpeed : GeneralUtils.FlightSpeed);

                if (Input.GetKey(KeyCode.W))
                {
                    VRCPlayer.Instance.transform.position += gameObject.transform.forward * currentSpeed * Time.deltaTime;
                }
                if (Input.GetKey(KeyCode.A))
                {
                    VRCPlayer.Instance.transform.position += VRCPlayer.Instance.transform.right * -1f * currentSpeed * Time.deltaTime;
                }
                if (Input.GetKey(KeyCode.S))
                {
                    VRCPlayer.Instance.transform.position += gameObject.transform.forward * -1f * currentSpeed * Time.deltaTime;
                }
                if (Input.GetKey(KeyCode.D))
                {
                    VRCPlayer.Instance.transform.position += VRCPlayer.Instance.transform.right * currentSpeed * Time.deltaTime;
                }
                if (Input.GetKey(KeyCode.Space))
                {
                    VRCPlayer.Instance.transform.position += VRCPlayer.Instance.transform.up * currentSpeed * Time.deltaTime;
                }
                if (Math.Abs(Input.GetAxis("Joy1 Axis 2")) > 0f)
                {
                    VRCPlayer.Instance.transform.position += gameObject.transform.forward * currentSpeed * Time.deltaTime * (Input.GetAxis("Joy1 Axis 2") * -1f);
                }
                if (Math.Abs(Input.GetAxis("Joy1 Axis 1")) > 0f)
                {
                    VRCPlayer.Instance.transform.position += gameObject.transform.right * currentSpeed * Time.deltaTime * Input.GetAxis("Joy1 Axis 1");
                }
                VRCPlayer.Instance.AlignTrackingToPlayer();
            }
            #endregion

            #region Safe GoHome
            if (Input.GetKey(KeyCode.RightControl) && Input.GetKeyDown(KeyCode.H))
            {
                Resources.FindObjectsOfTypeAll <VRCFlowManager>()[0].GoHome();
            }
            #endregion

            #region Social Buttons
            var buttons = UnityEngine.Object.FindObjectsOfType <VRCUiButton>();
            foreach (var button in buttons)
            {
                if (button.GetComponentInChildren <Text>().text.ToLower().Contains("vote"))
                {
                    if (UnityEngine.Object.FindObjectsOfType <GameObject>().Where(x => x.name.ToLower() == "add to kos").Count() == 0)
                    {
                        var template  = button;
                        var newbutton = UnityEngine.Object.Instantiate <GameObject>(template.gameObject, button.transform.parent);
                        setLocation(0, 150, newbutton);
                        newbutton.name = "Add to KOS";
                        newbutton.GetComponentInChildren <Text>().text      = "Add to KOS";
                        newbutton.GetComponentInChildren <Button>().onClick = new Button.ButtonClickedEvent();
                        newbutton.GetComponentInChildren <Button>().onClick.AddListener(delegate()
                        {
                            KOSService.UserKOS.Add(_pageUserInfo.user.id);
                            KOSService.SaveKOS();
                            GeneralUtils.Debug($"{_pageUserInfo.user.displayName} has been added to KOS.");
                        });
                        newbutton.GetComponentInChildren <Button>().interactable        = true;
                        newbutton.GetComponentInChildren <UnityEngine.UI.Image>().color = Color.white;
                        newbutton.GetComponentInChildren <Text>().color = Color.red;
                        newbutton.SetActive(true);
                    }
                }
            }
            #endregion

            #region Room Lockdown Exploit
            if (Event.current.alt && Input.GetKeyDown(KeyCode.L))
            {
                Console.WriteLine("Locking Room");
                RoomManager.SetLockdown(true);
                Console.WriteLine("Locked Room.");
            }
            #endregion
        }