示例#1
0
        public static void OpenUserInBrowser()
        {
            UserInfoExtensionsMod.HideAllPopups();

            System.Diagnostics.Process.Start("https://vrchat.com/home/user/" + VRCUtils.ActiveUser.id);
            VRCUtils.OpenPopupV2("Notice:", "User has been opened in the default browser", "Close", new Action(VRCUtils.ClosePopup));
        }
 /*
  * public static void OnPageOpen(VRCUiPage __0)
  * {
  *
  * }
  */
 public static void HideAllPopups()
 {
     VRCUtils.ClosePopup();
     BioButtons.bioLanguagesPopup.Close();
     BioButtons.bioLinksPopup.Close();
     menu.Hide();
 }
示例#3
0
        public static void ShowBioLinksPopup()
        {
            UserInfoExtensionsMod.HideAllPopups();

            if (VRCUtils.ActiveUser.bioLinks == null)
            {
                VRCUtils.OpenPopupV2("Notice:", "Cannot get user's links", "Close", new Action(VRCUtils.ClosePopup));
            }
            else
            {
                CheckLinks(VRCUtils.ActiveUser.bioLinks);
                if (VRCUtils.ActiveUser.bioLinks.Count == 0)
                {
                    VRCUtils.OpenPopupV2("Notice:", "This user has no bio links", "Close", new Action(VRCUtils.ClosePopup));
                }
                else if (bioLinks.Count == 0)
                {
                    VRCUtils.OpenPopupV2("Notice:", "This user has invalid links", "Close", new Action(VRCUtils.ClosePopup));
                }
                else
                {
                    VRCUiManager.prop_VRCUiManager_0.Method_Public_Void_String_Boolean_0("UserInterface/MenuContent/Popups/BioLinksPopup");
                }
            }
        }
示例#4
0
        private static void OnPlayerJoin(Player player)
        {
            if (player == null || player.prop_APIUser_0 == null) //player.prop_APIUser_0.id == APIUser.CurrentUser.id) // The apiuser in player will only be null on the first join of the first instance of the client, and only occasionally. So it can be garunteed to be local player
            {
                return;
            }

            int photonId = player.prop_VRCPlayer_0.prop_PlayerNet_0.prop_PhotonView_0.field_Private_Int32_0;

            if (players.ContainsKey(photonId))
            {
                return;
            }

            AvatarHiderPlayer playerProp = new AvatarHiderPlayer()
            {
                active   = true,
                photonId = photonId,
                userId   = player.prop_APIUser_0.id,
                player   = player,
                avatar   = player.prop_VRCPlayer_0.prop_VRCAvatarManager_0.prop_GameObject_0,
                isFriend = APIUser.IsFriendsWith(player.prop_APIUser_0.id),
                isShown  = VRCUtils.IsAvatarExplcitlyShown(player.prop_APIUser_0),
                isHidden = VRCUtils.IsAvatarExplcitlyHidden(player.prop_APIUser_0)
            };

            players.Add(playerProp.photonId, playerProp);
            HideOrShowAvatar(playerProp);
            RefreshFilteredList();
        }
示例#5
0
        public static void OpenUserWorldInWorldMenu()
        {
            UserInfoExtensionsMod.HideAllPopups();

            string location;

            if (!VRCUtils.ActiveUser.IsSelf)
            {
                location = VRCUtils.ActiveUser.location;
            }
            else
            {
                location = APIUser.CurrentUser.location;
            }
            if (VRCUtils.userInfo.field_Private_ApiWorld_1 != null && !(string.IsNullOrEmpty(location) || location == "private" || location == "offline"))
            {
                string processedLocation = VRCUtils.ActiveUser.location.Split(new char[] { ':' }, 2)[1];
                int    count;
                try
                {
                    count = VRCUtils.userInfo.field_Private_ApiWorld_1.instances[processedLocation];
                }
                catch
                {
                    count = 0;
                }
                ApiWorldInstance instance = new ApiWorldInstance(VRCUtils.userInfo.field_Private_ApiWorld_1, processedLocation, count);
                setUpWorldInfo.Invoke(VRCUtils.worldInfo, new object[] { VRCUtils.userInfo.field_Private_ApiWorld_1, instance, null, null });
                VRCUiManager.prop_VRCUiManager_0.ShowScreenButton("UserInterface/MenuContent/Screens/WorldInfo");
            }
            else
            {
                VRCUtils.OpenPopupV2("Notice", "Cannot grab this user's world", "Close", new Action(VRCUtils.ClosePopup));
            }
        }
示例#6
0
        public static void ToQuickMenu()
        {
            UserInfoExtensionsMod.HideAllPopups();

            foreach (Player player in PlayerManager.prop_PlayerManager_0.field_Private_List_1_Player_0)
            {
                if (player.field_Private_APIUser_0 == null)
                {
                    continue;
                }
                if (player.field_Private_APIUser_0.id == VRCUtils.ActiveUser.id)
                {
                    closeMenu.Invoke(VRCUiManager.prop_VRCUiManager_0, new object[] { true, false }); //Closes Big Menu
                    openQuickMenu.Invoke(QuickMenu.prop_QuickMenu_0, new object[] { true });          //Opens Quick Menu

                    if (VRCUiCursorManager.Method_Public_Static_VRCUiCursor_0().gameObject.activeSelf)
                    {
                        clickMethod.Invoke(VRCUiCursorManager.Method_Public_Static_VRCUiCursor_0(), new object[] { player.field_Internal_VRCPlayer_0 });
                    }

                    QuickMenu.prop_QuickMenu_0.Method_Public_Void_Player_0(player); //Does the rest lmao

                    return;
                }
            }
            VRCUtils.OpenPopupV2("Notice:", "You cannot show this user on the Quick Menu because they are not in the same instance", "Close", new Action(VRCUtils.ClosePopup));
        }
示例#7
0
 public override void OnApplicationStart()
 {
     Instance = this;
     VRCUtils.Init();
     UIManager.Init();
     WorldManager.Init();
     InstanceManager.Init();
 }
 public SingleButton(string name, string text, string tooltip, int x, int y, Transform childOf = null, UnityAction action = null)
 {
     button      = Object.Instantiate(VRCUtils.SingleButtonTemplate(), childOf);
     button.name = "nitro" + name;
     setText(text);
     setTooltip(tooltip);
     setButtonPosition(x, y);
     setAction(action);
 }
示例#9
0
 public static void OnInstanceChange(ApiWorld __0)
 {
     MelonLogger.Msg("Checking if world is allowed to show distance...");
     worldAllowed = false;
     if (__0 != null)
     {
         MelonCoroutines.Start(VRCUtils.CheckWorld(__0));
     }
 }
示例#10
0
 public void OnOpenLink()
 {
     if (currentLink != null)
     {
         System.Diagnostics.Process.Start(currentLink.OriginalString);
         Close();
         VRCUtils.OpenPopupV2("Notice:", "Link has been opened in the default browser", "Close", new Action(VRCUtils.ClosePopup));
         currentLink = null;
     }
 }
