Ejemplo n.º 1
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));
            }
        }
Ejemplo n.º 2
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));
        }
Ejemplo n.º 3
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));
        }
Ejemplo n.º 4
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");
                }
            }
        }
Ejemplo n.º 5
0
        public static void FromAvatar()
        {
            UserInfoExtensionsMod.HideAllPopups();

            if (!Utils.StartRequestTimer())
            {
                return;
            }

            isFromSocialPage = false;
            OpenUserInSocialMenu(avatarPage.field_Public_SimpleAvatarPedestal_0.field_Internal_ApiAvatar_0.authorId);
        }
Ejemplo n.º 6
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");
            }
        }
Ejemplo n.º 7
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));
            }
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
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;
            }
        }
Ejemplo n.º 10
0
        public static async void FromSocial()
        {
            UserInfoExtensionsMod.HideAllPopups();

            if (avatarLink == null)
            {
                UiManager.OpenErrorPopup("Something went wrong and the avatar author could not be retreived. Please try again");
                return;
            }

            if (!Utils.StartRequestTimer())
            {
                return;
            }

            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();

                UiManager.OpenErrorPopup("Something went wrong and the avatar author could not be retreived. Please try again");
                return;
            }
        }
Ejemplo n.º 11
0
        public static void ToQuickMenu()
        {
            UserInfoExtensionsMod.HideAllPopups();

            foreach (Player player in PlayerManager.prop_PlayerManager_0.field_Private_List_1_Player_0)
            {
                if (player.prop_APIUser_0 == null)
                {
                    continue;
                }
                if (player.prop_APIUser_0.id == VRCUtils.ActiveUserInUserInfoMenu.id)
                {
                    UiManager.CloseBigMenu();
                    UiManager.OpenQuickMenu();

                    UiManager.OpenUserInQuickMenu(player);

                    return;
                }
            }
            UiManager.OpenSmallPopup("Notice:", "You cannot show this user on the Quick Menu because they are not in the same instance", "Close", new Action(UiManager.ClosePopup));
        }