Beispiel #1
0
        public static void ClearSpecificList(this UiAvatarList list)
        {
            if (fieldCachedSpecificList == null)
            {
                FieldInfo[] npInstFields = typeof(UiAvatarList).GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
                foreach (FieldInfo fi in npInstFields)
                {
                    if (fi.FieldType == typeof(Dictionary <string, ApiAvatar>))
                    {
                        fieldCachedSpecificList = fi;
                        VRCModLogger.Log("fieldCachedSpecificList: " + fieldCachedSpecificList);
                        break;
                    }
                }
                if (fieldCachedSpecificList == null)
                {
                    VRCModLogger.LogError("[AvatarFav] No CachedSpecificList field found in UiAvatarList !");
                    return;
                }
            }
            ((Dictionary <string, ApiAvatar>)fieldCachedSpecificList.GetValue(list)).Clear();
            list.ClearAll();

            VRCModLogger.Log("Number of elements in list after clear: " + ((Dictionary <string, ApiAvatar>)fieldCachedSpecificList.GetValue(list)).Count);
        }
Beispiel #2
0
 //For other lists if needed.
 public static void Refresh(this UiAvatarList value, List <string> list)
 {
     value.field_Private_Dictionary_2_String_ApiAvatar_0.Clear();
     foreach (var t in list)
     {
         value.field_Private_Dictionary_2_String_ApiAvatar_0.Add(t, null);
     }
     value.specificListIds = list.ToArray();
     value.Method_Protected_Virtual_Void_Int32_1(0);
 }
Beispiel #3
0
 public static void update(List <string> arr, UiAvatarList avilist)
 {
     avilist.field_Private_Dictionary_2_String_ApiAvatar_0.Clear();
     foreach (var a in arr)
     {
         avilist.field_Private_Dictionary_2_String_ApiAvatar_0.Add(a, null);
     }
     avilist.specificListIds = arr.ToArray();
     avilist.Method_Protected_Abstract_Virtual_New_Void_Int32_0(0);
 }
Beispiel #4
0
        // Will try and fix the bugs soon

        //Main List Mehtod
        public static void Refresh(this UiAvatarList value, IEnumerable <string> list)
        {
            value.field_Private_Dictionary_2_String_ApiAvatar_0.Clear();
            foreach (var t in list)
            {
                if (!value.field_Private_Dictionary_2_String_ApiAvatar_0.ContainsKey(t))
                {
                    value.field_Private_Dictionary_2_String_ApiAvatar_0.Add(t, null);
                }
            }
            value.specificListIds = list.ToArray();
            //value.Method_Protected_Void_Int32_0(0);
        }
Beispiel #5
0
        // Token: 0x0600077D RID: 1917 RVA: 0x00022CC0 File Offset: 0x00020EC0
        public static void update_list(IEnumerable <string> arr, UiAvatarList avilist)
        {
            avilist.field_Private_Dictionary_2_String_ApiAvatar_0.Clear();
            foreach (string text in arr)
            {
                if (!avilist.field_Private_Dictionary_2_String_ApiAvatar_0.ContainsKey(text))
                {
                    avilist.field_Private_Dictionary_2_String_ApiAvatar_0.Add(text, null);
                }
            }

            avilist.specificListIds = arr.ToArray <string>();
            avilist.Method_Protected_Abstract_Virtual_New_Void_Int32_0(0);
        }
Beispiel #6
0
        private static IEnumerator SetAvatarListAfterDelay(UiAvatarList avatars, Il2CppSystem.Collections.Generic.List <ApiAvatar> models)
        {
            if (models.Count == 0)
            {
                yield break;
            }
            Il2CppSystem.Collections.Generic.List <ApiAvatar> list = new Il2CppSystem.Collections.Generic.List <ApiAvatar>();
            list.Add(models[0]);
            avatars.RenderElement(list);
            yield return(new WaitForSeconds(1f));

            avatars.RenderElement(models);
            yield break;
        }