示例#11
0
        public override void VRChat_OnUiManagerInit()
        {
            VRCUtils.UiInit();
            foreach (ModuleBase module in modules)
            {
                module.UiInit();
            }

            MelonLogger.Msg("UI Initialized!");
        }
示例#12
0
        public static void ShowBioLanguagesPopup()
        {
            UserInfoExtensionsMod.HideAllPopups();

            if (userLanguages == null || userLanguages.Count == 0)
            {
                VRCUtils.OpenPopupV2("Notice:", "This user has no bio languages", "Close", new Action(VRCUtils.ClosePopup));
            }
            else
            {
                VRCUiManager.prop_VRCUiManager_0.Method_Public_Void_String_Boolean_0("UserInterface/MenuContent/Popups/BioLanguagesPopup");
            }
        }
示例#13
0
        public static void GetBio()
        {
            UserInfoExtensionsMod.HideAllPopups();

            if (VRCUtils.ActiveUser.bio != null && VRCUtils.ActiveUser.bio.Length >= 300)
            {
                VRCUtils.OpenPopupV1("Bio:", VRCUtils.ActiveUser.bio, "Close", new Action(VRCUtils.ClosePopup));
            }
            else
            {
                VRCUtils.OpenPopupV2("Bio:", VRCUtils.ActiveUser.bio, "Close", new Action(VRCUtils.ClosePopup));
            }
        }
示例#14
0
        public static void FromAvatar()
        {
            UserInfoExtensionsMod.HideAllPopups();

            if (!canGet)
            {
                VRCUtils.OpenPopupV2("Slow down!", "Please wait a little in between button presses", "Close", new Action(VRCUtils.ClosePopup));
                return;
            }

            MelonCoroutines.Start(StartTimer());

            isFromSocialPage = false;
            OpenUserInSocialMenu(avatarPage.field_Public_SimpleAvatarPedestal_0.field_Internal_ApiAvatar_0.authorId);
        }
示例#15
0
        public static async void FromSocial()
        {
            UserInfoExtensionsMod.HideAllPopups();

            if (!canGet)
            {
                VRCUtils.OpenPopupV2("Slow down!", "Please wait a little in between button presses", "Close", new Action(VRCUtils.ClosePopup));
                return;
            }

            if (avatarLink == null)
            {
                VRCUtils.OpenPopupV2("Error!", "Something went wrong and the avatar author could not be retreived. Please try again", "Close", new Action(VRCUtils.ClosePopup));
                return;
            }

            MelonCoroutines.Start(StartTimer());

            HttpWebRequest request = WebRequest.CreateHttp(avatarLink.OriginalString);

            try
            {
                request.UserAgent = "Mozilla/5.0";
                WebResponse response = await request.GetResponseAsync();

                isFromSocialPage = true;

                StreamReader streamReader  = new StreamReader(response.GetResponseStream());
                JObject      jsonData      = JObject.Parse(streamReader.ReadToEnd());
                JsonData     requestedData = jsonData.ToObject <JsonData>();

                await AsyncUtils.YieldToMainThread();

                OpenUserInSocialMenu(requestedData.ownerId);

                response.Close();
                streamReader.Close();
            }
            catch (WebException)
            {
                await AsyncUtils.YieldToMainThread();

                VRCUtils.OpenPopupV2("Error!", "Something went wrong and the avatar author could not be retreived. Please try again", "Close", new Action(VRCUtils.ClosePopup));
                return;
            }
        }
示例#16
0
        private static void OnUserFetched(APIUser user)
        {
            if (isFromSocialPage && user.id == VRCUtils.ActiveUser.id)
            {
                VRCUtils.OpenPopupV2("Notice:", "You are already viewing the avatar author", "Close", new Action(VRCUtils.ClosePopup));
                return;
            }

            QuickMenu.prop_QuickMenu_0.field_Private_APIUser_0 = user;
            QuickMenu.prop_QuickMenu_0.Method_Public_Void_Int32_Boolean_0(4, false);
            if (isFromSocialPage)
            {
                // For some reason when called from the Social Menu the screen stack adds the UserInfo page twice (making the user have to hit the back button twice to leave the page), so I'm just getting the screen stack using Reflection (as the name doesn't seem static) and removing the 2nd to last entry
                var  listObject  = screenStackProp.GetValue(VRCUiManager.prop_VRCUiManager_0);
                Type genericType = typeof(Il2CppSystem.Collections.Generic.List <>).MakeGenericType(new Type[] { typeof(VRCUiManager).GetNestedTypes().First() });
                genericType.GetMethod("RemoveAt").Invoke(listObject, new object[] { (int)genericType.GetProperty("Count").GetValue(listObject) - 1 });

                isFromSocialPage = false;
            }
        }
示例#17
0
        public override void OnApplicationStart()
        {
            VRCUtils.Init();

            Harmony.Patch(AccessTools.Method(typeof(MenuController), "Method_Public_Void_APIUser_0"), postfix: new HarmonyMethod(typeof(UserInfoExtensionsMod).GetMethod("OnUserInfoOpen", BindingFlags.Static | BindingFlags.Public)));
            Harmony.Patch(AccessTools.Method(typeof(PageUserInfo), "Back"), postfix: new HarmonyMethod(typeof(UserInfoExtensionsMod).GetMethod("OnUserInfoClose", BindingFlags.Static | BindingFlags.Public)));
            UIExpansionKit.API.LayoutDescription popupLayout = new UIExpansionKit.API.LayoutDescription
            {
                RowHeight  = 80,
                NumColumns = 3,
                NumRows    = 5
            };
            menu            = UIExpansionKit.API.ExpansionKitApi.CreateCustomFullMenuPopup(popupLayout);
            userDetailsMenu = UIExpansionKit.API.ExpansionKitApi.GetExpandedMenu(UIExpansionKit.API.ExpandedMenu.UserDetailsMenu);

            menu.AddLabel("General Things");
            menu.AddSpacer();
            menu.AddSimpleButton("Back", () => menu.Hide());
            userDetailsMenu.AddSimpleButton("UserInfoExtensions", async() =>
            {
                await AsyncUtils.YieldToMainThread();
                HideAllPopups();
                menu.Show();
                foreach (ModuleBase module in modules)
                {
                    module.OnUIEMenuOpen();
                }
            });

            AddModule(new QuickMenuFromSocial());
            AddModule(new GetAvatarAuthor());
            AddModule(new OpenInWorldMenu());
            AddModule(new BioButtons());
            AddModule(new OpenInBrowser());
            AddModule(new UserInformation());

            MelonLogger.Msg("Initialized!");
        }
