示例#1
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));
        }
示例#2
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));
            }
        }
示例#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));
        }
示例#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");
                }
            }
        }
示例#5
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;
     }
 }
示例#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");
            }
        }
示例#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));
            }
        }
示例#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);
        }
示例#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;
            }
        }
示例#10
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;
            }
        }
示例#11
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)); }));
示例#12
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
        }