Beispiel #7
0
        public AvatarListAPI setup(int i, string listname)
        {
            UiAvatarList avatarList = AvatarListAPI.get_avatar_list();

            avatarListAPI.ui_object = UnityEngine.Object.Instantiate <GameObject>(avatarList.gameObject, avatarList.transform.parent);
            avatarListAPI.ui_object.transform.SetSiblingIndex(i);
            avatarListAPI.listing_avatars                           = avatarListAPI.ui_object.gameObject.GetComponent <UiAvatarList>();
            avatarListAPI.listing_button                            = avatarListAPI.listing_avatars.GetComponentInChildren <Button>();
            avatarListAPI.listing_text                              = avatarListAPI.listing_avatars.GetComponentInChildren <Text>();
            avatarListAPI.listing_text.text                         = listname;
            avatarListAPI.listing_avatars.hideWhenEmpty             = true;
            avatarListAPI.listing_avatars.clearUnseenListOnCollapse = true;
            avatarListAPI.ui_object.SetActive(true);
            return(avatarListAPI);
        }
Beispiel #8
0
 public static UiAvatarList get_avatar_list()
 {
     if (AvatarListAPI.ui_avatar_list == null)
     {
         GameObject gameObject = GameObject.Find("/UserInterface/MenuContent/Screens/Avatar").transform.Find("Vertical Scroll View/Viewport/Content").transform.Find("Favorite Avatar List").gameObject;
         gameObject = UnityEngine.Object.Instantiate <GameObject>(gameObject, gameObject.transform.parent);
         gameObject.transform.Find("Button").GetComponentInChildren <Text>().text = "New List";
         UiAvatarList component = gameObject.GetComponent <UiAvatarList>();
         component.category = UiAvatarList.EnumNPublicSealedvaInPuMiFaSpClPuLi9vUnique.SpecificList;
         component.StopAllCoroutines();
         gameObject.SetActive(false);
         AvatarListAPI.ui_avatar_list = component;
     }
     return(AvatarListAPI.ui_avatar_list);
 }
Beispiel #9
0
 public static UiAvatarList get_avatar_list()
 {
     if (ui_avatar_list == null)
     {
         var screens_avatar = GameObject.Find("/UserInterface/MenuContent/Screens/Avatar");
         var vlist          = screens_avatar.transform.Find("Vertical Scroll View/Viewport/Content");
         var favi_list      = vlist.transform.Find("Favorite Avatar List").gameObject;
         favi_list = GameObject.Instantiate(favi_list, favi_list.transform.parent);
         var txt = favi_list.transform.Find("Button");
         txt.GetComponentInChildren <Text>().text = "New List";
         var avi_uilist = favi_list.GetComponent <UiAvatarList>();
         avi_uilist.category = UiAvatarList.EnumNPublicSealedvaInPuMiFaSpClPuLi9vUnique.SpecificList;
         avi_uilist.StopAllCoroutines();
         favi_list.SetActive(false);
         ui_avatar_list = avi_uilist;
     }
     return(ui_avatar_list);
 }
Beispiel #10
0
 public static void setup(List <avatar_struct> avatars, UiAvatarList avilist)
 {
     avilist.field_Private_Dictionary_2_String_ApiAvatar_0.Clear();
     for (var c = 0; c < avatars.Count(); c++)
     {
         var obj     = avatars[c];
         var api_avi = new ApiAvatar()
         {
             id = obj.avatar_ident, thumbnailImageUrl = obj.avatar_preview, name = obj.avatar_name
         };
         if (!avilist.field_Private_Dictionary_2_String_ApiAvatar_0.ContainsKey(obj.avatar_ident))
         {
             avilist.field_Private_Dictionary_2_String_ApiAvatar_0.Add(obj.avatar_ident, api_avi);
         }
     }
     avilist.specificListIds = avatars.Select(x => x.avatar_ident).ToArray();
     avilist.Method_Protected_Abstract_Virtual_New_Void_Int32_0(0);
 }