示例#18
0
        public override void OnApplicationStart()
        {
            MelonPreferences_Category category = MelonPreferences.CreateCategory("ReloadAvatars", "ReloadAvatars Settings");

            reloadAvatarPref     = category.CreateEntry("ReloadAvatar", true, "Enable/Disable Reload Avatar Button");
            reloadAllAvatarsPref = category.CreateEntry("ReloadAllAvatars", true, "Enable/Disable Reload All Avatars Button");

            foreach (MelonPreferences_Entry entry in category.Entries)
            {
                entry.OnValueChangedUntyped += OnPrefChanged;
            }

            ExpansionKitApi.GetExpandedMenu(ExpandedMenu.UserQuickMenu).AddSimpleButton("Reload Avatar", new Action(() =>
            {
                try
                {
                    VRCUtils.ReloadAvatar(VRCUtils.ActivePlayerInQuickMenu.prop_VRCPlayer_0);
                }
                catch (Exception ex)
                {
                    MelonLogger.Error("Error while reloading single avatar:\n" + ex.ToString());
                } // Ignore
            }), new Action <GameObject>((gameObject) => { reloadAvatarButton = gameObject; reloadAvatarButton.SetActive(reloadAllAvatarsPref.Value); OnPrefChanged(); }));

            ExpansionKitApi.GetExpandedMenu(ExpandedMenu.QuickMenu).AddSimpleButton("Reload All Avatars", new Action(() =>
            {
                try
                {
                    VRCUtils.ReloadAllAvatars();
                }
                catch (Exception ex)
                {
                    MelonLogger.Error("Error while reloading all avatars:\n" + ex.ToString());
                } // Ignore
            }), new Action <GameObject>((gameObject) => { reloadAllAvatarsButton = gameObject; reloadAllAvatarsButton.SetActive(reloadAvatarPref.Value); OnPrefChanged(); }));
            MelonLogger.Msg("Initialized!");
        }
示例#19
0
 public static void OpenUserInSocialMenu(string userId) => APIUser.FetchUser(userId, new Action <APIUser>(OnUserFetched), new Action <string>((thing) => { VRCUtils.OpenPopupV2("Error!", "Something went wrong and the author could not be retreived.", "Close", new Action(VRCUtils.ClosePopup)); }));
示例#20
0
        public static void OnStaticConfigChange()
        {
            OnEnable  = null;
            OnDisable = null;

            foreach (AvatarHiderPlayer playerProp in PlayerManager.filteredPlayers.Values)
            {
                playerProp.SetActive();
                playerProp.active = false; // Do this so avatar sounds run on the first time
            }

            setActiveDelegate   = setActiveCompletelyDelegate;
            setInactiveDelegate = setInactiveCompletelyDelegate;

            if (Config.DisableSpawnSound.Value)
            {
                foreach (AvatarHiderPlayer ahPlayer in PlayerManager.filteredPlayers.Values)
                {
                    ahPlayer.hasLetAudioPlay = false;
                }

                OnEnable += new Action <AvatarHiderPlayer>((ahPlayer) =>
                {
                    if (ahPlayer.hasLetAudioPlay)
                    {
                        ahPlayer.StopAudio();
                    }
                });
                OnDisable += new Action <AvatarHiderPlayer>((ahPlayer) =>
                {
                    if (!ahPlayer.hasLetAudioPlay)
                    {
                        ahPlayer.hasLetAudioPlay = true;
                    }
                });
            }
            if (Config.LimitAudioDistance.Value)
            {
                wasLimitOnBefore = true;
                foreach (AvatarHiderPlayer ahPlayer in PlayerManager.players.Values)
                {
                    if (!ahPlayer.active)
                    {
                        continue;
                    }

                    ahPlayer.LimitAudioDistance();

                    ahPlayer.hasLimitedAudio = true;
                }
                OnEnable += new Action <AvatarHiderPlayer>((ahPlayer) =>
                {
                    if (!ahPlayer.hasLimitedAudio)
                    {
                        ahPlayer.LimitAudioDistance();

                        ahPlayer.hasLimitedAudio = true;
                    }
                });
            }
            else if (wasLimitOnBefore)
            {
                VRCUtils.ReloadAllAvatars();
            }
            RefreshManager.Refresh();
        }
