Esempio n. 1
0
        private IEnumerator PrintAll()
        {
            yield return(VRCUiManagerUtils.WaitForUiManagerInit());

            foreach (GameObject gameObject in QuickMenuUtils.GetQuickMenuInstance().gameObject.scene.GetRootGameObjects())
            {
                if (gameObject != null)
                {
                    PrintHierarchy(gameObject.transform, 0);
                }
            }
            yield break;
        }
Esempio n. 2
0
        // -1050 1470
        // 420x420

        private IEnumerator Setup()
        {
            isReady = false;
            while (!isReady)
            {
                yield return(VRCUiManagerUtils.WaitForUiManagerInit());

                isReady = true;
            }
            Transform ButtonBase = QuickMenuUtils.GetQuickMenuInstance().transform.Find("ShortcutMenu/SettingsButton");

            if (ButtonBase != null)
            {
                // Log window button
                ToggleLog      = UnityUiUtils.DuplicateButton(ButtonBase, "Toggle\nConsole", new Vector2(0f, 0f));
                ToggleLog.name = "ToggleLogButton";
                ToggleLog.GetComponent <Button>().onClick.RemoveAllListeners();
                ToggleLog.GetComponent <Button>().onClick.AddListener(delegate
                {
                    ToggleLogWindow();
                });
                ToggleLog.GetComponent <RectTransform>().SetParent(ButtonBase.parent, true);
                ToggleLog.GetComponent <RectTransform>().localPosition = new Vector3(-1050f, 1470f, 0f);
                ToggleLog.GetComponent <RectTransform>().localRotation = Quaternion.identity;

                // Clear Log window button
                ClearLog      = UnityUiUtils.DuplicateButton(ButtonBase, "Clear\nConsole", new Vector2(0f, 0f));
                ClearLog.name = "ClearLogButton";
                ClearLog.GetComponent <Button>().onClick.RemoveAllListeners();
                ClearLog.GetComponent <Button>().onClick.AddListener(delegate
                {
                    ConsoleLogs.Clear();
                });
                ClearLog.GetComponent <RectTransform>().SetParent(ButtonBase.parent, true);
                ClearLog.GetComponent <RectTransform>().localPosition = new Vector3(-1050f, 1050f, 0f);
                ClearLog.GetComponent <RectTransform>().localRotation = Quaternion.identity;

                // Third person button
                ToggleTP      = UnityUiUtils.DuplicateButton(ButtonBase, "Toggle\nThird\nPerson", new Vector2(0f, 0f));
                ToggleTP.name = "ToggleTPButton";
                ToggleTP.GetComponent <Button>().onClick.RemoveAllListeners();
                ToggleTP.GetComponent <Button>().onClick.AddListener(delegate
                {
                    ToggleThirdPerson();
                });
                ToggleTP.GetComponent <RectTransform>().SetParent(ButtonBase.parent, true);
                ToggleTP.GetComponent <RectTransform>().localPosition = new Vector3(-1050f, 1890f, 0f);
                ToggleTP.GetComponent <RectTransform>().localRotation = Quaternion.identity;

                // Enable jumping
                AddJump      = UnityUiUtils.DuplicateButton(ButtonBase, "Enable\nJumping", new Vector2(0f, 0f));
                AddJump.name = "ToggleJumpButton";
                AddJump.GetComponent <Button>().onClick.RemoveAllListeners();
                AddJump.GetComponent <Button>().onClick.AddListener(delegate
                {
                    EnableJumping();
                });
                AddJump.GetComponent <RectTransform>().SetParent(ButtonBase.parent, true);
                AddJump.GetComponent <RectTransform>().localPosition = new Vector3(1050f, 1890f, 0f);
                AddJump.GetComponent <RectTransform>().localRotation = Quaternion.identity;

                // Enable no gravity
                ToggleGravity      = UnityUiUtils.DuplicateButton(ButtonBase, "Toggle\nGravity", new Vector2(0f, 0f));
                ToggleGravity.name = "ToggleGravityButton";
                ToggleGravity.GetComponent <Button>().onClick.RemoveAllListeners();
                ToggleGravity.GetComponent <Button>().onClick.AddListener(delegate
                {
                    toggleGravity();
                });
                ToggleGravity.GetComponent <RectTransform>().SetParent(ButtonBase.parent, true);
                ToggleGravity.GetComponent <RectTransform>().localPosition = new Vector3(1050f, 630f, 0f);
                ToggleGravity.GetComponent <RectTransform>().localRotation = Quaternion.identity;

                // Enable noclip
                ToggleNoclip      = UnityUiUtils.DuplicateButton(ButtonBase, "Toggle\nNoclip", new Vector2(0f, 0f));
                ToggleNoclip.name = "ToggleNoclipButton";
                ToggleNoclip.GetComponent <Button>().onClick.RemoveAllListeners();
                ToggleNoclip.GetComponent <Button>().onClick.AddListener(delegate
                {
                    toggleNoclip();
                });
                ToggleNoclip.GetComponent <RectTransform>().SetParent(ButtonBase.parent, true);
                ToggleNoclip.GetComponent <RectTransform>().localPosition = new Vector3(-1050f, 630f, 0f);
                ToggleNoclip.GetComponent <RectTransform>().localRotation = Quaternion.identity;
            }
            else
            {
                AddDebugLine("Failed to find Button Base");
            }
            InvokeRepeating("WatchForPlayers", 0f, 5f);
        }