Beispiel #11
0
        public static void FirstLoad(this UiAvatarList value, List <SavedAvi> list)
        {
            int deleted = 0;

            value.field_Private_Dictionary_2_String_ApiAvatar_0.Clear();
            for (int i = 0; i < list.Count(); i++)
            {
                var t      = list[i];
                var avatar = new ApiAvatar()
                {
                    id = t.AvatarID, name = t.Name, thumbnailImageUrl = t.ThumbnailImageUrl
                };
                avatar.Get(new Action <ApiContainer>(x =>
                {
                    var avi = x.Model as ApiAvatar;
                    if (avatar.releaseStatus == "private")
                    {
                        deleted++;
                        list.Remove(t);
                        return;
                    }
                    else
                    {
                        if (!value.field_Private_Dictionary_2_String_ApiAvatar_0.ContainsKey(t.AvatarID))
                        {
                            value.field_Private_Dictionary_2_String_ApiAvatar_0.Add(t.AvatarID, avatar);
                        }
                    }
                }));
            }
            if (deleted > 0)
            {
                MelonLoader.MelonModLogger.Log($"Deleted {deleted} private avatars.");
                DAvatars = list;
                UpdateAvatars();
            }
            value.specificListIds = list.Select(x => x.AvatarID).ToArray();
            //value.Method_Protected_Virtual_Void_Int32_0(0);
            value.Method_Protected_Virtual_Void_Int32_1(0);
        }
Beispiel #12
0
        // Token: 0x0600077E RID: 1918 RVA: 0x00022D40 File Offset: 0x00020F40
        public static void setup(List <AvatarStruct> avatars, UiAvatarList avilist)
        {
            avilist.field_Private_Dictionary_2_String_ApiAvatar_0.Clear();
            for (int i = 0; i < avatars.Count <AvatarStruct>(); i++)
            {
                AvatarStruct avatar_struct = avatars[i];
                ApiAvatar    apiAvatar     = new ApiAvatar
                {
                    id = avatar_struct.AvatarID,
                    thumbnailImageUrl = avatar_struct.ThumbnailImageUrl,
                    name = avatar_struct.Name
                };

                if (!avilist.field_Private_Dictionary_2_String_ApiAvatar_0.ContainsKey(avatar_struct.AvatarID))
                {
                    avilist.field_Private_Dictionary_2_String_ApiAvatar_0.Add(avatar_struct.AvatarID, apiAvatar);
                }
            }
            avilist.specificListIds = (from x in avatars
                                       select x.AvatarID).ToArray <string>();
            avilist.Method_Protected_Abstract_Virtual_New_Void_Int32_0(0);
        }
Beispiel #13
0
        public static UiAvatarList AddNewList(string title, int index)
        {
            UiAvatarList[] uiAvatarLists = Resources.FindObjectsOfTypeAll <UiAvatarList>();

            if (uiAvatarLists.Length == 0)
            {
                ConSole.Print(ConsoleColor.Red, "[Error]", "uiAvatarLists == 0!");
                return(null);
            }

            UiAvatarList gameFavList = null;

            foreach (UiAvatarList list in uiAvatarLists)
            {
                if (list.name.Contains("Favorite") && !list.name.Contains("Quest"))
                {
                    gameFavList = list;
                    break;
                }
            }

            if (gameFavList == null)
            {
                ConSole.Print(ConsoleColor.Red, "[Error]", "gameFavList not found!");
                return(null);
            }
            UiAvatarList newList = GameObject.Instantiate <UiAvatarList>(gameFavList, gameFavList.transform.parent);


            newList.GetComponentInChildren <Button>(true).GetComponentInChildren <Text>().text = title;
            newList.gameObject.SetActive(true);

            newList.transform.SetSiblingIndex(index);

            newList.category = UiAvatarList.Category.SpecificList;

            return(newList);
        }