示例#21
0
        // This is a mess please don't look
        // and also pull request to improve it thx
        public override void OnUpdate()
        {
            // Testing

            /* if (Input.GetKeyDown(KeyCode.F1)) {
             *  var quickMenu = VRCUtils.GetQuickMenu();
             *  var cameraMenu = quickMenu.transform.Find("CameraMenu");
             *  VRCUtils.ShowQuickMenuPage(quickMenu, cameraMenu);
             *
             *  var smoothCameraButton = cameraMenu.Find("SmoothFPVCamera");
             *  smoothCameraButton.gameObject.SetActive(true);
             *
             *  var photoModeButton = cameraMenu.Find("PhotoMode");
             *  photoModeButton.gameObject.SetActive(true);
             *
             *  var videoModeButton = cameraMenu.Find("VideoMode");
             *  videoModeButton.gameObject.SetActive(true);
             *
             *  var disableCameraButton = cameraMenu.Find("DisableCamera");
             *  disableCameraButton.gameObject.SetActive(true);
             * } */
            if (Settings.cameraEnabled && Settings.arrowKeysEnabled)
            {
                var cameraRotation    = CameraUtils.worldCameraQuaternion.ToEuler();
                var actualCameraSpeed = (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt))
                    ? CameraSpeedAlt
                    : CameraSpeed;
                if (Input.GetKey(KeyCode.DownArrow))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            if (Settings.rotateAroundUserCamera)
                            {
                                CameraUtils.RotateAround(VRCUtils.GetMainCamera().transform.position,
                                                         VRCUtils.GetMainCamera().transform.up,
                                                         (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -2f : -1f);
                            }
                            else
                            {
                                CameraUtils.worldCameraVector -= new Vector3(
                                    (float)Math.Sin(cameraRotation.y) * actualCameraSpeed, 0f,
                                    (float)Math.Cos(cameraRotation.y) * actualCameraSpeed);
                            }
                        }
                    }
                    else
                    {
                        VRCUtils.GetUserCameraController().viewFinder.transform.localPosition += new Vector3(0f, 0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -0.01f : -0.005f);
                    }
                }
                if (Input.GetKey(KeyCode.UpArrow))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            if (Settings.rotateAroundUserCamera)
                            {
                                CameraUtils.RotateAround(VRCUtils.GetMainCamera().transform.position, VRCUtils.GetMainCamera().transform.up, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 2f : 1f);
                            }
                            else
                            {
                                CameraUtils.worldCameraVector += new Vector3(
                                    (float)Math.Sin(cameraRotation.y) * actualCameraSpeed, 0f,
                                    (float)Math.Cos(cameraRotation.y) * actualCameraSpeed);
                            }
                        }
                    }
                    else
                    {
                        VRCUtils.GetUserCameraController().viewFinder.transform.localPosition += new Vector3(0f, 0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 0.01f : 0.005f);
                    }
                }
                if (Input.GetKey(KeyCode.PageUp))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            if (Settings.rotateAroundUserCamera)
                            {
                                CameraUtils.RotateAround(VRCUtils.GetMainCamera().transform.position, VRCUtils.GetMainCamera().transform.right, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -2f : -1f);
                            }
                            else
                            {
                                CameraUtils.worldCameraVector += new Vector3(0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? CameraSpeedAlt : CameraSpeed, 0f);
                            }
                        }
                    }
                    else
                    {
                        if (Settings.rotateAroundUserCamera)
                        {
                            VRCUtils.GetUserCameraController().viewFinder.transform.RotateAround(VRCUtils.GetMainCamera().transform.position, VRCUtils.GetMainCamera().transform.right, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -2f : -1f);
                        }
                        else
                        {
                            VRCUtils.GetUserCameraController().viewFinder.transform.localPosition += new Vector3(0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 0.01f : 0.005f, 0f);
                        }
                    }
                }
                if (Input.GetKey(KeyCode.PageDown))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            if (Settings.rotateAroundUserCamera)
                            {
                                CameraUtils.RotateAround(VRCUtils.GetMainCamera().transform.position, VRCUtils.GetMainCamera().transform.right, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 2f : 1f);
                            }
                            else
                            {
                                CameraUtils.worldCameraVector += new Vector3(0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -CameraSpeedAlt : -CameraSpeed, 0f);
                            }
                        }
                    }
                    else
                    {
                        if (Settings.rotateAroundUserCamera)
                        {
                            VRCUtils.GetUserCameraController().viewFinder.transform.RotateAround(VRCUtils.GetMainCamera().transform.position, VRCUtils.GetMainCamera().transform.right, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 2f : 1f);
                        }
                        else
                        {
                            VRCUtils.GetUserCameraController().viewFinder.transform.localPosition += new Vector3(0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -0.01f : -0.005f, 0f);
                        }
                    }
                }
                if (Input.GetKey(KeyCode.LeftArrow))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            CameraUtils.worldCameraVector -= new Vector3(
                                (float)Math.Cos(cameraRotation.y) * actualCameraSpeed, 0f,
                                (float)-Math.Sin(cameraRotation.y) * actualCameraSpeed);
                        }
                    }
                    else
                    {
                        if (Settings.rotateAroundUserCamera)
                        {
                            VRCUtils.GetUserCameraController().viewFinder.transform.RotateAround(VRCUtils.GetMainCamera().transform.position, VRCUtils.GetMainCamera().transform.up, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -2f : -1f);
                        }
                        else
                        {
                            VRCUtils.GetUserCameraController().viewFinder.transform.localPosition += new Vector3((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -0.01f : -0.005f, 0f, 0f);
                        }
                    }
                }
                if (Input.GetKey(KeyCode.RightArrow))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            CameraUtils.worldCameraVector += new Vector3(
                                (float)Math.Cos(cameraRotation.y) * actualCameraSpeed, 0f,
                                (float)-Math.Sin(cameraRotation.y) * actualCameraSpeed);
                        }
                    }
                    else
                    {
                        if (Settings.rotateAroundUserCamera)
                        {
                            VRCUtils.GetUserCameraController().viewFinder.transform.RotateAround(VRCUtils.GetMainCamera().transform.position, VRCUtils.GetMainCamera().transform.up, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 2f : 1f);
                        }
                        else
                        {
                            VRCUtils.GetUserCameraController().viewFinder.transform.localPosition += new Vector3((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 0.01f : 0.005f, 0f, 0f);
                        }
                    }
                }

                // Rotation
                if (Input.GetKey(KeyCode.Keypad8))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            CameraUtils.worldCameraQuaternion *= Quaternion.Euler(Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt) ? -2f : -1f, 0f, 0f);
                        }
                    }
                    else
                    {
                        VRCUtils.GetUserCameraController().viewFinder.transform.Rotate(new Vector3((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -2f : -1f, 0f));
                    }
                }
                if (Input.GetKey(KeyCode.Keypad2))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            CameraUtils.worldCameraQuaternion *= Quaternion.Euler(Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt) ? 2f : 1f, 0f, 0f);
                        }
                    }
                    else
                    {
                        VRCUtils.GetUserCameraController().viewFinder.transform.Rotate(new Vector3((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 2f : 1f, 0f));
                    }
                }
                if (Input.GetKey(KeyCode.Keypad4))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            CameraUtils.worldCameraQuaternion *= Quaternion.Euler(0f, Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt) ? -2f : -1f, 0f);
                        }
                    }
                    else
                    {
                        VRCUtils.GetUserCameraController().viewFinder.transform.Rotate(new Vector3(0f, 0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -2f : -1f));
                    }
                }
                if (Input.GetKey(KeyCode.Keypad6))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            CameraUtils.worldCameraQuaternion *= Quaternion.Euler(0f, Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt) ? 2f : 1f, 0f);
                        }
                    }
                    else
                    {
                        VRCUtils.GetUserCameraController().viewFinder.transform.Rotate(new Vector3(0f, 0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 2f : 1f));
                    }
                }
                if (Input.GetKey(KeyCode.Keypad7))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            CameraUtils.worldCameraQuaternion *= Quaternion.Euler(0f, 0f, Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt) ? 2f : 1f);
                        }
                    }
                    else
                    {
                        VRCUtils.GetUserCameraController().viewFinder.transform.Rotate(new Vector3(0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -2f : -1f, 0f));
                    }
                }
                if (Input.GetKey(KeyCode.Keypad9))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            CameraUtils.worldCameraQuaternion *= Quaternion.Euler(0f, 0f, Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt) ? -2f : -1f);
                        }
                    }
                    else
                    {
                        VRCUtils.GetUserCameraController().viewFinder.transform.Rotate(new Vector3(0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 2f : 1f, 0f));
                    }
                }

                // Reset
                if (Input.GetKeyDown(KeyCode.Keypad3))
                {
                    if (Settings.cameraEnabled)
                    {
                        CameraUtils.ResetCamera();
                    }
                }

                // Look at player
                if (Input.GetKeyDown(KeyCode.Keypad1))
                {
                    if (Settings.cameraEnabled)
                    {
                        VRCUtils.GetUserCameraController().viewFinder.transform.LookAt(VRCUtils.GetMainCamera().transform);
                        VRCUtils.GetUserCameraController().viewFinder.transform.rotation *= Quaternion.Euler(90f, 0f, 0f);
                    }
                }

                // Take pic
                if (Input.GetKeyDown(KeyCode.KeypadPlus))
                {
                    if (Settings.cameraEnabled)
                    {
                        CameraUtils.TakePicture(0);
                    }
                }

                // Toggle camera movement
                if (Input.GetKeyDown(KeyCode.KeypadMinus))
                {
                    if (Settings.cameraEnabled)
                    {
                        if (cameraMovementButton != null)
                        {
                            Settings.moveCamera = !Settings.moveCamera;
                            cameraMovementButton.setText("Camera\nMovement\n<color=#845bff>" + (Settings.moveCamera ? "Camera" : "Viewer") + "</color>");
                            VRCUtils.QueueHudMessage("Camera Movement set to " + (Settings.moveCamera ? "Camera" : "Viewer"));
                        }
                    }
                }
            }
        }
