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