Beispiel #14
0
        public static UiAvatarList AddNewList(string title, int index)
        {
            UiAvatarList[] uiAvatarLists = Resources.FindObjectsOfTypeAll <UiAvatarList>();

            if (uiAvatarLists.Length == 0)
            {
                VRCModLogger.LogError("[AvatarFav] No UiAvatarList found !");
                return(null);
            }

            UiAvatarList gameFavList = null;

            foreach (UiAvatarList list in uiAvatarLists)
            {
                if (list.name.Contains("Favorite") && !list.name.Contains("Quest"))
                {
                    gameFavList = list;
                    break;
                }
            }
            if (gameFavList == null)
            {
                VRCModLogger.LogError("[AvatarFav] No UiAvatarList of category other than 0 found !");
                return(null);
            }
            UiAvatarList newList = GameObject.Instantiate(gameFavList, gameFavList.transform.parent);


            newList.GetComponentInChildren <Button>(true).GetComponentInChildren <Text>().text = title;
            newList.gameObject.SetActive(true);

            newList.transform.SetSiblingIndex(index);

            typeof(UiAvatarList).GetField("category", BindingFlags.Public | BindingFlags.Instance).SetValue(newList, 4); // set the category to SpecificList

            return(newList);
        }
Beispiel #15
0
        void OnLevelWasLoaded(int level)
        {
            VRCModLogger.Log("[AvatarFav] OnLevelWasLoaded (" + level + ")");
            if (level == (Application.platform == RuntimePlatform.WindowsPlayer ? 1 : 2) && !alreadyLoaded)
            {
                alreadyLoaded = true;

                if (instance != null)
                {
                    Debug.LogWarning("[AvatarFav] Trying to load the same plugin two time !");
                    return;
                }
                instance = this;
                VRCModLogger.Log("[AvatarFav] Adding button to UI - Looking up for Change Button");
                // Add a "Favorite" / "Unfavorite" button over the "Choose" button of the AvatarPage
                Transform changeButton = null;
                pageAvatar = Resources.FindObjectsOfTypeAll <PageAvatar>().First(p => (changeButton = p.transform.Find("Change Button")) != null);

                VRCModLogger.Log("[AvatarFav] Adding avatar check on Change button");

                baseChooseEvent = changeButton.GetComponent <Button>().onClick;

                changeButton.GetComponent <Button>().onClick = new Button.ButtonClickedEvent();
                changeButton.GetComponent <Button>().onClick.AddListener(() =>
                {
                    VRCModLogger.Log("[AvatarFav] Fetching avatar releaseStatus for " + pageAvatar.avatar.apiAvatar.name + " (" + pageAvatar.avatar.apiAvatar.id + ")");
                    ModManager.StartCoroutine(CheckAndWearAvatar());
                });



                VRCModLogger.Log("[AvatarFav] Adding favorite button to UI - Duplicating Button");
                favButton      = UnityUiUtils.DuplicateButton(changeButton, "Favorite", new Vector2(0, 80));
                favButton.name = "ToggleFavorite";
                favButton.gameObject.SetActive(false);
                favButtonText = favButton.Find("Text").GetComponent <Text>();
                favButton.GetComponent <Button>().interactable = false;

                favButton.GetComponent <Button>().onClick.AddListener(ToggleAvatarFavorite);

                VRCModLogger.Log("[AvatarFav] Storing default AvatarModel position");
                avatarModel             = pageAvatar.transform.Find("AvatarModel");
                baseAvatarModelPosition = avatarModel.localPosition;


                FileInfo[] files = new DirectoryInfo(Environment.CurrentDirectory).GetFiles("Avatars.txt", SearchOption.AllDirectories);
                VRCModLogger.Log("[AvatarFavMod] Found " + files.Length + " Avatars.txt");
                if (files.Length > 0)
                {
                    VRCModLogger.Log("[AvatarFav] Adding import button to UI - Duplicating Button");
                    Transform importButton = UnityUiUtils.DuplicateButton(changeButton, "Import Avatars", new Vector2(0, 0));
                    importButton.name = "ImportAvatars";

                    importButton.GetComponent <RectTransform>().anchoredPosition = new Vector2(560, 371);

                    importButton.GetComponent <Button>().onClick.AddListener(() =>
                    {
                        VRCUiPopupManagerUtils.ShowPopup("AvatarFav", "Do you want to import the public avatars from your VRCheat avatar list ?",
                                                         "Yes", () =>
                        {
                            ModManager.StartCoroutine(VRCheatAvatarfileImporter.ImportAvatarfile());
                        },
                                                         "No", () =>
                        {
                            VRCUiPopupManagerUtils.GetVRCUiPopupManager().HideCurrentPopup();
                        });
                        VRCheatAvatarfileImporter.ImportAvatarfile();
                    });
                }


                favList = AvatarPageHelper.AddNewList("Favorite Avatar List (Unofficial)", 1);



                // Get Getter of VRCUiContentButton.PressAction
                applyAvatarField = typeof(VRCUiContentButton).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).First((field) => field.FieldType == typeof(Action));

                VRCModLogger.Log("[AvatarFav] Registering VRCModNetwork events");
                VRCModNetworkManager.OnAuthenticated += () =>
                {
                    RequestAvatars();
                };

                VRCModNetworkManager.SetRPCListener("slaynash.avatarfav.serverconnected", (senderId, data) => { if (waitingForServer)
                                                                                                                {
                                                                                                                    RequestAvatars();
                                                                                                                }
                                                    });
                VRCModNetworkManager.SetRPCListener("slaynash.avatarfav.error", (senderId, data) => addError = data);
                VRCModNetworkManager.SetRPCListener("slaynash.avatarfav.avatarlistupdated", (senderId, data) =>
                {
                    lock (favoriteAvatarList)
                    {
                        // Update Ui
                        favButton.GetComponent <Button>().interactable = true;
                        SerializableApiAvatar[] serializedAvatars      = SerializableApiAvatar.ParseJson(data);
                        favoriteAvatarList.Clear();
                        foreach (SerializableApiAvatar serializedAvatar in serializedAvatars)
                        {
                            favoriteAvatarList.Add(serializedAvatar.id);
                        }

                        avatarAvailables = true;
                    }
                });



                VRCModLogger.Log("[AvatarFav] Adding avatar search list");

                if (pageAvatar != null)
                {
                    VRCUiPageHeader pageheader = VRCUiManagerUtils.GetVRCUiManager().GetComponentInChildren <VRCUiPageHeader>(true);
                    if (pageheader != null)
                    {
                        searchbar = pageheader.searchBar;
                        if (searchbar != null)
                        {
                            VRCModLogger.Log("[AvatarFav] creating avatar search list");
                            avatarSearchList = AvatarPageHelper.AddNewList("Search Results", 0);
                            avatarSearchList.ClearAll();
                            avatarSearchList.gameObject.SetActive(false);
                            avatarSearchList.collapsedCount   = 50;
                            avatarSearchList.expandedCount    = 50;
                            avatarSearchList.collapseRows     = 5;
                            avatarSearchList.extendRows       = 5;
                            avatarSearchList.contractedHeight = 850f;
                            avatarSearchList.expandedHeight   = 850f;
                            avatarSearchList.GetComponent <LayoutElement>().minWidth = 1600f;
                            avatarSearchList.GetComponentInChildren <GridLayoutGroup>(true).constraintCount = 5;
                            avatarSearchList.expandButton.image.enabled = false;

                            VRCModLogger.Log("[AvatarFav] Overwriting search button");
                            VRCUiManagerUtils.OnPageShown += (page) =>
                            {
                                if (page.GetType() == typeof(PageAvatar))
                                {
                                    UiVRCList[] lists = page.GetComponentsInChildren <UiVRCList>(true);
                                    foreach (UiVRCList list in lists)
                                    {
                                        if (list != avatarSearchList && (list.GetType() != typeof(UiAvatarList) || ((int)categoryField.GetValue(list)) != 0))
                                        {
                                            list.gameObject.SetActive(true);
                                        }
                                        else
                                        {
                                            list.gameObject.SetActive(false);
                                        }
                                    }
                                    VRCModLogger.Log("[AvatarFav] PageAvatar shown. Enabling searchbar next frame");
                                    ModManager.StartCoroutine(EnableSearchbarNextFrame());
                                }
                            };

                            VRCModNetworkManager.SetRPCListener("slaynash.avatarfav.searchresults", (senderid, data) =>
                            {
                                AddMainAction(() =>
                                {
                                    if (data.StartsWith("ERROR"))
                                    {
                                        VRCUiPopupManagerUtils.ShowPopup("AvatarFav", "Unable to fetch avatars: Server returned error: " + data.Substring("ERROR ".Length), "Close", () => VRCUiPopupManagerUtils.GetVRCUiPopupManager().HideCurrentPopup());
                                    }
                                    else
                                    {
                                        avatarSearchList.ClearSpecificList();
                                        if (!avatarSearchList.gameObject.activeSelf)
                                        {
                                            UiVRCList[] lists = pageAvatar.GetComponentsInChildren <UiVRCList>(true);
                                            foreach (UiVRCList list in lists)
                                            {
                                                if (list != avatarSearchList)
                                                {
                                                    list.gameObject.SetActive(false);
                                                }
                                            }
                                        }

                                        SerializableApiAvatar[] serializedAvatars = SerializableApiAvatar.ParseJson(data);

                                        string[] avatarsIds = new string[serializedAvatars.Length];

                                        for (int i = 0; i < serializedAvatars.Length; i++)
                                        {
                                            avatarsIds[i] = serializedAvatars[i].id;
                                        }

                                        avatarSearchList.specificListIds = avatarsIds;
                                        if (avatarSearchList.gameObject.activeSelf)
                                        {
                                            avatarSearchList.Refresh();
                                        }
                                        else
                                        {
                                            avatarSearchList.gameObject.SetActive(true);
                                        }
                                    }
                                });
                            });
                        }
                        else
                        {
                            VRCModLogger.LogError("[AvatarFav] Unable to find search bar");
                        }
                    }
                    else
                    {
                        VRCModLogger.LogError("[AvatarFav] Unable to find page header");
                    }
                }
                else
                {
                    VRCModLogger.LogError("[AvatarFav] Unable to find avatar page");
                }



                VRCModLogger.Log("[AvatarFav] AvatarFav Initialised !");
                initialised = true;
            }
        }