示例#22
0
        // This is a mess please don't look
        // and also pull request to improve it thx
        public override void OnUpdate()
        {
            // Testing

            /*if (Input.GetKeyDown(KeyCode.F1)) {
             *  MelonLogger.Msg("test");
             *  var viewFinder = CameraUtils.GetPinsHolder().transform.Find("button-Pin-1");
             *  var components = viewFinder.GetComponents<Component>();
             *  for (int i = 0; i < components.Length; i++) {
             *      var component = components[i];
             *      MelonLogger.Msg(i + " - " + component.name + " - " + component.GetIl2CppType().Name);
             *  }
             *  var childCount = viewFinder.transform.childCount;
             *  for (int i = 0; i < childCount; i++) {
             *      var child = viewFinder.transform.GetChild(i);
             *      MelonLogger.Log(child.name + " - " + child.GetIl2CppType().Name);
             *  }
             * }*/
            if (Settings.cameraEnabled && Settings.arrowKeysEnabled)
            {
                var cameraRotation    = CameraUtils.worldCameraQuaternion.ToEuler();
                var actualCameraSpeed = (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt))
                    ? CameraSpeedAlt
                    : CameraSpeed;
                if (Input.GetKey(KeyCode.DownArrow))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            if (Settings.rotateAroundUserCamera)
                            {
                                CameraUtils.RotateAround(VRCUtils.GetMainCamera().transform.position,
                                                         VRCUtils.GetMainCamera().transform.up,
                                                         (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -2f : -1f);
                            }
                            else
                            {
                                CameraUtils.worldCameraVector -= new Vector3(
                                    (float)Math.Sin(cameraRotation.y) * actualCameraSpeed, 0f,
                                    (float)Math.Cos(cameraRotation.y) * actualCameraSpeed);
                            }
                        }
                    }
                    else
                    {
                        CameraUtils.GetViewFinder().transform.localPosition += new Vector3(0f, 0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -0.01f : -0.005f);
                    }
                }
                if (Input.GetKey(KeyCode.UpArrow))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            if (Settings.rotateAroundUserCamera)
                            {
                                CameraUtils.RotateAround(VRCUtils.GetMainCamera().transform.position, VRCUtils.GetMainCamera().transform.up, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 2f : 1f);
                            }
                            else
                            {
                                CameraUtils.worldCameraVector += new Vector3(
                                    (float)Math.Sin(cameraRotation.y) * actualCameraSpeed, 0f,
                                    (float)Math.Cos(cameraRotation.y) * actualCameraSpeed);
                            }
                        }
                    }
                    else
                    {
                        CameraUtils.GetViewFinder().transform.localPosition += new Vector3(0f, 0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 0.01f : 0.005f);
                    }
                }
                if (Input.GetKey(KeyCode.PageUp))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            if (Settings.rotateAroundUserCamera)
                            {
                                CameraUtils.RotateAround(VRCUtils.GetMainCamera().transform.position, VRCUtils.GetMainCamera().transform.right, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -2f : -1f);
                            }
                            else
                            {
                                CameraUtils.worldCameraVector += new Vector3(0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? CameraSpeedAlt : CameraSpeed, 0f);
                            }
                        }
                    }
                    else
                    {
                        if (Settings.rotateAroundUserCamera)
                        {
                            CameraUtils.GetViewFinder().transform.RotateAround(VRCUtils.GetMainCamera().transform.position, VRCUtils.GetMainCamera().transform.right, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -2f : -1f);
                        }
                        else
                        {
                            CameraUtils.GetViewFinder().transform.localPosition += new Vector3(0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 0.01f : 0.005f, 0f);
                        }
                    }
                }
                if (Input.GetKey(KeyCode.PageDown))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            if (Settings.rotateAroundUserCamera)
                            {
                                CameraUtils.RotateAround(VRCUtils.GetMainCamera().transform.position, VRCUtils.GetMainCamera().transform.right, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 2f : 1f);
                            }
                            else
                            {
                                CameraUtils.worldCameraVector += new Vector3(0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -CameraSpeedAlt : -CameraSpeed, 0f);
                            }
                        }
                    }
                    else
                    {
                        if (Settings.rotateAroundUserCamera)
                        {
                            CameraUtils.GetViewFinder().transform.RotateAround(VRCUtils.GetMainCamera().transform.position, VRCUtils.GetMainCamera().transform.right, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 2f : 1f);
                        }
                        else
                        {
                            CameraUtils.GetViewFinder().transform.localPosition += new Vector3(0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -0.01f : -0.005f, 0f);
                        }
                    }
                }
                if (Input.GetKey(KeyCode.LeftArrow))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            CameraUtils.worldCameraVector -= new Vector3(
                                (float)Math.Cos(cameraRotation.y) * actualCameraSpeed, 0f,
                                (float)-Math.Sin(cameraRotation.y) * actualCameraSpeed);
                        }
                    }
                    else
                    {
                        if (Settings.rotateAroundUserCamera)
                        {
                            CameraUtils.GetViewFinder().transform.RotateAround(VRCUtils.GetMainCamera().transform.position, VRCUtils.GetMainCamera().transform.up, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -2f : -1f);
                        }
                        else
                        {
                            CameraUtils.GetViewFinder().transform.localPosition += new Vector3((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -0.01f : -0.005f, 0f, 0f);
                        }
                    }
                }
                if (Input.GetKey(KeyCode.RightArrow))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            CameraUtils.worldCameraVector += new Vector3(
                                (float)Math.Cos(cameraRotation.y) * actualCameraSpeed, 0f,
                                (float)-Math.Sin(cameraRotation.y) * actualCameraSpeed);
                        }
                    }
                    else
                    {
                        if (Settings.rotateAroundUserCamera)
                        {
                            CameraUtils.GetViewFinder().transform.RotateAround(VRCUtils.GetMainCamera().transform.position, VRCUtils.GetMainCamera().transform.up, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 2f : 1f);
                        }
                        else
                        {
                            CameraUtils.GetViewFinder().transform.localPosition += new Vector3((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 0.01f : 0.005f, 0f, 0f);
                        }
                    }
                }

                // Rotation
                if (Input.GetKey(KeyCode.Keypad8))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            CameraUtils.worldCameraQuaternion *= Quaternion.Euler(Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt) ? -2f : -1f, 0f, 0f);
                        }
                    }
                    else
                    {
                        CameraUtils.GetViewFinder().transform.Rotate(new Vector3((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -2f : -1f, 0f));
                    }
                }
                if (Input.GetKey(KeyCode.Keypad2))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            CameraUtils.worldCameraQuaternion *= Quaternion.Euler(Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt) ? 2f : 1f, 0f, 0f);
                        }
                    }
                    else
                    {
                        CameraUtils.GetViewFinder().transform.Rotate(new Vector3((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 2f : 1f, 0f));
                    }
                }
                if (Input.GetKey(KeyCode.Keypad4))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            CameraUtils.worldCameraQuaternion *= Quaternion.Euler(0f, Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt) ? -2f : -1f, 0f);
                        }
                    }
                    else
                    {
                        CameraUtils.GetViewFinder().transform.Rotate(new Vector3(0f, 0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -2f : -1f));
                    }
                }
                if (Input.GetKey(KeyCode.Keypad6))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            CameraUtils.worldCameraQuaternion *= Quaternion.Euler(0f, Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt) ? 2f : 1f, 0f);
                        }
                    }
                    else
                    {
                        CameraUtils.GetViewFinder().transform.Rotate(new Vector3(0f, 0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 2f : 1f));
                    }
                }
                if (Input.GetKey(KeyCode.Keypad7))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            CameraUtils.worldCameraQuaternion *= Quaternion.Euler(0f, 0f, Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt) ? 2f : 1f);
                        }
                    }
                    else
                    {
                        CameraUtils.GetViewFinder().transform.Rotate(new Vector3(0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -2f : -1f, 0f));
                    }
                }
                if (Input.GetKey(KeyCode.Keypad9))
                {
                    if (Settings.moveCamera)
                    {
                        if (Settings.allowCameraMovement)
                        {
                            CameraUtils.worldCameraQuaternion *= Quaternion.Euler(0f, 0f, Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt) ? -2f : -1f);
                        }
                    }
                    else
                    {
                        CameraUtils.GetViewFinder().transform.Rotate(new Vector3(0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 2f : 1f, 0f));
                    }
                }

                // Reset
                if (Input.GetKeyDown(KeyCode.Keypad3))
                {
                    if (Settings.cameraEnabled)
                    {
                        CameraUtils.ResetCamera();
                    }
                }

                // Look at player
                if (Input.GetKeyDown(KeyCode.Keypad1))
                {
                    if (Settings.cameraEnabled)
                    {
                        CameraUtils.GetViewFinder().transform.LookAt(VRCUtils.GetMainCamera().transform);
                        CameraUtils.GetViewFinder().transform.rotation *= Quaternion.Euler(90f, 0f, 0f);
                    }
                }

                // Take pic
                if (Input.GetKeyDown(KeyCode.KeypadPlus))
                {
                    if (Settings.cameraEnabled)
                    {
                        CameraUtils.TakePicture(0);
                    }
                }

                // Toggle camera movement
                if (Input.GetKeyDown(KeyCode.KeypadMinus))
                {
                    if (Settings.cameraEnabled)
                    {
                        if (cameraMovementButton != null)
                        {
                            Settings.moveCamera = !Settings.moveCamera;
                            cameraMovementButton.setText("Camera\nMovement\n<color=#ff73fa>" + (Settings.moveCamera ? "Camera" : "Viewer") + "</color>");
                            VRCUtils.QueueHudMessage("Camera Movement set to " + (Settings.moveCamera ? "Camera" : "Viewer"));
                        }
                    }
                }
            }
        }
示例#23
0
        public static void EnterWorld(string roomId)
        {
            object currentPortalInfo = Activator.CreateInstance(typeof(WorldTransitionInfo), new object[2] {
                Enum.Parse(transitionInfoEnum, "Menu"), "WorldInfo_Go"
            });

            currentPortalInfo.GetType().GetProperty($"field_Public_{transitionInfoEnum.Name}_0").SetValue(currentPortalInfo, transitionInfoEnum.GetEnumValues().GetValue(3)); //I hate reflection
            enterWorldMethod.Invoke(VRCFlowManager.prop_VRCFlowManager_0, new object[4] {
                roomId, currentPortalInfo, (Il2CppSystem.Action <string>) new Action <string>((str) => VRCUtils.OpenPopupV2("Alert", "Cannot Join World", "Close", new Action(VRCUtils.ClosePopup))), false
            });                                                                                                                                                                                                                                                                        //Just kill me
        }
示例#24
0
        private IEnumerator Setup()
        {
            var request = new UnityWebRequest("https://vrchat.nitro.moe/mods/versioncheck", "POST");

            request.uploadHandler   = new UploadHandlerRaw(Encoding.UTF8.GetBytes("{\"name\":\"" + ModBuildInfo.Name + "\",\"version\":\"" + ModBuildInfo.Version + "\"}"));
            request.downloadHandler = new DownloadHandlerBuffer();
            request.SetRequestHeader("Content-Type", "application/json");

            //yield return request.SendWebRequest();

            MelonLogger.Msg("Checking mod version...");
            var asyncOperation = request.SendWebRequest();

            // yield return doesn't work for now, so I had to change it to this.
            while (!asyncOperation.isDone)
            {
                yield return(new WaitForEndOfFrame());
            }

            bool   updated = true;
            string latest  = "";

            if (!request.isNetworkError && !request.isHttpError)
            {
                try {
                    var response = JsonConvert.DeserializeObject <VersionCheckResponse>(request.downloadHandler.text);
                    if (response.result == "OUTDATED")
                    {
                        updated = false;
                    }
                    latest = response.latest;
                } catch (Exception) {
                    MelonLogger.Error("Failed to check version!");
                }
            }
            else
            {
                MelonLogger.Error("Failed to check version!");
            }

            MelonLogger.Msg(updated ? $"You're updated! Latest version: {latest}" : $"A new version of the mod ({latest}) has been found, please update.");

            var quickMenu = VRCUtils.GetQuickMenu();

            if (!updated)
            {
                quickMenu.transform.Find("ShortcutMenu/CameraButton").GetComponentInChildren <Text>().text = "Camera\n<color=lime>Update\navailable!</color>";
            }

            var cameraMenu = quickMenu.transform.Find("CameraMenu");

            var filtersMenu = UnityEngine.Object.Instantiate(cameraMenu, quickMenu.transform);

            filtersMenu.name = "FiltersMenu";

            var panoramaButton = cameraMenu.Find("Panorama");

            panoramaButton.localPosition = SingleButton.getButtonPositionFor(-1, 0);

            var vrChiveButton = cameraMenu.Find("VRChive");

            vrChiveButton.localPosition = SingleButton.getButtonPositionFor(-1, 1);

            var backButton = cameraMenu.Find("BackButton");

            backButton.localPosition = SingleButton.getButtonPositionFor(4, 2);

            var screenshotButton = cameraMenu.Find("Screenshot");

            screenshotButton.localPosition = SingleButton.getButtonPositionFor(4, 1);

            var qmBoxCollider = quickMenu.GetComponent <BoxCollider>();

            // Thank you JanNyaa (Janni9009#1751) <3
            if (qmBoxCollider.size.y < 3768)
            {
                qmBoxCollider.size += new Vector3(0f, 840f, 0f);
            }
            quickMenu.transform.Find("QuickMenu_NewElements/_CONTEXT/QM_Context_ToolTip/_ToolTipPanel/Text").GetComponent <Text>().supportRichText = true;

            var smoothCameraButton = cameraMenu.Find("SmoothFPVCamera");

            smoothCameraButton.localPosition = SingleButton.getButtonPositionFor(0, 3);

            var photoModeButton = cameraMenu.Find("PhotoMode");

            photoModeButton.localPosition = SingleButton.getButtonPositionFor(1, 3);

            var videoModeButton = cameraMenu.Find("VideoMode");

            videoModeButton.localPosition = SingleButton.getButtonPositionFor(2, 3);

            var disableCameraButton = cameraMenu.Find("DisableCamera");

            disableCameraButton.localPosition = SingleButton.getButtonPositionFor(3, 3);

            // "Create A Developer Light" the f**k even is this
            var lightButton = cameraMenu.Find("Light");

            lightButton.localPosition = SingleButton.getButtonPositionFor(4, 3);


            var cameraButton = new SingleButton("Camera", "Camera\n<color=red>Off</color>", "Toggles the Camera", 0, 0, cameraMenu);

            cameraButton.setAction((Action)(() => {
                Settings.cameraEnabled = !Settings.cameraEnabled;
                cameraButton.setText("Camera\n<color=" + (Settings.cameraEnabled ? "#ff73fa>On" : "red>Off") + "</color>");
                CameraUtils.SetCameraMode(Settings.cameraEnabled ? CameraUtils.CameraMode.Photo : CameraUtils.CameraMode.Off);
            }));

            var movementBehaviourButton = new SingleButton("MovementBehaviour", "Movement\nBehaviour\n<color=#ff73fa>None</color>", "Cycles the Camera's movement behaviour", 1, 0, cameraMenu);

            movementBehaviourButton.setAction((Action)(() => {
                if (Settings.cameraEnabled)
                {
                    var cameraBehaviour = CameraUtils.GetCameraBehaviour();
                    string behaviour = "?";
                    switch (cameraBehaviour)
                    {
                    case CameraUtils.CameraBehaviour.None:
                        behaviour = "Smooth";
                        break;

                    case CameraUtils.CameraBehaviour.Smooth:
                        behaviour = "Look At";
                        break;

                    case CameraUtils.CameraBehaviour.LookAt:
                        behaviour = "None";
                        break;
                    }
                    movementBehaviourButton.setText("Movement\nBehaviour\n<color=#ff73fa>" + behaviour + "</color>");
                    CameraUtils.CycleCameraBehaviour();
                }
            }));

            var movementSpaceButton = new SingleButton("MovementSpace", "Movement\nSpace\n<color=#ff73fa>Attached</color>", "Cycles the Camera's movement space", 2, 0, cameraMenu);

            movementSpaceButton.setAction((Action)(() => {
                if (Settings.cameraEnabled)
                {
                    var cameraSpace = CameraUtils.GetCameraSpace();
                    string space = "?";
                    switch (cameraSpace)
                    {
                    case CameraUtils.CameraSpace.Attached:
                        space = "Local";
                        break;

                    case CameraUtils.CameraSpace.Local:
                        space = "World";
                        break;

                    case CameraUtils.CameraSpace.World:
                        space = "Attached";
                        break;
                    }
                    movementSpaceButton.setText("Movement\nSpace\n<color=#ff73fa>" + space + "</color>");
                    CameraUtils.CycleCameraSpace();
                    if (CameraUtils.GetCameraSpace() == CameraUtils.CameraSpace.World)
                    {
                        Settings.allowCameraMovement = true;
                    }
                    else
                    {
                        Settings.allowCameraMovement = false;
                    }
                }
            }));

            var pinMenuButton = new SingleButton("PinMenu", "Pin Menu\n<color=red>Off</color>", "Toggles the Pin menu", 0, 1, cameraMenu);

            pinMenuButton.setAction((Action)(() => {
                if (Settings.cameraEnabled)
                {
                    CameraUtils.TogglePinMenu();
                    pinMenuButton.setText("Pin Menu\n<color=" + (CameraUtils.GetPinsHolder().activeSelf ? "#ff73fa>On" : "red>Off") + "</color>");
                }
            }));

            var switchPinButton = new SingleButton("CyclePin", "Cycle Pin\n<color=#ff73fa>Pin 1</color>", "Cycles between 3 pins (aka profiles)", 1, 1, cameraMenu);

            switchPinButton.setAction((Action)(() => {
                if (Settings.cameraEnabled)
                {
                    var currentPin = CameraUtils.GetCurrentPin();
                    string pin = "?";
                    int newPin = 1;
                    switch (currentPin)
                    {
                    case CameraUtils.Pin.Pin1:
                        newPin = 2;
                        pin = "Pin 2";
                        break;

                    case CameraUtils.Pin.Pin2:
                        newPin = 3;
                        pin = "Pin 3";
                        break;

                    case CameraUtils.Pin.Pin3:
                        newPin = 1;
                        pin = "Pin 1";
                        break;
                    }
                    switchPinButton.setText("Cycle Pin\n<color=#ff73fa>" + pin + "</color>");
                    // Needed to initialize the buttons apparently
                    CameraUtils.TogglePinMenu();
                    CameraUtils.TogglePinMenu();
                    CameraUtils.SetPin(newPin);
                }
            }));

            var timer1Button = new SingleButton("Timer1", "Timer\n<color=#ff73fa>3s</color>", "Takes a picture after 3 seconds", 3, 0, cameraMenu);

            timer1Button.setAction((Action)(() => {
                if (Settings.cameraEnabled)
                {
                    CameraUtils.TakePicture(3);
                }
            }));

            var timer2Button = new SingleButton("Timer2", "Timer\n<color=#ff73fa>5s</color>", "Takes a picture after 5 seconds", 3, 1, cameraMenu);

            timer2Button.setAction((Action)(() => {
                if (Settings.cameraEnabled)
                {
                    CameraUtils.TakePicture(5);
                }
            }));

            var timer3Button = new SingleButton("Timer3", "Timer\n<color=#ff73fa>10s</color>", "Takes a picture after 10 seconds", 3, 2, cameraMenu);

            timer3Button.setAction((Action)(() => {
                if (Settings.cameraEnabled)
                {
                    CameraUtils.TakePicture(10);
                }
            }));

            var cameraScaleButton = new SingleButton("CameraScale", "Camera\nScale\n<color=#ff73fa>Normal</color>", "Changes the Camera's scale", 2, 1, cameraMenu);

            cameraScaleButton.setAction((Action)(() => {
                if (Settings.cameraEnabled)
                {
                    string scale = "?";
                    switch (Settings.cameraScale)
                    {
                    case CameraUtils.CameraScale.Normal:
                        scale = "Medium";
                        CameraUtils.GetViewFinder().transform.localScale = new Vector3(1.5f, 1f, 1.5f);
                        Settings.cameraScale = CameraUtils.CameraScale.Medium;
                        break;

                    case CameraUtils.CameraScale.Medium:
                        scale = "Big";
                        CameraUtils.GetViewFinder().transform.localScale = new Vector3(2f, 1f, 2f);
                        Settings.cameraScale = CameraUtils.CameraScale.Big;
                        break;

                    case CameraUtils.CameraScale.Big:
                        scale = "Normal";
                        CameraUtils.GetViewFinder().transform.localScale = new Vector3(1f, 1f, 1f);
                        Settings.cameraScale = CameraUtils.CameraScale.Normal;
                        break;
                    }
                    cameraScaleButton.setText("Camera\nScale\n<color=#ff73fa>" + scale + "</color>");
                }
            }));

            var toggleArrowKeysButton = new SingleButton("ArrowKeys", "Arrow Keys\n<color=#ff73fa>On</color>", "Allows you to change the camera position\nand rotation using arrow keys and numpad keys\n<color=orange>(for more info check the GitHub page)</color>", 0, 2, cameraMenu);

            toggleArrowKeysButton.setAction((Action)(() => {
                Settings.arrowKeysEnabled = !Settings.arrowKeysEnabled;
                toggleArrowKeysButton.setText("Arrow Keys\n<color=" + (Settings.arrowKeysEnabled ? "#ff73fa>On" : "red>Off") + "</color>");
            }));

            var rotateAroundUserCameraButton = new SingleButton("RotateAroundUserCamera", "Rotate\nAround\nUser Camera\n<color=red>Off</color>", "Makes the camera rotate around the user's camera\ninstead of just saying bye bye\n<color=orange>(for more info check the GitHub page)</color>", 1, 2, cameraMenu);

            rotateAroundUserCameraButton.setAction((Action)(() => {
                Settings.rotateAroundUserCamera = !Settings.rotateAroundUserCamera;
                rotateAroundUserCameraButton.setText("Rotate\nAround\nUser Camera\n<color=" + (Settings.rotateAroundUserCamera ? "#ff73fa>On" : "red>Off") + "</color>");
            }));

            var toggleLockButton = new SingleButton("ToggleLock", "Lock\n<color=red>Off</color>", "Toggles the Lock (Camera pickup)", 4, -1, cameraMenu);

            toggleLockButton.setAction((Action)(() => {
                if (Settings.cameraEnabled)
                {
                    toggleLockButton.setText("Lock\n<color=" + (CameraUtils.GetViewFinder().GetComponent <VRC_Pickup>().pickupable ? "#ff73fa>On" : "red>Off") + "</color>");
                    CameraUtils.ToggleLock();
                }
            }));

            var gitHubButton = new SingleButton("GitHubPage", "<color=#ff73fa>" + (updated ? "GitHub\nPage</color>" : "GitHub Page</color>\n<color=lime>Update\navailable!</color>"), "Opens the GitHub page of the mod\n<color=#ff73fa><size=20><b>Mod created by nitro. ♥</b></size></color>\nVersion: " + ModBuildInfo.Version + (updated ? "" : "\n<color=lime>New version found (" + latest + "), update it in the GitHub page.</color>"), -1, -1, cameraMenu);

            gitHubButton.setAction((Action)(() => {
                Application.OpenURL(updated ? "https://github.com/nitrog0d/DesktopCamera" : "https://github.com/nitrog0d/DesktopCamera/releases");
            }));

            var childCount = filtersMenu.transform.childCount;

            for (var i = 0; i < childCount; i++)
            {
                var child = filtersMenu.transform.GetChild(i);
                if (child.name == "BackButton")
                {
                    child.localPosition = SingleButton.getButtonPositionFor(4, 2);
                    child.GetComponent <UiTooltip>().field_Public_String_0 = "Go Back to the Camera Menu";
                    child.GetComponent <Button>().onClick.RemoveAllListeners();
                    child.GetComponent <Button>().onClick.AddListener((Action)(() => {
                        VRCUtils.ShowQuickMenuPage(quickMenu, cameraMenu, "FiltersMenu");
                    }));
                }
                else
                {
                    UnityEngine.Object.Destroy(child.gameObject);
                }
            }

            var filters = new Dictionary <string, string>()
            {
                { "<color=#ff73fa>None</color>", "button-NONE" },
                { "<color=#00a0ff>Blueprint</color>", "Button-Blueprint" },
                { "<color=#20c20e>Code</color>", "Button-Code" },
                { "<color=#ffee7b>Sparkles</color>", "Button-Sparkles" },
                { "<color=#00ff23>Green\nScreen</color>", "Button-GreenScreen" },
                { "<color=#ff0000>G</color><color=#00ff00>l</color><color=#0000ff>i</color><color=#ff0000>t</color><color=#00ff00>c</color><color=#0000ff>h</color>", "Button-Glitch" }, // Sorry
                { "<color=#cd853f>Old Timey</color>", "Button-OLD-TIMEY" },
                { "<color=#a9a9a9>Drawing</color>", "Button-Drawing" },
                { "<color=white><i>Trippy</i></color>", "Button-Trippy" },
                { "<color=#ffffffcc>Local\nAlpha</color>", "Button-LocalAlpha" },
                { "<color=#ffffffcc>Alpha\nTransparent</color>", "Button-ALPHA" },
                { "<color=white>Pixelate</color>", "Button-PIXELS" }
            };

            int row      = 0;
            int position = 0;

            foreach (var filter in filters)
            {
                var button = new SingleButton("Filter" + filter.Value, filter.Key, "Sets the filter to " + filter.Key.Replace("\n", " "), position, row, filtersMenu);
                button.setAction((Action)(() => {
                    if (Settings.cameraEnabled)
                    {
                        // Needed to initialize the buttons apparently
                        CameraUtils.ToggleFilterMenu();
                        CameraUtils.ToggleFilterMenu();
                        CameraUtils.SetFilter(filter.Value);
                    }
                }));
                position++;
                if (position == 4)
                {
                    position = 0;
                    row++;
                }
            }

            var filtersButton = new SingleButton("Filters", "Filters", "Opens the filter menu", 4, 0, cameraMenu);

            filtersButton.setAction((Action)(() => {
                VRCUtils.ShowQuickMenuPage(quickMenu, filtersMenu, cameraMenu.name);
            }));

            cameraMovementButton = new SingleButton("ToggleCameraMovement", "Camera\nMovement\n<color=#ff73fa>Viewer</color>", "Toggles the arrow/numpad keys movement between the actual Camera and the Viewer\nViewer requires Movement Space to be \"World\" <color=orange>(for more info check the GitHub page)</color>", 2, 2, cameraMenu);
            cameraMovementButton.setAction((Action)(() => {
                if (Settings.cameraEnabled)
                {
                    Settings.moveCamera = !Settings.moveCamera;
                    cameraMovementButton.setText("Camera\nMovement\n<color=#ff73fa>" + (Settings.moveCamera ? "Camera" : "Viewer") + "</color>");
                }
            }));
        }