Beispiel #16
0
        public override void VRChat_OnUiManagerInit()
        {
            string DoubleStandards = "emmVRC can be obfuscated but this can't be? Thats a bit shitty.";

            baseButton = Sub.GetUiObject("/Avatar/Stats Button");

            GameObject listObj = Sub.CreateObjectFrom(Sub.GetUiObject("/Avatar").transform.Find("Vertical Scroll View/Viewport/Content").transform.Find("Favorite Avatar List").gameObject);

            listObj.transform.Find("Button").GetComponentInChildren <Text>().text = "Public Avatar List";
            listObj.transform.SetSiblingIndex(0);
            listObj.SetActive(false);

            UiAvatarList listListObj = listObj.GetComponent <UiAvatarList>();

            listListObj.category = (UiAvatarList.EnumNPublicSealedvaInPuMiFaSpClPuLi9vUnique) 4;
            listListObj.StopAllCoroutines();

            Sub.CreateAvatarButton("Get Public Avatars", -(baseButton.GetComponent <RectTransform>().sizeDelta.x) - 10f, 0f, delegate()
            {
                Log("Get Public Avatars button (Avatar Menu) clicked!", true);

                ApiAvatar currentAvatar = listListObj.avatarPedestal.field_Internal_ApiAvatar_0;
                System.Collections.Generic.List <ApiAvatar> avatars = Sub.GetPublicAvatars(currentAvatar.authorId);

                MelonModLogger.Log("Got " + avatars.Count.ToString() + " Public Avatars for user " + currentAvatar.authorName);

                listObj.transform.Find("Button").GetComponentInChildren <Text>().text = "Public Avatars for user " + currentAvatar.authorName;
                listObj.SetActive(true);
                listListObj.field_Private_Dictionary_2_String_ApiAvatar_0.Clear();

                string[] arr = (from avatar in avatars select avatar.id).ToArray();
                foreach (ApiAvatar avatar in avatars)
                {
                    listListObj.field_Private_Dictionary_2_String_ApiAvatar_0.Add(avatar.id, avatar);
                }
                listListObj.specificListIds = arr;
                listListObj.Method_Protected_Abstract_Virtual_New_Void_Int32_0(0);
            }, false, "/Avatar/Favorite Button", 300f);

            Sub.CreateAvatarButton("Random Public Avatar", -(baseButton.GetComponent <RectTransform>().sizeDelta.x) - 10f, 80f, delegate()
            {
                Log("Random Public Avatar button clicked!", true);

                Sub.SwitchPedestalToRandomPublicAvatar();
            }, false, "/Avatar/Favorite Button", 300f);

            Button     SocialAvatarButton = new Button(); // Placehold
            GameObject SocialAvatarObj;

            (SocialAvatarButton, SocialAvatarObj) = Sub.CreateSocialButton("Get Public Avatars", 215f, 19f, delegate()
            {
                Log("Get Public Avatars button (Social Menu) clicked!", true);

                PageUserInfo userInfo = GameObject.Find("Screens").transform.Find("UserInfo").transform.GetComponentInChildren <PageUserInfo>();
                System.Collections.Generic.List <ApiAvatar> avatars = Sub.GetPublicAvatars(userInfo.user.id);

                MelonModLogger.Log("Got " + avatars.Count.ToString() + " Public Avatars for user " + userInfo.user.displayName);

                if (avatars.Count == 0)
                {
                    Sub.DoErrorPopup("Public Avatars for " + userInfo.user.displayName, "No public avatars were found for " + userInfo.user.displayName);
                    return;
                }

                listObj.transform.Find("Button").GetComponentInChildren <Text>().text = "Public Avatars for user " + userInfo.user.displayName;
                listObj.SetActive(true);
                listListObj.field_Private_Dictionary_2_String_ApiAvatar_0.Clear();

                string[] arr = (from avatar in avatars select avatar.id).ToArray();
                foreach (ApiAvatar avatar in avatars)
                {
                    listListObj.field_Private_Dictionary_2_String_ApiAvatar_0.Add(avatar.id, avatar);
                }
                listListObj.specificListIds = arr;
                listListObj.Method_Protected_Abstract_Virtual_New_Void_Int32_0(0);

                // Switch to avatar page
                VRCUiManager.prop_VRCUiManager_0.Method_Public_VRCUiPage_VRCUiPage_0(Sub.GetUiObject("/Avatar").gameObject.GetComponentInChildren <VRCUiPage>());
            }, xsize: 200f);

            Sub.CreateSlider(Sub.GetUiObject("/Avatar/Stats Button").transform.parent, baseButton.transform.localPosition.x, baseButton.transform.localPosition.y + (80f * 3), baseButton.GetComponent <RectTransform>().sizeDelta.x, 0f, 360f, delegate(float val)
            {
                Log("Slider value changed to " + val.ToString(), true);
                try
                {
                    Transform tf = GameObject.Find("Screens").transform.Find("Avatar").GetComponent <PageAvatar>().avatar.field_Private_GameObject_0.transform;

                    tf.localRotation = Quaternion.Euler(new Vector3(0, tf.localRotation.eulerAngles.y + (val - lastVal), 0));

                    lastVal         = val;
                    skipRotationFix = true;
                }
                catch (Exception e)
                {
                    WarnLog("Failed to change avatar preview rotation.", true);
                }
            }, 180f);

            emmCheck = true;
        }