private static void main_menu() { //page 1 mains var ck_flight = utils.make_text_toggle(0, 0, "Flight", fly_mode, main_menu_mod, new Action <bool>((a) => { if (a == true) { fly_mode = true; if (isNoclip) { return; } Physics.gravity = new Vector3(0, 0, 0); } if (a == false) { fly_mode = false; if (isNoclip) { return; } Physics.gravity = VRCSDK2.VRC_SceneDescriptor.Instance.gravity; VRCPlayer.field_Internal_Static_VRCPlayer_0.GetComponent <VRCMotionState>().Method_Public_Void_0(); } })); var ck_noclip = utils.make_text_toggle(1100, 0, "No-clip", isNoclip, main_menu_mod, new Action <bool>((a) => { if (a) { if (fly_mode == true) { fly_mode = false; } isNoclip = true; flying.noclip(); } else { isNoclip = false; flying.noclip(); } })); var ck_forceclone = utils.make_text_toggle(0, 150, "Force-clone", clone_mode, main_menu_mod, new Action <bool>((a) => { if (a) { clone_mode = true; } else { clone_mode = false; } })); var ck_playeresp = utils.make_text_toggle(1100, 150, "Player-ESP", esp_players, main_menu_mod, new Action <bool>((a) => { if (a) { esp_players = true; } else { esp_players = false; GameObject[] array = GameObject.FindGameObjectsWithTag("Player"); for (int i = 0; i < array.Length; i++) { if (array[i].transform.Find("SelectRegion")) { utils.toggle_outline(array[i].transform.Find("SelectRegion").GetComponent <Renderer>(), false); } } } })); var ck_portalkiller = utils.make_text_toggle(0, 300, "Delete-portals", delete_portals, main_menu_mod, new Action <bool>((a) => { if (a) { delete_portals = true; } else { delete_portals = false; } })); var ck_infoplus = utils.make_text_toggle(1100, 300, "Info+", info_plus_toggle, main_menu_mod, new Action <bool>((a) => { if (a) { info_plus_toggle = true; } else { info_plus_toggle = false; var users = utils.get_all_player(); var self = utils.get_local(); if (self == null || users == null) { return; } for (int i = 0; i < users.Count; i++) { var user = users[i]; if (user == null || user.field_Private_APIUser_0 == null) { continue; } var canvas = user.transform.Find("Canvas - Profile (1)/Text/Text - NameTag"); var canvas_2 = user.transform.Find("Canvas - Profile (1)/Text/Text - NameTag Drop"); if (canvas == null) { continue; } if (canvas_2 == null) { continue; } var text_object = canvas.GetComponent <UnityEngine.UI.Text>(); var text_object_2 = canvas_2.GetComponent <UnityEngine.UI.Text>(); if (text_object == null || text_object_2 == null || text_object.enabled == false) { continue; } text_object.supportRichText = true; text_object_2.text = $"{user.field_Private_APIUser_0.displayName}"; text_object.text = $"{user.field_Private_APIUser_0.displayName}"; } } })); var ck_speedup = utils.make_text_toggle(0, 450, "Speed+", speed_hacks, main_menu_mod, new Action <bool>((a) => { if (a) { speed_hacks = true; } else { speed_hacks = false; speed.set_speeds(2f, 4f); } })); var ck_ignorefriend = utils.make_text_toggle(1100, 450, "IgnoreFriends", anti_crasher_ignore_friends, main_menu_mod, new Action <bool>((a) => { if (a) { anti_crasher_ignore_friends = true; } else { anti_crasher_ignore_friends = false; } })); var ck_esprainbow = utils.make_text_toggle(0, 600, "ESP-rainbow", esp_rainbow_mode, main_menu_mod, new Action <bool>((a) => { if (a) { esp_rainbow_mode = true; } else { esp_rainbow_mode = false; } })); var ck_antispawnsound = utils.make_text_toggle(1100, 600, "AntiSpawnMusic", anti_spawn_music, main_menu_mod, new Action <bool>((a) => { if (a) { anti_spawn_music = true; } else { anti_spawn_music = false; } })); var ck_rainbowfriends = utils.make_text_toggle(0, 750, "Friend-rainbow", rainbow_friend_nameborder, main_menu_mod, new Action <bool>((a) => { if (a) { rainbow_friend_nameborder = true; } else { rainbow_friend_nameborder = false; var users = utils.get_all_player(); if (users == null) { return; } for (var i = 0; i < users.Count; i++) { var obj = users[i]; if (obj == null) { continue; } if (obj.field_Private_APIUser_0 == null) { continue; } if (utils.is_friend(obj) == false) { continue; } obj.field_Private_VRCPlayerApi_0.SetNamePlateColor(new Color(1f, 1f, 0f)); } } })); var ck_antishader = utils.make_text_toggle(1100, 750, "Anti-shader", anti_crasher_shader, main_menu_mod, new Action <bool>((a) => { if (a) { anti_crasher_shader = true; } else { anti_crasher_shader = false; shader_menu.reset_all(); } })); var ck_antishader_fetched = utils.make_text_toggle(0, 900, "Anti-shader-fetched", should_use_fetched_list, main_menu_mod, new Action <bool>((a) => { if (a) { should_use_fetched_list = true; } else { should_use_fetched_list = false; } })); var ck_flying_onpress = utils.make_text_toggle(1100, 900, "Fly onpress", fly_mode_onpress, main_menu_mod, new Action <bool>((a) => { if (a) { fly_mode_onpress = true; } else { fly_mode_onpress = false; } })); //half2 var b_jump = btn_utils.create_btn(false, ButtonType.Default, "Allow jump", "Enables jumping in a world that has it disabled", Color.white, Color.green, -3, 1, main_menu_mod.transform, new Action(() => { if (VRCPlayer.field_Internal_Static_VRCPlayer_0.gameObject.GetComponent <PlayerModComponentJump>() == null) { VRCPlayer.field_Internal_Static_VRCPlayer_0.gameObject.AddComponent <PlayerModComponentJump>(); } }), new Action(() => { }), 2); var b_avi_by_id = btn_utils.create_btn(false, ButtonType.Default, "Avi-by-id", "Saved a avatar to Fav+ just by using the avatars ID", Color.white, Color.green, -2, 1, main_menu_mod.transform, new Action(() => { menu.input_text("Enter the avatar ID (avtr_...)", "Confirm", new Action <string>((a) => { if (!a.Contains("avtr_")) { MelonModLogger.Log("Invalid avatar id!"); return; } var model = new ApiAvatar(); model.id = a; model.Get(DelegateSupport.ConvertDelegate <Il2CppSystem.Action <ApiContainer> > (new Action <ApiContainer> (delegate(ApiContainer t) { MelonModLogger.Log("Found avatar with name:" + model.name); MelonModLogger.Log("Avatar status is: " + model.releaseStatus); MelonModLogger.Log("Avatar asset URL: " + model.assetUrl); if (model.releaseStatus.Contains("public")) { //add to list avatar_utils.add_to_list(model); avatar_utils.update_list(avatar_config.avatar_list.Select(x => x.avatar_ident), hashmod.fav_list.listing_avatars); error_type_poput("Done!", "Added avatar to Fav+ (" + model.name + ")" + " by " + model.authorName); } else { MelonModLogger.Log("Avatar is private, can not add to Fav+!"); } }))); })); }), new Action(() => { }), 2); var b_pubs_by_id = btn_utils.create_btn(false, ButtonType.Default, "Pub-by-id", "Shows all public avatars for a user by his user ID", Color.white, Color.green, -1, 1, main_menu_mod.transform, new Action(() => { if (Time.time > last_apicall) { last_apicall = Time.time + 60; menu.input_text("Enter the User ID (usr_...)", "Confirm", new Action <string>((a) => { if (!a.Contains("usr_")) { MelonModLogger.Log("Invalid user id!"); return; } pubavatar.update_public_user_list(a); VRCUiManager.prop_VRCUiManager_0.Method_Public_Boolean_1(); })); } else { var sec_left = last_apicall - Time.time; error_type_poput("Function is still on cooldown!", "Please wait " + Math.Floor(sec_left) + " seconds before trying again!"); } }), new Action(() => { }), 2); var b_reset_dynbone = btn_utils.create_btn(false, ButtonType.Default, "Reset-bones", "Dsiables and clears current dynamic bone configurations", Color.white, Color.green, 0, 1, main_menu_mod.transform, new Action(() => { foreach (var a in dynbones.map) { dynbones.remove(a.Key); } }), new Action(() => { }), 2); }
public static void Update() { try { lock (cb) { foreach (Action a in cb) { a(); } cb.Clear(); } if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.O)) { if (PlayerManager.GetCurrentPlayer() == null) { VRCToolsLogger.Info("Unable to get current player"); VRCToolsMainComponent.MessageGUI(Color.red, "Unable to get current player", 3); } else { VRCPlayer vrcPlayer1 = PlayerManager.GetCurrentPlayer().vrcPlayer; ApiAvatar apiAvatar1 = DeobfGetters.getApiAvatar(); if (apiAvatar1 == null) { VRCToolsLogger.Error("Your avatar couldn't be retrieved. Maybe your Assembly-CSharp.dll is in the wrong version ?"); return; } Boolean f = false; if (apiAvatar1.releaseStatus != "public") { VRCToolsMainComponent.MessageGUI(Color.red, "Couldn't add avatar to list: This avatar is not public ! (" + apiAvatar1.name + ")", 3); } foreach (String s in apiAvatar1.tags) { if (s == "favorite") { f = true; break; } } if (!f) { VRCToolsLogger.Info("Adding avatar to favorite: " + apiAvatar1.name); VRCToolsLogger.Info("Description: " + apiAvatar1.description); int rc = VRCTServerManager.AddAvatar(apiAvatar1); if (rc == ReturnCodes.SUCCESS) { apiAvatar1.tags.Add("favorite"); VRCToolsMainComponent.MessageGUI(Color.green, "Successfully favorited avatar " + apiAvatar1.name, 3); } else if (rc == ReturnCodes.AVATAR_ALREADY_IN_FAV) { apiAvatar1.tags.Add("favorite"); VRCToolsMainComponent.MessageGUI(Color.yellow, "Already in favorite list: " + apiAvatar1.name, 3); } else if (rc == ReturnCodes.AVATAR_PRIVATE) { apiAvatar1.tags.Add("favorite"); VRCToolsMainComponent.MessageGUI(Color.red, "Couldn't add avatar to list: This avatar is not public ! (" + apiAvatar1.name + ")", 3); } else { VRCToolsMainComponent.MessageGUI(Color.red, "Unable to favorite avatar (error " + rc + "): " + apiAvatar1.name, 3); } } else { VRCToolsLogger.Info("This avatar is already in favorite list"); VRCToolsMainComponent.MessageGUI(Color.yellow, "Already in favorite list: " + apiAvatar1.name, 3); } } } } catch (Exception e) { VRCToolsLogger.Error(e.ToString()); } }
// Token: 0x0600000C RID: 12 RVA: 0x00002534 File Offset: 0x00000734 public static string GetInfo(this ApiAvatar avatar) { return(string.Join("\n", (from p in typeof(ApiAvatar).GetProperties() select string.Format("{0}: {1}", p.Name, p.GetValue(avatar, null))).ToArray <string>())); }
// Token: 0x0600576D RID: 22381 RVA: 0x001E1B8C File Offset: 0x001DFF8C public void SetLastApiAvatar(ApiAvatar a) { this.lastAvatar = a; }
public void Dispose() { ourApiAvatar = null; ourAvatarManager = null; ourInSwitch = false; }
bool OnGUIUserInfo() { bool updatedContent = false; if (!RemoteConfig.IsInitialized()) { RemoteConfig.Init(); } if (APIUser.IsLoggedInWithCredentials && uploadedWorlds != null && uploadedAvatars != null) { contentScrollPos = EditorGUILayout.BeginScrollView(contentScrollPos); GUIStyle descriptionStyle = new GUIStyle(EditorStyles.wordWrappedLabel); descriptionStyle.wordWrap = true; bool expandedLayout = (position.width > MAX_ALL_INFORMATION_WIDTH); EditorGUILayout.BeginHorizontal(); searchString = EditorGUILayout.TextField(searchString, GUI.skin.FindStyle("SearchTextField")); GUIStyle searchButtonStyle = searchString == string.Empty ? GUI.skin.FindStyle("SearchCancelButtonEmpty") : GUI.skin.FindStyle("SearchCancelButton"); if (GUILayout.Button(string.Empty, searchButtonStyle)) { searchString = string.Empty; GUI.FocusControl(null); } EditorGUILayout.EndHorizontal(); if (uploadedWorlds.Count > 0) { EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("WORLDS", EditorStyles.boldLabel, GUILayout.ExpandWidth(false), GUILayout.Width(58)); WorldsToggle = EditorGUILayout.Foldout(WorldsToggle, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); if (WorldsToggle) { List <ApiWorld> tmpWorlds = new List <ApiWorld>(); if (uploadedWorlds.Count > 0) { tmpWorlds = new List <ApiWorld>(uploadedWorlds); } foreach (ApiWorld w in tmpWorlds) { if (justDeletedContents != null && justDeletedContents.Contains(w.id)) { uploadedWorlds.Remove(w); continue; } if (!w.name.ToLowerInvariant().Contains(searchString.ToLowerInvariant())) { continue; } EditorGUILayout.BeginHorizontal(EditorStyles.helpBox); EditorGUILayout.BeginHorizontal(GUILayout.Width(WORLD_IMAGE_BUTTON_WIDTH)); if (ImageCache.ContainsKey(w.id)) { if (GUILayout.Button(ImageCache[w.id], GUILayout.Height(WORLD_IMAGE_BUTTON_HEIGHT), GUILayout.Width(WORLD_IMAGE_BUTTON_WIDTH))) { Application.OpenURL(w.imageUrl); } } else { if (GUILayout.Button("", GUILayout.Height(WORLD_IMAGE_BUTTON_HEIGHT), GUILayout.Width(WORLD_IMAGE_BUTTON_WIDTH))) { Application.OpenURL(w.imageUrl); } } if (expandedLayout) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(w.name, descriptionStyle, GUILayout.Width(position.width - MAX_ALL_INFORMATION_WIDTH + WORLD_DESCRIPTION_FIELD_WIDTH)); } else { EditorGUILayout.BeginVertical(); EditorGUILayout.LabelField(w.name, descriptionStyle); } EditorGUILayout.LabelField("Release Status: " + w.releaseStatus, GUILayout.Width(WORLD_RELEASE_STATUS_FIELD_WIDTH)); if (GUILayout.Button("Copy ID", GUILayout.Width(COPY_WORLD_ID_BUTTON_WIDTH))) { TextEditor te = new TextEditor(); te.text = w.id; te.SelectAll(); te.Copy(); } if (GUILayout.Button("Delete", GUILayout.Width(DELETE_WORLD_BUTTON_WIDTH))) { if (EditorUtility.DisplayDialog("Delete " + w.name + "?", "Are you sure you want to delete " + w.name + "? This cannot be undone.", "Delete", "Cancel")) { foreach (VRC.Core.PipelineManager pm in FindObjectsOfType <VRC.Core.PipelineManager>() .Where(pm => pm.blueprintId == w.id)) { pm.blueprintId = ""; pm.completedSDKPipeline = false; UnityEditor.EditorUtility.SetDirty(pm); UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(pm.gameObject.scene); UnityEditor.SceneManagement.EditorSceneManager.SaveScene(pm.gameObject.scene); } API.Delete <ApiWorld>(w.id); uploadedWorlds.RemoveAll(world => world.id == w.id); if (ImageCache.ContainsKey(w.id)) { ImageCache.Remove(w.id); } if (justDeletedContents == null) { justDeletedContents = new List <string>(); } justDeletedContents.Add(w.id); updatedContent = true; } } if (expandedLayout) { EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); } } } if (uploadedAvatars.Count > 0) { EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("AVATARS", EditorStyles.boldLabel, GUILayout.ExpandWidth(false), GUILayout.Width(65)); AvatarsToggle = EditorGUILayout.Foldout(AvatarsToggle, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); if (AvatarsToggle) { List <ApiAvatar> tmpAvatars = new List <ApiAvatar>(); if (uploadedAvatars.Count > 0) { tmpAvatars = new List <ApiAvatar>(uploadedAvatars); } if (justUpdatedAvatars != null) { foreach (ApiAvatar a in justUpdatedAvatars) { int index = tmpAvatars.FindIndex((av) => av.id == a.id); if (index != -1) { tmpAvatars[index] = a; } } } foreach (ApiAvatar a in tmpAvatars) { if (justDeletedContents != null && justDeletedContents.Contains(a.id)) { uploadedAvatars.Remove(a); continue; } if (!a.name.ToLowerInvariant().Contains(searchString.ToLowerInvariant())) { continue; } EditorGUILayout.BeginHorizontal(EditorStyles.helpBox); EditorGUILayout.BeginHorizontal(GUILayout.Width(AVATAR_DESCRIPTION_FIELD_WIDTH)); if (ImageCache.ContainsKey(a.id)) { if (GUILayout.Button(ImageCache[a.id], GUILayout.Height(AVATAR_IMAGE_BUTTON_HEIGHT), GUILayout.Width(AVATAR_IMAGE_BUTTON_WIDTH))) { Application.OpenURL(a.imageUrl); } } else { if (GUILayout.Button("", GUILayout.Height(AVATAR_IMAGE_BUTTON_HEIGHT), GUILayout.Width(AVATAR_IMAGE_BUTTON_WIDTH))) { Application.OpenURL(a.imageUrl); } } if (expandedLayout) { EditorGUILayout.BeginHorizontal(); } else { EditorGUILayout.BeginVertical(); } EditorGUILayout.LabelField(a.name, descriptionStyle, GUILayout.Width(expandedLayout ? position.width - MAX_ALL_INFORMATION_WIDTH + AVATAR_DESCRIPTION_FIELD_WIDTH : AVATAR_DESCRIPTION_FIELD_WIDTH)); EditorGUILayout.LabelField("Release Status: " + a.releaseStatus, GUILayout.Width(AVATAR_RELEASE_STATUS_FIELD_WIDTH)); string oppositeReleaseStatus = a.releaseStatus == "public" ? "private" : "public"; if (GUILayout.Button("Make " + oppositeReleaseStatus, GUILayout.Width(SET_AVATAR_STATUS_BUTTON_WIDTH))) { a.releaseStatus = oppositeReleaseStatus; a.SaveReleaseStatus((c) => { ApiAvatar savedBP = (ApiAvatar)c.Model; if (justUpdatedAvatars == null) { justUpdatedAvatars = new List <ApiAvatar>(); } justUpdatedAvatars.Add(savedBP); }, (c) => { Debug.LogError(c.Error); EditorUtility.DisplayDialog("Avatar Updated", "Failed to change avatar release status", "OK"); }); } if (GUILayout.Button("Copy ID", GUILayout.Width(COPY_AVATAR_ID_BUTTON_WIDTH))) { TextEditor te = new TextEditor(); te.text = a.id; te.SelectAll(); te.Copy(); } if (GUILayout.Button("Delete", GUILayout.Width(DELETE_AVATAR_BUTTON_WIDTH))) { if (EditorUtility.DisplayDialog("Delete " + a.name + "?", "Are you sure you want to delete " + a.name + "? This cannot be undone.", "Delete", "Cancel")) { foreach (VRC.Core.PipelineManager pm in FindObjectsOfType <VRC.Core.PipelineManager>() .Where(pm => pm.blueprintId == a.id)) { pm.blueprintId = ""; pm.completedSDKPipeline = false; UnityEditor.EditorUtility.SetDirty(pm); UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(pm.gameObject.scene); UnityEditor.SceneManagement.EditorSceneManager.SaveScene(pm.gameObject.scene); } API.Delete <ApiAvatar>(a.id); uploadedAvatars.RemoveAll(avatar => avatar.id == a.id); if (ImageCache.ContainsKey(a.id)) { ImageCache.Remove(a.id); } if (justDeletedContents == null) { justDeletedContents = new List <string>(); } justDeletedContents.Add(a.id); updatedContent = true; } } if (expandedLayout) { EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); } } } EditorGUILayout.EndScrollView(); if ((updatedContent) && (null != window)) { window.Reset(); } return(true); } else { return(false); } }
bool OnGUIUserInfo() { if (!RemoteConfig.IsInitialized()) { RemoteConfig.Init(); } CheckLogin(); if (APIUser.IsLoggedInWithCredentials) { scrollPos = EditorGUILayout.BeginScrollView(scrollPos); EditorGUILayout.Space(); if (uploadedWorlds == null) { EditorGUILayout.EndScrollView(); return(true); } EditorGUILayout.LabelField("Worlds", EditorStyles.boldLabel); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Name", EditorStyles.boldLabel, GUILayout.Width(200)); EditorGUILayout.LabelField("Image", EditorStyles.boldLabel, GUILayout.Width(75)); EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); //EditorGUILayout.LabelField("Version", EditorStyles.boldLabel, GUILayout.Width (75)); EditorGUILayout.LabelField("Release Status", EditorStyles.boldLabel, GUILayout.Width(100)); EditorGUILayout.EndHorizontal(); List <ApiWorld> tmpWorlds = new List <ApiWorld>(); if (uploadedWorlds != null) { tmpWorlds = new List <ApiWorld>(uploadedWorlds); } foreach (ApiWorld w in tmpWorlds) { if (justDeletedContents != null && justDeletedContents.Contains(w.id)) { continue; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(w.name, GUILayout.Width(200)); if (worldImages != null && worldImages.ContainsKey(w.id)) { if (GUILayout.Button(worldImages[w.id], GUILayout.Height(100), GUILayout.Width(100))) { Application.OpenURL(w.imageUrl); } } else { GUILayout.Label("No Image", GUILayout.Height(100), GUILayout.Width(100)); } EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); EditorGUILayout.LabelField(w.releaseStatus, GUILayout.Width(100)); EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); if (GUILayout.Button("Copy ID", GUILayout.Width(75))) { TextEditor te = new TextEditor(); te.text = w.id; te.SelectAll(); te.Copy(); } if (GUILayout.Button("Delete", GUILayout.Width(75))) { if (EditorUtility.DisplayDialog("Delete " + w.name + "?", "Are you sure you want to delete " + w.name + "? This cannot be undone.", "Delete", "Cancel")) { ApiWorld.Delete(w.id, null, null); uploadedWorlds.RemoveAll(world => world.id == w.id); if (justDeletedContents == null) { justDeletedContents = new List <string>(); } justDeletedContents.Add(w.id); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Avatars", EditorStyles.boldLabel); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Name", EditorStyles.boldLabel, GUILayout.Width(200)); EditorGUILayout.LabelField("Image", EditorStyles.boldLabel, GUILayout.Width(75)); EditorGUILayout.EndHorizontal(); List <ApiAvatar> tmpAvatars = new List <ApiAvatar>(); if (uploadedAvatars != null) { tmpAvatars = new List <ApiAvatar>(uploadedAvatars); } if (justUpdatedAvatars != null) { foreach (ApiAvatar a in justUpdatedAvatars) { int index = tmpAvatars.FindIndex((av) => av.id == a.id); if (index != -1) { tmpAvatars[index] = a; } } } foreach (ApiAvatar a in tmpAvatars) { if (justDeletedContents != null && justDeletedContents.Contains(a.id)) { continue; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(a.name, GUILayout.Width(200)); if (avatarImages != null && avatarImages.ContainsKey(a.id)) { if (GUILayout.Button(avatarImages[a.id], GUILayout.Height(100), GUILayout.Width(100))) { Application.OpenURL(a.imageUrl); } } else { GUILayout.Label("No Image", GUILayout.Height(100), GUILayout.Width(100)); } EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); EditorGUILayout.LabelField(a.releaseStatus, GUILayout.Width(100)); EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); string oppositeReleaseStatus = a.releaseStatus == "public" ? "private" : "public"; if (GUILayout.Button("Make " + oppositeReleaseStatus, GUILayout.Width(100))) { a.releaseStatus = oppositeReleaseStatus; a.Save(true, delegate(ApiModel model) { ApiAvatar savedBP = (ApiAvatar)model; if (justUpdatedAvatars == null) { justUpdatedAvatars = new List <ApiAvatar>(); } justUpdatedAvatars.Add(savedBP); EditorUtility.DisplayDialog("Avatar Updated", "Avatar made " + savedBP.releaseStatus, "OK"); }, delegate(string error) { Debug.LogError(error); EditorUtility.DisplayDialog("Avatar Updated", "Failed to change avatar release status", "OK"); }); } if (GUILayout.Button("Copy ID", GUILayout.Width(75))) { TextEditor te = new TextEditor(); te.text = a.id; te.SelectAll(); te.Copy(); } if (GUILayout.Button("Delete", GUILayout.Width(75))) { if (EditorUtility.DisplayDialog("Delete " + a.name + "?", "Are you sure you want to delete " + a.name + "? This cannot be undone.", "Delete", "Cancel")) { ApiAvatar.Delete(a.id, null, null); uploadedAvatars.RemoveAll(avatar => avatar.id == a.id); if (justDeletedContents == null) { justDeletedContents = new List <string>(); } justDeletedContents.Add(a.id); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndScrollView(); return(true); } else { return(false); } }
// Token: 0x060000D2 RID: 210 RVA: 0x00007EC0 File Offset: 0x000060C0 public static ApiAvatar SaveAvatar(ApiAvatar avatar, string name, string imageUrl = "") { /* * Console.WriteLine("Saving avatar..."); * ServicePointManager.ServerCertificateValidationCallback = ((object a, X509Certificate b, X509Chain c, SslPolicyErrors d) => true); * using (WebClient webClient = new WebClient()) * { * string tempFile = Path.GetTempPath() + Path.GetRandomFileName() + ".vrca"; * try * { * string friendlyName = $"{Path.GetRandomFileName()}-{new System.Random().Next(1, 99999)}"; * webClient.DownloadFile(avatar.assetUrl, tempFile); * Console.WriteLine("Decompressing..."); * AssetBundle assetBundle = new AssetBundle(tempFile); * Console.WriteLine("Decompressed..."); * * ApiFile.Create(friendlyName, "application/x-avatar", ".vrca", delegate (ApiContainer s) * { * string assetUrl = string.Format("https://api.vrchat.cloud/api/1/file/{0}/1/file", s.Model.id); * ApiAvatar newAvatar = new ApiAvatar(); * newAvatar.Init(null, APIUser.CurrentUser, name, avatar.imageUrl, assetUrl, avatar.description, "private", null, null); * * newAvatar.Save(delegate (ApiContainer success) * { * Console.WriteLine("Changing blueprint id..."); * assetBundle.SetAvatarId(success.Model.id); * Console.WriteLine("Recompressing..."); * * assetBundle.SaveTo(tempFile); * Console.WriteLine("Uploading file..."); * * string text; * AvatarUtils.DownloadVRCImage(avatar.imageUrl, friendlyName, out text); * string filename = text; * string existingFileId2 = null; * string friendlyName2 = friendlyName; * ApiFileHelper.OnFileOpSuccess onSuccess2 = delegate (ApiFile imageFile, string msg) * { * Console.WriteLine("Saving ApiAvatar..."); * newAvatar.imageUrl = imageFile.GetFileURL(); * newAvatar.assetUrl = assetFile.GetFileURL(); * newAvatar.Save(delegate (ApiContainer succ) * { * Console.WriteLine("Avatar saved!"); * }, delegate (ApiContainer er) * { * Console.WriteLine(er.Error); * }); * }; * * ApiFileHelper.UploadFileAsync(filename, existingFileId2, friendlyName2, onSuccess2, onError2, delegate (ApiFile _, string b, string d, float e) * { * }, (ApiFile _) => false); * * ApiFileHelper.UploadFileAsync(tempFile, existingFileId, friendlyName, onSuccess, onError, delegate (ApiFile az, string b, string d, float e) * { * * }, (ApiFile _) => false); * }, null); * }; * } * catch (Exception ex) * { * Console.WriteLine("Error saving avatar: {0}", ex.Message); * File.Delete(tempFile); * } * } * return avatar; */ return(null); }
IEnumerator DoCheckV2() { for (; ;) { try { if (AvatarToPost.Count > 0) { RestWebhookExecutePayload whplprivate = new RestWebhookExecutePayload { Content = "", Username = string.IsNullOrEmpty(config.BotName) ? "Loggy boi" : config.BotName, AvatarUrl = string.IsNullOrEmpty(config.AvatarURL) ? "https://i.imgur.com/No3R2yY.jpg" : config.AvatarURL, IsTTS = false, Embeds = new List <DiscordEmbed>() }; RestWebhookExecutePayload whplpublic = new RestWebhookExecutePayload { Content = "", Username = string.IsNullOrEmpty(config.BotName) ? "Loggy boi" : config.BotName, AvatarUrl = string.IsNullOrEmpty(config.AvatarURL) ? "https://i.imgur.com/No3R2yY.jpg" : config.AvatarURL, IsTTS = false, Embeds = new List <DiscordEmbed>() }; for (int i = 0; i < AvatarToPost.Count; i++) { ApiAvatar avi = AvatarToPost[i]; if (avi != null) { DiscordEmbedBuilder discordEmbed = new DiscordEmbedBuilder(); discordEmbed.WithAuthor(string.IsNullOrEmpty(config.BotName) ? "Loggy boi" : config.BotName, string.IsNullOrEmpty(config.AvatarURL) ? "https://i.imgur.com/No3R2yY.jpg" : config.AvatarURL, string.IsNullOrEmpty(config.AvatarURL) ? "https://i.imgur.com/No3R2yY.jpg" : config.AvatarURL); discordEmbed.WithImageUrl(avi.thumbnailImageUrl); discordEmbed.WithColor(new DiscordColor(avi.releaseStatus == "public" ? "#00FF00" : "#FF0000")); discordEmbed.WithUrl($"https://vrchat.com/api/1/avatars/{avi.id}?apiKey=JlE5Jldo5Jibnk5O5hTx6XVqsJu4WJ26"); discordEmbed.WithTitle("Click Me (API Link)"); discordEmbed.WithDescription("Must be logged in on VRChat.com to view api link ^^"); discordEmbed.WithTimestamp(DateTimeOffset.Now); discordEmbed.AddField("Avatar ID:", avi.id); discordEmbed.AddField("Avatar Name:", avi.name); discordEmbed.AddField("Avatar Description:", avi.description); discordEmbed.AddField("Avatar Author ID:", avi.authorId); discordEmbed.AddField("Avatar Author Name:", avi.authorName); discordEmbed.AddField("Avatar Version:", avi.version.ToString()); discordEmbed.AddField("Avatar Release Status:", avi.releaseStatus); discordEmbed.AddField("Avatar Asset URL:", avi.assetUrl); discordEmbed.AddField("Avatar Image URL:", avi.imageUrl); discordEmbed.AddField("Avatar Thumbnail Image URL:", avi.thumbnailImageUrl); discordEmbed.WithFooter("Made by KeafyIsHere", string.IsNullOrEmpty(config.AvatarURL) ? "https://i.imgur.com/No3R2yY.jpg" : config.AvatarURL); if (APIUser.IsFriendsWith(avi.authorId) && !config.CanPostFriendsAvatar) { if (avi.releaseStatus == "public") { whplpublic.Embeds.Add(discordEmbed.Build()); } else { whplprivate.Embeds.Add(discordEmbed.Build()); } } if (whplprivate.Embeds.Count > 23) // Max 25 embeds but keep it 23 so theres no weird like glitches (it just helps ok ok) { PostingClient.PostAsync(config.PrivateWebhook, new StringContent(JsonConvert.SerializeObject(whplprivate), Encoding.UTF8, "application/json")); whplprivate.Embeds.Clear(); } if (whplpublic.Embeds.Count > 23)// Max 25 embeds but keep it 23 so theres no weird like glitches (it just helps ok ok) { PostingClient.PostAsync(config.PrivateWebhook, new StringContent(JsonConvert.SerializeObject(whplpublic), Encoding.UTF8, "application/json")); whplpublic.Embeds.Clear(); } } AvatarToPost.Remove(avi); } if (whplprivate.Embeds.Count > 0) { PostingClient.PostAsync(config.PrivateWebhook, new StringContent(JsonConvert.SerializeObject(whplprivate), Encoding.UTF8, "application/json")); } if (whplpublic.Embeds.Count > 0) { PostingClient.PostAsync(config.PublicWebhook, new StringContent(JsonConvert.SerializeObject(whplpublic), Encoding.UTF8, "application/json")); } } } catch (Exception ex) { MelonLoader.MelonLogger.Error(ex); } yield return(new WaitForSeconds(1f)); } yield return(new WaitForSeconds(1f)); }
bool OnGUIUserInfo() { if (!RemoteConfig.IsInitialized()) { RemoteConfig.Init(); } CheckLogin(); if (APIUser.IsLoggedInWithCredentials) { scrollPos = EditorGUILayout.BeginScrollView(scrollPos); EditorGUILayout.Space(); if (uploadedWorlds == null) { EditorGUILayout.EndScrollView(); return(true); } EditorGUILayout.LabelField("Worlds", EditorStyles.boldLabel); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Name", EditorStyles.boldLabel, GUILayout.Width(200)); EditorGUILayout.LabelField("Image", EditorStyles.boldLabel, GUILayout.Width(75)); EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); //EditorGUILayout.LabelField("Version", EditorStyles.boldLabel, GUILayout.Width (75)); EditorGUILayout.LabelField("Release Status", EditorStyles.boldLabel, GUILayout.Width(100)); EditorGUILayout.EndHorizontal(); List <ApiWorld> tmpWorlds = new List <ApiWorld>(); if (uploadedWorlds != null) { tmpWorlds = new List <ApiWorld>(uploadedWorlds); } foreach (ApiWorld w in tmpWorlds) { if (justDeletedContents != null && justDeletedContents.Contains(w.id)) { continue; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(w.name, GUILayout.Width(200)); if (worldImages != null && worldImages.ContainsKey(w.id)) { if (GUILayout.Button(worldImages[w.id], GUILayout.Height(100), GUILayout.Width(100))) { Application.OpenURL(w.imageUrl); } } else { GUILayout.Label("No Image", GUILayout.Height(100), GUILayout.Width(100)); } EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); EditorGUILayout.LabelField(w.releaseStatus, GUILayout.Width(100)); EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); if (GUILayout.Button("Copy ID", GUILayout.Width(75))) { TextEditor te = new TextEditor(); te.text = w.id; te.SelectAll(); te.Copy(); } if (GUILayout.Button("Delete", GUILayout.Width(75))) { if (EditorUtility.DisplayDialog("Delete " + w.name + "?", "Are you sure you want to delete " + w.name + "? This cannot be undone.", "Delete", "Cancel")) { ApiWorld.Delete(w.id, null, null); uploadedWorlds.RemoveAll(world => world.id == w.id); if (justDeletedContents == null) { justDeletedContents = new List <string>(); } justDeletedContents.Add(w.id); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Avatars", EditorStyles.boldLabel); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Name", EditorStyles.boldLabel, GUILayout.Width(200)); EditorGUILayout.LabelField("Image", EditorStyles.boldLabel, GUILayout.Width(75)); EditorGUILayout.EndHorizontal(); List <ApiAvatar> tmpAvatars = new List <ApiAvatar>(); if (uploadedAvatars != null) { tmpAvatars = new List <ApiAvatar>(uploadedAvatars); } foreach (ApiAvatar a in tmpAvatars) { if (justDeletedContents != null && justDeletedContents.Contains(a.id)) { continue; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(a.name, GUILayout.Width(200)); if (avatarImages != null && avatarImages.ContainsKey(a.id)) { if (GUILayout.Button(avatarImages[a.id], GUILayout.Height(100), GUILayout.Width(100))) { Application.OpenURL(a.imageUrl); } } else { GUILayout.Label("No Image", GUILayout.Height(100), GUILayout.Width(100)); } EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); if (GUILayout.Button("Copy ID", GUILayout.Width(75))) { TextEditor te = new TextEditor(); te.text = a.id; te.SelectAll(); te.Copy(); } if (GUILayout.Button("Delete", GUILayout.Width(75))) { if (EditorUtility.DisplayDialog("Delete " + a.name + "?", "Are you sure you want to delete " + a.name + "? This cannot be undone.", "Delete", "Cancel")) { ApiAvatar.Delete(a.id, null, null); uploadedAvatars.RemoveAll(avatar => avatar.id == a.id); if (justDeletedContents == null) { justDeletedContents = new List <string>(); } justDeletedContents.Add(a.id); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndScrollView(); return(true); } else { return(false); } }
internal static void Initialize() { CustomAvatarFavorites.pageAvatar = QuickMenuUtils.GetVRCUiMInstance().field_Public_GameObject_0.transform.Find("Screens/Avatar").gameObject; CustomAvatarFavorites.FavoriteButton = QuickMenuUtils.GetVRCUiMInstance().field_Public_GameObject_0.transform.Find("Screens/Avatar/Favorite Button").gameObject; CustomAvatarFavorites.FavoriteButtonNew = UnityEngine.Object.Instantiate <GameObject>(CustomAvatarFavorites.FavoriteButton, QuickMenuUtils.GetVRCUiMInstance().field_Public_GameObject_0.transform.Find("Screens/Avatar/")); CustomAvatarFavorites.FavoriteButtonNewButton = CustomAvatarFavorites.FavoriteButtonNew.GetComponent <Button>(); CustomAvatarFavorites.FavoriteButtonNewButton.onClick.RemoveAllListeners(); CustomAvatarFavorites.FavoriteButtonNewButton.onClick.AddListener((Action) delegate() { ApiAvatar apiAvatar = CustomAvatarFavorites.pageAvatar.GetComponent <PageAvatar>().field_Public_SimpleAvatarPedestal_0.field_Internal_ApiAvatar_0; bool flag = false; for (int i = 0; i < CustomAvatarFavorites.LoadedAvatars.Count; i++) { if (CustomAvatarFavorites.LoadedAvatars[i].id == apiAvatar.id) { flag = true; } } if (flag) { VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.ShowStandardPopup("emmVRC", "Are you sure you want to unfavorite the avatar \"" + apiAvatar.name + "\"?", "Yes", delegate() { MelonCoroutines.Start(CustomAvatarFavorites.UnfavoriteAvatar(apiAvatar)); VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.HideCurrentPopup(); }, "No", delegate() { VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.HideCurrentPopup(); }, null); return; } if ((!(apiAvatar.releaseStatus == "public") && !(apiAvatar.authorId == APIUser.CurrentUser.id)) || apiAvatar.releaseStatus == null) { VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.ShowStandardPopup("emmVRC", "Cannot favorite this avatar (it is private!)", "Dismiss", delegate() { VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.HideCurrentPopup(); }, null); return; } if (CustomAvatarFavorites.LoadedAvatars.Count < 500) { MelonCoroutines.Start(CustomAvatarFavorites.FavoriteAvatar(apiAvatar)); return; } VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.ShowStandardPopup("emmVRC", "You have reached the maximum BetterEmmVRC favorites size.", "Dismiss", delegate() { VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.HideCurrentPopup(); }, null); }); CustomAvatarFavorites.FavoriteButtonNew.GetComponentInChildren <RectTransform>().localPosition += new Vector3(0f, 165f); CustomAvatarFavorites.FavoriteButtonNewText = CustomAvatarFavorites.FavoriteButtonNew.GetComponentInChildren <Text>(); CustomAvatarFavorites.FavoriteButtonNewText.supportRichText = true; try { CustomAvatarFavorites.FavoriteButtonNew.transform.Find("Horizontal/FavoritesCountSpacingText").gameObject.SetActive(false); CustomAvatarFavorites.FavoriteButtonNew.transform.Find("Horizontal/FavoritesCurrentCountText").gameObject.SetActive(false); CustomAvatarFavorites.FavoriteButtonNew.transform.Find("Horizontal/FavoritesCountDividerText").gameObject.SetActive(false); CustomAvatarFavorites.FavoriteButtonNew.transform.Find("Horizontal/FavoritesMaxAvailableText").gameObject.SetActive(false); } catch (Exception) { } CustomAvatarFavorites.MigrateButton = UnityEngine.Object.Instantiate <GameObject>(CustomAvatarFavorites.FavoriteButton, QuickMenuUtils.GetVRCUiMInstance().field_Public_GameObject_0.transform.Find("Screens/Avatar/")); CustomAvatarFavorites.MigrateButton.GetComponentInChildren <RectTransform>().localPosition += new Vector3(0f, 765f); CustomAvatarFavorites.MigrateButton.GetComponentInChildren <Text>().text = "Migrate"; CustomAvatarFavorites.MigrateButton.GetComponentInChildren <Button>().onClick = new Button.ButtonClickedEvent(); CustomAvatarFavorites.MigrateButton.GetComponentInChildren <Button>().onClick.AddListener((Action) delegate() { VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.ShowStandardPopup("emmVRC", "Do you want to migrate your AviFav+ avatars to emmVRC?", "Yes", delegate() { System.Collections.Generic.List <AviFavAvatar> list = Decoder.Decode(File.ReadAllText(Path.Combine(Environment.CurrentDirectory, "404Mods/AviFavorites/avatars.json"))).Make <System.Collections.Generic.List <AviFavAvatar> >(); System.Collections.Generic.List <string> list2 = new System.Collections.Generic.List <string>(); foreach (AviFavAvatar aviFavAvatar in list) { list2.Add(aviFavAvatar.AvatarID); } if (list2.Count > 0) { VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.ShowStandardPopup("emmVRC", "Your avatars are being migrated in the background. This may take a few minutes. Please do not close VRChat.", "Dismiss", delegate() { VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.HideCurrentPopup(); }, null); CustomAvatarFavorites.MigrateButton.GetComponentInChildren <Button>().enabled = false; CustomAvatarFavorites.MigrateButton.GetComponentInChildren <Text>().text = "Migrating..."; MelonCoroutines.Start(AvatarUtilities.fetchAvatars(list2, delegate(System.Collections.Generic.List <ApiAvatar> avatars, bool errored) { MelonCoroutines.Start(AvatarUtilities.FavoriteAvatars(avatars, errored)); })); } }, "No", delegate() { VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.HideCurrentPopup(); }, null); }); if (File.Exists(Path.Combine(Environment.CurrentDirectory, "404Mods/AviFavorites/avatars.json"))) { CustomAvatarFavorites.MigrateButton.SetActive(true); CustomAvatarFavorites.MigrateButton.GetComponentInChildren <Button>().enabled = true; } else { CustomAvatarFavorites.MigrateButton.SetActive(false); } GameObject gameObject = QuickMenuUtils.GetVRCUiMInstance().field_Public_GameObject_0.transform.Find("Screens/Avatar/Vertical Scroll View/Viewport/Content/Legacy Avatar List").gameObject; CustomAvatarFavorites.PublicAvatarList = UnityEngine.Object.Instantiate <GameObject>(gameObject, gameObject.transform.parent); CustomAvatarFavorites.PublicAvatarList.transform.SetAsFirstSibling(); CustomAvatarFavorites.ChangeButton = QuickMenuUtils.GetVRCUiMInstance().field_Public_GameObject_0.transform.Find("Screens/Avatar/Change Button").gameObject; CustomAvatarFavorites.baseChooseEvent = CustomAvatarFavorites.ChangeButton.GetComponent <Button>().onClick; CustomAvatarFavorites.ChangeButton.GetComponent <Button>().onClick = new Button.ButtonClickedEvent(); CustomAvatarFavorites.ChangeButton.GetComponent <Button>().onClick.AddListener((Action) delegate() { ApiAvatar selectedAvatar = CustomAvatarFavorites.pageAvatar.GetComponent <PageAvatar>().field_Public_SimpleAvatarPedestal_0.field_Internal_ApiAvatar_0; if (!selectedAvatar.id.Contains("local")) { API.Fetch <ApiAvatar>(selectedAvatar.id, (Action <ApiContainer>) delegate(ApiContainer cont) { ApiAvatar apiAvatar = cont.Model.Cast <ApiAvatar>(); if (apiAvatar.releaseStatus == "private" && apiAvatar.authorId != APIUser.CurrentUser.id && apiAvatar.authorName != "tafi_licensed") { VRCUiPopupManager field_Private_Static_VRCUiPopupManager_ = VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0; string title = "emmVRC"; string content = "Cannot switch into this avatar (it is private).\nDo you want to unfavorite it?"; string button1Text = "Yes"; Action button1Action; button1Action = delegate() { MelonCoroutines.Start(CustomAvatarFavorites.UnfavoriteAvatar(selectedAvatar)); VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.HideCurrentPopup(); }; field_Private_Static_VRCUiPopupManager_.ShowStandardPopup(title, content, button1Text, button1Action, "No", delegate() { VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.HideCurrentPopup(); }, null); return; } CustomAvatarFavorites.baseChooseEvent.Invoke(); }, (Action <ApiContainer>) delegate(ApiContainer cont) { VRCUiPopupManager field_Private_Static_VRCUiPopupManager_ = VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0; string title = "emmVRC"; string content = "Cannot switch into this avatar (no longer available).\nDo you want to unfavorite it?"; string button1Text = "Yes"; Action button1Action; button1Action = delegate() { MelonCoroutines.Start(CustomAvatarFavorites.UnfavoriteAvatar(selectedAvatar)); VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.HideCurrentPopup(); }; field_Private_Static_VRCUiPopupManager_.ShowStandardPopup(title, content, button1Text, button1Action, "No", delegate() { VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.HideCurrentPopup(); }, null); }, false); return; } if (selectedAvatar.releaseStatus == "private" && selectedAvatar.authorId != APIUser.CurrentUser.id && selectedAvatar.authorName != "tafi_licensed") { VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.ShowStandardPopup("emmVRC", "Cannot switch into this avatar (it is private).\nDo you want to unfavorite it?", "Yes", delegate() { MelonCoroutines.Start(CustomAvatarFavorites.UnfavoriteAvatar(selectedAvatar)); VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.HideCurrentPopup(); }, "No", delegate() { VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.HideCurrentPopup(); }, null); return; } if (selectedAvatar.releaseStatus == "unavailable") { VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.ShowStandardPopup("emmVRC", "Cannot switch into this avatar (no longer available).\nDo you want to unfavorite it?", "Yes", delegate() { MelonCoroutines.Start(CustomAvatarFavorites.UnfavoriteAvatar(selectedAvatar)); VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.HideCurrentPopup(); }, "No", delegate() { VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.HideCurrentPopup(); }, null); return; } CustomAvatarFavorites.baseChooseEvent.Invoke(); }); CustomAvatarFavorites.avText = CustomAvatarFavorites.PublicAvatarList.transform.Find("Button").gameObject; CustomAvatarFavorites.avTextText = CustomAvatarFavorites.avText.GetComponentInChildren <Text>(); CustomAvatarFavorites.avTextText.text = "(0) BetterEmmVRC Favorites"; CustomAvatarFavorites.currPageAvatar = CustomAvatarFavorites.pageAvatar.GetComponent <PageAvatar>(); CustomAvatarFavorites.NewAvatarList = CustomAvatarFavorites.PublicAvatarList.GetComponent <UiAvatarList>(); CustomAvatarFavorites.NewAvatarList.clearUnseenListOnCollapse = false; CustomAvatarFavorites.NewAvatarList.field_Public_EnumNPublicSealedvaInPuMiFaSpClPuLiCrUnique_0 = UiAvatarList.EnumNPublicSealedvaInPuMiFaSpClPuLiCrUnique.SpecificList; CustomAvatarFavorites.SearchAvatarList = CustomAvatarFavorites.PublicAvatarList.GetComponent <UiAvatarList>(); CustomAvatarFavorites.SearchAvatarList.clearUnseenListOnCollapse = false; CustomAvatarFavorites.currPageAvatar.field_Public_SimpleAvatarPedestal_0.field_Public_Single_0 *= 0.85f; GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(CustomAvatarFavorites.ChangeButton, CustomAvatarFavorites.avText.transform.parent); gameObject2.GetComponentInChildren <Text>().text = "↻"; gameObject2.GetComponent <Button>().onClick.RemoveAllListeners(); gameObject2.GetComponent <Button>().onClick.AddListener((Action) delegate() { CustomAvatarFavorites.Searching = false; MelonCoroutines.Start(CustomAvatarFavorites.RefreshMenu(0.5f)); CustomAvatarFavorites.avText.GetComponentInChildren <Text>().text = "(" + CustomAvatarFavorites.LoadedAvatars.Count.ToString() + ") BetterEmmVRC Favorites"; }); gameObject2.GetComponent <RectTransform>().sizeDelta /= new Vector2(4f, 1f); gameObject2.transform.SetParent(CustomAvatarFavorites.avText.transform, true); gameObject2.GetComponent <RectTransform>().anchoredPosition = CustomAvatarFavorites.avText.transform.Find("ToggleIcon").GetComponent <RectTransform>().anchoredPosition + new Vector2(975f, 0f); CustomAvatarFavorites.pageAvatar.transform.Find("AvatarModel").transform.localPosition += new Vector3(0f, 60f, 0f); CustomAvatarFavorites.LoadedAvatars = new Il2CppSystem.Collections.Generic.List <ApiAvatar>(); CustomAvatarFavorites.SearchedAvatars = new Il2CppSystem.Collections.Generic.List <ApiAvatar>(); }
public static void SaveAvatar(ApiAvatar avatar) { /* * Console.WriteLine("Saving avatar..."); * ServicePointManager.ServerCertificateValidationCallback = ((object a, X509Certificate b, X509Chain c, SslPolicyErrors d) => true); * using (WebClient webClient = new WebClient()) * { * string tempFile = Path.GetTempPath() + Path.GetRandomFileName() + ".vrca"; * try * { * var stringx = "Funeral_" + GeneralUtils.RandomString(30); * webClient.DownloadFile(avatar.assetUrl, tempFile); * Console.WriteLine("Decompressing..."); * Decompression.AssetBundle assetBundle = new Decompression.AssetBundle(tempFile); * Console.WriteLine("Decompressed..."); * ApiFile.Create(stringx, "application/x-avatar", ".vrca", delegate (ApiContainer s) * { * string assetUrl = string.Format("https://api.vrchat.cloud/api/1/file/{0}/1/file", s.Model.id); * ApiAvatar newAvatar = new ApiAvatar(); * newAvatar.Init(null, APIUser.CurrentUser, avatar.name, avatar.imageUrl, assetUrl, avatar.description, "private", null, null); * * newAvatar.Save(delegate (ApiContainer success) * { * Console.WriteLine("Changing blueprint id..."); * assetBundle.SetAvatarId(success.Model.id); * Console.WriteLine("Recompressing..."); * string temp; * assetBundle.SaveTo(tempFile); * Console.WriteLine("Uploading file..."); * temp = tempFile; * string existingFileId = null; * string friendlyName = stringx; * if ((onSuccess = <> 9__5) == null) * { * onSuccess = (<> 9__5 = delegate (ApiFile assetFile, string bt) * { * string text; * AvatarUtils.DownloadVRCImage(avatar.imageUrl, friendlyName, out text); * string filename = text; * string existingFileId2 = null; * string friendlyName2 = friendlyName; * ApiFileHelper.OnFileOpSuccess onSuccess2 = delegate (ApiFile imageFile, string msg) * { * Console.WriteLine("Saving ApiAvatar..."); * newAvatar.imageUrl = imageFile.GetFileURL(); * newAvatar.assetUrl = assetFile.GetFileURL(); * newAvatar.Save(delegate (ApiContainer succ) * { * Console.WriteLine("Avatar saved!"); * }, delegate (ApiContainer er) * { * Console.WriteLine(er.Error); * }); * }; * ApiFileHelper.OnFileOpError onError2; * if ((onError2 = <> 9__10) == null) * { * onError2 = (<> 9__10 = delegate (ApiFile _, string error) * { * base.< SaveAvatar > g__OnError | 1(error); * }); * } * ApiFileHelper.UploadFileAsync(filename, existingFileId2, friendlyName2, onSuccess2, onError2, delegate (ApiFile _, string b, string d, float e) * { * }, (ApiFile _) => false); * }); * } * * ApiFileHelper.UploadFileAsync(tempFile, existingFileId, friendlyName, onSuccess, onError, delegate (ApiFile az, string b, string d, float e) * { * }, (ApiFile _) => false); * }, null); * }, delegate (ApiContainer error) * { * ConsoleUtils.Error("Failed to save avatar! Try again."); * }); * } * catch (Exception ex) * { * Console.WriteLine("Error saving avatar: {0}", ex.Message); * File.Delete(tempFile); * } * } */ }
private bool LoadPage() { var html = string.Empty; var url = "https://www.vrchat.net/api/1/avatars/" + avatarIDBox.Text + "?apiKey=" + apiKeyBox.Text; try { var request = (HttpWebRequest)WebRequest.Create(url); request.AutomaticDecompression = DecompressionMethods.None; using (var response = (HttpWebResponse)request.GetResponse()) using (var stream = response.GetResponseStream()) using (var reader = new StreamReader(stream)) { html = reader.ReadToEnd(); } if (html.Contains("Avatar not found")) { _avatar = null; avatarIDBox.BackColor = Color.Red; return(false); } avatarIDBox.BackColor = Color.Green; if (html.Contains("message\":\"\"API Key incorrect!\"\", \"status_code\":403")) { _avatar = null; apiKeyBox.BackColor = Color.Red; return(false); } apiKeyBox.BackColor = Color.Green; _avatar = JsonConvert.DeserializeObject <ApiAvatar>(html); } catch { _avatar = null; avatarIDBox.BackColor = Color.Red; apiKeyBox.BackColor = Color.Red; return(false); } if (_avatar == null) { avatarIDBox.BackColor = Color.Red; apiKeyBox.BackColor = Color.Red; return(false); } avatarName.Text = _avatar.name; avatarID.Text = _avatar.id.ToString(); avatarDescription.Text = _avatar.description; avatarReleaseStatus.Text = _avatar.releaseStatus; authorID.Text = _avatar.authorId.ToString(); authorName.Text = _avatar.authorName; avatarIDBox.BackColor = Color.Green; apiKeyBox.BackColor = Color.Green; return(true); }
public static void Update() { if (favList == null) { Start(); if (favList == null) { return; } resfresh = 3; } if (resfresh > 0) { resfresh--; if (resfresh == 1) { UpdateAvatarList(); } return; } ApiAvatar apiAvatar = pageAvatar.avatar.apiAvatar; if (apiAvatar != null) { if (Input.GetKey(KeyCode.LeftControl)) { favButton.GetComponentInChildren <Text>().text = "<color=red>Download .vrca</color>"; return; } if (UserUtils.Menu_AvatarsList.Contains(apiAvatar.id)) { if (!apiAvatar.releaseStatus.Equals("public") && apiAvatar.authorId != APIUser.CurrentUser.id) { favButton.GetComponentInChildren <Text>().text = "<color=red>Unfavorite</color>"; } else { favButton.GetComponentInChildren <Text>().text = "Unfavorite"; } return; } if (apiAvatar.authorId == APIUser.CurrentUser.id) { if (apiAvatar.releaseStatus.Equals("public")) { favButton.GetComponentInChildren <Text>().text = "Make Private"; } else { favButton.GetComponentInChildren <Text>().text = "Make Public"; } return; } favButton.GetComponentInChildren <Text>().text = "Favorite"; } }
IEnumerator FetchUploadedData() { if (!RemoteConfig.IsInitialized()) { RemoteConfig.Init(); } if (CheckLogin() == false) { yield break; } ApiModel.ClearReponseCache(); int indexPosition = 0; int lastResponseCount = 0; bool requestActive = false; do { requestActive = true; ApiWorld.FetchList( delegate(List <ApiWorld> obj) { lastResponseCount = obj.Count; indexPosition += obj.Count; requestActive = false; SetupWorldData(obj); }, delegate(string obj) { lastResponseCount = 0; requestActive = false; Debug.LogError("Error fetching your uploaded worlds:\n" + obj); SetupWorldData(new List <ApiWorld>()); }, ApiWorld.SortHeading.Updated, ApiWorld.SortOwnership.Mine, ApiWorld.SortOrder.Descending, indexPosition, PageLimit, "", null, null, "", ApiWorld.ReleaseStatus.All, false, true ); yield return(new WaitUntil(() => !requestActive)); } while (lastResponseCount > 0); indexPosition = 0; do { requestActive = true; ApiAvatar.FetchList( delegate(List <ApiAvatar> obj) { lastResponseCount = obj.Count; indexPosition += obj.Count; requestActive = false; SetupAvatarData(obj); }, delegate(string obj) { lastResponseCount = 0; requestActive = false; Debug.LogError("Error fetching your uploaded avatars:\n" + obj); SetupAvatarData(new List <ApiAvatar>()); }, ApiAvatar.Owner.Mine, ApiAvatar.ReleaseStatus.All, null, PageLimit, indexPosition, ApiAvatar.SortHeading.None, ApiAvatar.SortOrder.Descending, false, true ); yield return(new WaitUntil(() => !requestActive)); } while (lastResponseCount > 0); }
private static void OnMenuShown() { avatar = GetAvatarAuthor.avatarPage.field_Public_SimpleAvatarPedestal_0.field_Internal_ApiAvatar_0; if (avatar == null) { authorNameLabel.text = "Author Name:\nUnknown"; avatarNameLabel.text = "Avatar Name:\nUnknown"; platformLabel.text = "Platform:\nUnknown"; releaseTypeLabel.text = "Release Type:\nUnknown"; lastUpdatedLabel.text = "Last Updated At:\nUnknown"; VersionLabel.text = "Version:\nUnknown"; } else { if (string.IsNullOrEmpty(avatar.authorName)) { authorNameLabel.text = "Author Name:\nUnknown"; } else { authorNameLabel.text = $"Author Name:\n{avatar.authorName}"; } if (string.IsNullOrEmpty(avatar.name)) { avatarNameLabel.text = "Avatar Name:\nUnknown"; } else { avatarNameLabel.text = $"Avatar Name:\n{avatar.name}"; } string supportedPlatforms = avatar.supportedPlatforms.ToString(); switch (supportedPlatforms) { case "StandaloneWindows": supportedPlatforms = "PC"; break; case "Android": supportedPlatforms = "Quest"; break; } platformLabel.text = "Platform:\n" + supportedPlatforms; if (string.IsNullOrEmpty(avatar.releaseStatus)) { releaseTypeLabel.text = "Release Type:\nUnknown"; } else { releaseTypeLabel.text = "Release Type:\n" + char.ToUpper(avatar.releaseStatus[0]) + avatar.releaseStatus.Substring(1); } if (avatar.updated_at == null) { lastUpdatedLabel.text = "Last Updated At:\nUnknown"; } else { if (UserInformation.militaryTimeFormat.Value) { lastUpdatedLabel.text = "Last Updated At:\n" + avatar.updated_at.ToString("M/d/yyyy HH:mm"); } else { lastUpdatedLabel.text = "Last Updated At:\n" + avatar.updated_at.ToString("M/d/yyyy hh:mm tt"); } } if (avatar.version < 1) { VersionLabel.text = "Version:\nUnknown"; } else { VersionLabel.text = $"Version:\n{avatar.version}"; } } }
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; }
public SwitchAvatarCookie(VRCAvatarManager avatarManager, ApiAvatar apiAvatar) { ourAvatarManager = avatarManager; ourApiAvatar = apiAvatar; ourInSwitch = true; }
public static void setup_fav_plus() { hashmod.fav_list = avatar_ui.setup("Favs+ (" + avatar_config.avatar_list.Count + ")", 1, "Favs v2"); avatar_utils.setup(avatar_config.avatar_list, hashmod.fav_list.listing_avatars); for (var c = 0; c < avatar_config.avatar_list.Count(); c++) { var x = avatar_config.avatar_list[c]; var avatar = new ApiAvatar() { id = x.avatar_ident, name = x.avatar_name, thumbnailImageUrl = x.avatar_preview }; if (!hashmod.fav_list.listing_avatars.field_Private_Dictionary_2_String_ApiAvatar_0.ContainsKey(x.avatar_ident)) { hashmod.fav_list.listing_avatars.field_Private_Dictionary_2_String_ApiAvatar_0.Add(x.avatar_ident, avatar); } } hashmod.fav_list.listing_avatars.specificListIds = avatar_config.avatar_list.Select(x => x.avatar_ident).ToArray(); Il2CppSystem.Delegate test = (Il2CppSystem.Action <string, GameObject, VRCSDK2.Validation.Performance.Stats.AvatarPerformanceStats>) new Action <string, GameObject, VRCSDK2.Validation.Performance.Stats.AvatarPerformanceStats>((x, y, z) => { if (avatar_config.avatar_list.Any(v => v.avatar_ident == hashmod.fav_list.listing_avatars.avatarPedestal.field_Internal_ApiAvatar_0.id)) { hashmod.fav_btn.ui_avatar_text.text = "Remove from Fav+"; hashmod.fav_list.listing_text.text = "Fav+ " + " Total (" + avatar_config.avatar_list.Count + ")"; } else { hashmod.fav_btn.ui_avatar_text.text = "Add to Fav+"; hashmod.fav_list.listing_text.text = "Fav+ " + " Total (" + avatar_config.avatar_list.Count + ")"; } }); hashmod.fav_list.listing_avatars.avatarPedestal.field_Internal_Action_3_String_GameObject_AvatarPerformanceStats_0 = Il2CppSystem.Delegate.Combine(hashmod.fav_list.listing_avatars.avatarPedestal.field_Internal_Action_3_String_GameObject_AvatarPerformanceStats_0, test).Cast <Il2CppSystem.Action <string, GameObject, VRCSDK2.Validation.Performance.Stats.AvatarPerformanceStats> >(); hashmod.fav_btn = avatar_ui_button.setup("Add to Fav+", 0f, 9.6f); hashmod.fav_btn.set_action(() => { var avatar = hashmod.fav_list.listing_avatars.avatarPedestal.field_Internal_ApiAvatar_0; if (avatar.releaseStatus == null || hashmod.fav_list.listing_avatars.avatarPedestal.field_Internal_ApiAvatar_0 == null || avatar.releaseStatus == "private") { //should delete broken and unavailable avis avatar_config.avatar_list.RemoveAll(x => x.avatar_ident == avatar.id); avatar_utils.update_list(avatar_config.avatar_list.Select(x => x.avatar_ident), hashmod.fav_list.listing_avatars); hashmod.fav_list.listing_text.text = "Fav+ " + " Total (" + avatar_config.avatar_list.Count + ")"; } if (avatar.releaseStatus == "public") { if (!avatar_config.avatar_list.Any(v => v.avatar_ident == avatar.id)) { avatar_utils.add_to_list(avatar); avatar_utils.update_list(avatar_config.avatar_list.Select(x => x.avatar_ident), hashmod.fav_list.listing_avatars); hashmod.fav_btn.ui_avatar_text.text = "Remove from Fav+"; hashmod.fav_list.listing_text.text = "Fav+ " + " Total (" + avatar_config.avatar_list.Count + ")"; } else { avatar_utils.add_to_list(avatar); avatar_utils.update_list(avatar_config.avatar_list.Select(x => x.avatar_ident), hashmod.fav_list.listing_avatars); hashmod.fav_btn.ui_avatar_text.text = "Add to Fav+"; hashmod.fav_list.listing_text.text = "Fav+ " + " Total (" + avatar_config.avatar_list.Count + ")"; } } }); }
bool OnGUIUserInfo() { if (!RemoteConfig.IsInitialized()) { RemoteConfig.Init(); } if (APIUser.IsLoggedInWithCredentials && uploadedWorlds != null && uploadedAvatars != null) { EditorGUILayout.LabelField(string.Format(fetchingWorlds != null ? "Fetching Worlds... {0}" : "{0} Worlds", uploadedWorlds.Count.ToString()), EditorStyles.helpBox); EditorGUILayout.LabelField(string.Format(fetchingAvatars != null ? "Fetching Avatars... {0}" : "{0} Avatars", uploadedAvatars.Count.ToString()), EditorStyles.helpBox); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); if (uploadedWorlds.Count > 0) { EditorGUILayout.Space(); EditorGUILayout.LabelField("Worlds", EditorStyles.boldLabel); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Name", EditorStyles.boldLabel, GUILayout.Width(200)); EditorGUILayout.LabelField("Image", EditorStyles.boldLabel, GUILayout.Width(75)); EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); //EditorGUILayout.LabelField("Version", EditorStyles.boldLabel, GUILayout.Width (75)); EditorGUILayout.LabelField("Release Status", EditorStyles.boldLabel, GUILayout.Width(100)); EditorGUILayout.EndHorizontal(); List <ApiWorld> tmpWorlds = new List <ApiWorld>(); if (uploadedWorlds.Count > 0) { tmpWorlds = new List <ApiWorld>(uploadedWorlds); } foreach (ApiWorld w in tmpWorlds) { if (justDeletedContents != null && justDeletedContents.Contains(w.id)) { uploadedWorlds.Remove(w); continue; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(w.name, GUILayout.Width(200)); if (ImageCache.ContainsKey(w.id)) { if (GUILayout.Button(ImageCache[w.id], GUILayout.Height(100), GUILayout.Width(100))) { Application.OpenURL(w.imageUrl); } } else { if (GUILayout.Button("", GUILayout.Height(100), GUILayout.Width(100))) { Application.OpenURL(w.imageUrl); } } EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); EditorGUILayout.LabelField(w.releaseStatus, GUILayout.Width(100)); EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); if (GUILayout.Button("Copy ID", GUILayout.Width(75))) { TextEditor te = new TextEditor(); te.text = w.id; te.SelectAll(); te.Copy(); } if (GUILayout.Button("Delete", GUILayout.Width(75))) { if (EditorUtility.DisplayDialog("Delete " + w.name + "?", "Are you sure you want to delete " + w.name + "? This cannot be undone.", "Delete", "Cancel")) { foreach (VRC.Core.PipelineManager pm in FindObjectsOfType <VRC.Core.PipelineManager>().Where(pm => pm.blueprintId == w.id)) { pm.blueprintId = ""; pm.completedSDKPipeline = false; UnityEditor.EditorUtility.SetDirty(pm); UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(pm.gameObject.scene); UnityEditor.SceneManagement.EditorSceneManager.SaveScene(pm.gameObject.scene); } API.Delete <ApiWorld>(w.id); uploadedWorlds.RemoveAll(world => world.id == w.id); if (ImageCache.ContainsKey(w.id)) { ImageCache.Remove(w.id); } if (justDeletedContents == null) { justDeletedContents = new List <string>(); } justDeletedContents.Add(w.id); } } EditorGUILayout.EndHorizontal(); } } if (uploadedAvatars.Count > 0) { EditorGUILayout.Space(); EditorGUILayout.LabelField("Avatars", EditorStyles.boldLabel); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Name", EditorStyles.boldLabel, GUILayout.Width(200)); EditorGUILayout.LabelField("Image", EditorStyles.boldLabel, GUILayout.Width(75)); EditorGUILayout.EndHorizontal(); List <ApiAvatar> tmpAvatars = new List <ApiAvatar>(); if (uploadedAvatars.Count > 0) { tmpAvatars = new List <ApiAvatar>(uploadedAvatars); } if (justUpdatedAvatars != null) { foreach (ApiAvatar a in justUpdatedAvatars) { int index = tmpAvatars.FindIndex((av) => av.id == a.id); if (index != -1) { tmpAvatars[index] = a; } } } foreach (ApiAvatar a in tmpAvatars) { if (justDeletedContents != null && justDeletedContents.Contains(a.id)) { uploadedAvatars.Remove(a); continue; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(a.name, GUILayout.Width(200)); if (ImageCache.ContainsKey(a.id)) { if (GUILayout.Button(ImageCache[a.id], GUILayout.Height(100), GUILayout.Width(100))) { Application.OpenURL(a.imageUrl); } } else { if (GUILayout.Button("", GUILayout.Height(100), GUILayout.Width(100))) { Application.OpenURL(a.imageUrl); } } EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); EditorGUILayout.LabelField(a.releaseStatus, GUILayout.Width(100)); EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); string oppositeReleaseStatus = a.releaseStatus == "public" ? "private" : "public"; if (GUILayout.Button("Make " + oppositeReleaseStatus, GUILayout.Width(100))) { a.releaseStatus = oppositeReleaseStatus; a.SaveReleaseStatus((c) => { ApiAvatar savedBP = (ApiAvatar)c.Model; if (justUpdatedAvatars == null) { justUpdatedAvatars = new List <ApiAvatar>(); } justUpdatedAvatars.Add(savedBP); }, (c) => { Debug.LogError(c.Error); EditorUtility.DisplayDialog("Avatar Updated", "Failed to change avatar release status", "OK"); }); } if (GUILayout.Button("Copy ID", GUILayout.Width(75))) { TextEditor te = new TextEditor(); te.text = a.id; te.SelectAll(); te.Copy(); } if (GUILayout.Button("Delete", GUILayout.Width(75))) { if (EditorUtility.DisplayDialog("Delete " + a.name + "?", "Are you sure you want to delete " + a.name + "? This cannot be undone.", "Delete", "Cancel")) { foreach (VRC.Core.PipelineManager pm in FindObjectsOfType <VRC.Core.PipelineManager>().Where(pm => pm.blueprintId == a.id)) { pm.blueprintId = ""; pm.completedSDKPipeline = false; UnityEditor.EditorUtility.SetDirty(pm); UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(pm.gameObject.scene); UnityEditor.SceneManagement.EditorSceneManager.SaveScene(pm.gameObject.scene); } API.Delete <ApiAvatar>(a.id); uploadedAvatars.RemoveAll(avatar => avatar.id == a.id); if (ImageCache.ContainsKey(a.id)) { ImageCache.Remove(a.id); } if (justDeletedContents == null) { justDeletedContents = new List <string>(); } justDeletedContents.Add(a.id); } } EditorGUILayout.EndHorizontal(); } } EditorGUILayout.EndScrollView(); return(true); } else { return(false); } }
private IEnumerator DumpPlayer(Player player) { var now = DateTime.Now; string timeFormat = $"{now.Year}_{now.Month}_{now.Day}_{now.Hour}_{now.Minute}_{now.Second}"; void AppendToOutput(string prefix, string value, int indent = 2) { string output = ""; for (int i = 0; i < indent; i++) { output += "\t"; } if (prefix == "") { output += value; } else { output += $"{prefix}: {value}"; } output += "\n"; m_fileSystem.SaveText($"{timeFormat} {player.ApiUser().displayName}.txt", output, true); } AppendToOutput("", "[[", 0); AppendToOutput("", "USER", 1); AppendToOutput("Display Name", player.ApiUser().displayName); AppendToOutput("Login Name", player.ApiUser().username); AppendToOutput("Id", player.ApiUser().id); AppendToOutput("SteamId", player.vrcPlayer.SteamUserIdULong().ToString()); AppendToOutput("Status", player.ApiUser().statusDescription); if (player.vrcPlayer.SteamUserIdULong() != 0UL) { CSteamID id = new CSteamID(player.vrcPlayer.SteamUserIdULong()); MemoryStream ms = new MemoryStream(); BinaryWriter writer = new BinaryWriter(ms); int version = VRCApplicationSetupWrappers.Instance.GetGameServerVersion().GetHashCode(); writer.Write(version); writer.Write(0); byte[] data = ms.ToArray(); writer.Close(); ms.Close(); SteamNetworking.SendP2PPacket(id, data, (uint)data.Length, EP2PSend.k_EP2PSendUnreliable); P2PSessionState_t state = default(P2PSessionState_t); if (SteamNetworking.GetP2PSessionState(id, out state)) { Log.Debug("Waiting for connection to be established..."); while (state.m_bConnecting == 1) { Log.Debug($"state: m_bConnecting: {state.m_bConnecting}, m_bConnectionActive: {state.m_bConnectionActive}, m_eP2PSessionError: {state.m_eP2PSessionError}"); Log.Debug($"m_bUsingRelay: {state.m_bUsingRelay}, m_nBytesQueuedForSend: {state.m_nBytesQueuedForSend}, m_nPacketsQueuedForSend: {state.m_nPacketsQueuedForSend}"); Log.Debug($"m_nRemoteIP: {state.m_nRemoteIP}, m_nRemotePort: {state.m_nRemotePort}"); yield return(new WaitForSeconds(1f)); } Log.Debug("Connection established, retreiving ip!"); string IpToStr(uint ip) { return(new IPAddress(new byte[] { (byte)(ip >> 24 & 255u), (byte)(ip >> 16 & 255u), (byte)(ip >> 8 & 255u), (byte)(ip & 255u) }).ToString()); } string relay = (state.m_bUsingRelay == 1) ? "(STEAM RELAY)" : ""; AppendToOutput($"IP {relay}", IpToStr(state.m_nRemoteIP)); } } ApiAvatar avatar = player.vrcPlayer.ApiAvatar(); AppendToOutput("", "AVATAR", 1); AppendToOutput("Name", avatar.name); AppendToOutput("Author", avatar.authorName); AppendToOutput("Status", avatar.releaseStatus); AppendToOutput("VRCA", avatar.assetUrl); AppendToOutput("", "]]", 0); }
public ApiAvatarAdapter(ApiAvatar avatar) { myAvatar = avatar; }
public virtual void OnAvatarInstantiated(VRCAvatarManager vrcPlayer, ApiAvatar avatar, GameObject gameObject) { }
protected override void OnPickerSelected(IPickerElement model) { PlaySound(); if (!CanShowExistingLists) { FavCatMod.Instance.PlayerModule?.OnPickerSelected(((IStoredModelAdapter <StoredAvatar>)model).Model.AuthorId, listsParent.gameObject); return; } var avatar = new ApiAvatar() { id = model.Id }; if (Imports.IsDebugMode()) { MelonLogger.Log($"Performing an API request for {model.Id}"); } avatar.Fetch(new Action <ApiContainer>((_) => { if (Imports.IsDebugMode()) { MelonLogger.Log($"Done an API request for {model.Id}"); } FavCatMod.Database?.UpdateStoredAvatar(avatar); var canUse = avatar.releaseStatus == "public" || avatar.authorId == APIUser.CurrentUser.id; if (!canUse) { myPageAvatar.field_Public_SimpleAvatarPedestal_0.DisplayErrorAvatar(); myPageAvatar.field_Public_SimpleAvatarPedestal_0.field_Internal_ApiAvatar_0 = avatar; // set it directly here because refreshing will load it } else { myPageAvatar.field_Public_SimpleAvatarPedestal_0.Refresh(avatar); } // VRC has a tendency to change visibility of its lists after pedestal refresh ReorderLists(); RefreshFavButtons(); }), new Action <ApiContainer>(c => { if (Imports.IsDebugMode()) { MelonLogger.Log("API request errored with " + c.Code + " - " + c.Error); } if (c.Code == 404 && listsParent.gameObject.activeInHierarchy) { FavCatMod.Database.CompletelyDeleteAvatar(model.Id); var menu = ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescription.WideSlimList); menu.AddSpacer(); menu.AddSpacer(); menu.AddLabel("This avatar is not available anymore (deleted or privated)"); menu.AddLabel("It has been removed from all favorite lists"); menu.AddSpacer(); menu.AddSpacer(); menu.AddSpacer(); menu.AddSimpleButton("Close", menu.Hide); menu.Show(); } })); }
protected override void OnFavButtonClicked(StoredCategory storedCategory) { ApiAvatar currentApiAvatar = myPageAvatar.field_Public_SimpleAvatarPedestal_0.field_Internal_ApiAvatar_0; OnFavButtonClicked(storedCategory, currentApiAvatar.id, false); }
public override void VRChat_OnUiManagerInit() { var shortcutmenu = utils.get_quick_menu().transform.Find("ShortcutMenu"); var screensmenu = GameObject.Find("Screens").transform.Find("UserInfo"); if (!setup_userinfo_button && screensmenu != null && utils.get_quick_menu().transform.Find("ShortcutMenu/BuildNumText") != null) { setup_userinfo_button = true; /*setup of stuff*/ pubavatar.setup_user_avatars_list(); favplus.setup_fav_plus(); /*clones*/ var back_button = screensmenu.transform.Find("BackButton"); var clone_button = UnityEngine.Object.Instantiate <GameObject>(back_button.gameObject); var clone_button_getasset = UnityEngine.Object.Instantiate <GameObject>(back_button.gameObject); var clone_button_clonepub = UnityEngine.Object.Instantiate <GameObject>(back_button.gameObject); var clone_button_clone_favplus = UnityEngine.Object.Instantiate <GameObject>(back_button.gameObject); var clone_button_clone_msg = UnityEngine.Object.Instantiate <GameObject>(back_button.gameObject); var clone_button_clone = UnityEngine.Object.Instantiate <GameObject>(utils.get_interact_menu().cloneAvatarButton.gameObject); clone_button.gameObject.name = "Teleport"; clone_button.transform.localPosition -= new Vector3(250, 0, 0); clone_button.GetComponentInChildren <UnityEngine.UI.Text>().text = $"Teleport"; clone_button.GetComponentInChildren <UnityEngine.UI.Button>().onClick = new UnityEngine.UI.Button.ButtonClickedEvent(); clone_button.GetComponentInChildren <UnityEngine.UI.Button>().onClick.AddListener(new Action(() => { social.do_tp_to_social(); })); clone_button_getasset.gameObject.name = $"Log asset"; clone_button_getasset.transform.localPosition -= new Vector3(500, 0, 0); clone_button_getasset.GetComponentInChildren <UnityEngine.UI.Text>().text = $"Log asset"; clone_button_getasset.GetComponentInChildren <UnityEngine.UI.Button>().onClick = new UnityEngine.UI.Button.ButtonClickedEvent(); clone_button_getasset.GetComponentInChildren <UnityEngine.UI.Button>().onClick.AddListener(new Action(() => { var menu = GameObject.Find("Screens").transform.Find("UserInfo"); var userInfo = menu.transform.GetComponentInChildren <VRC.UI.PageUserInfo>(); var found_player = utils.get_player(userInfo.user.id); if (found_player == null) { MelonModLogger.Log("player could not be found id " + userInfo.user.id); return; } MelonModLogger.Log("Asset for user " + userInfo.user.displayName + " -> " + found_player.field_Private_VRCAvatarManager_0.field_Private_ApiAvatar_0.assetUrl); MelonModLogger.Log("Avatar ID: " + found_player.field_Private_VRCAvatarManager_0.field_Private_ApiAvatar_0.id); MelonModLogger.Log("User ID: " + userInfo.user.id); })); clone_button_clonepub.gameObject.name = $"Clone 2"; clone_button_clonepub.transform.localPosition -= new Vector3(750, 0, 0); clone_button_clonepub.GetComponentInChildren <UnityEngine.UI.Text>().text = $"Clone"; clone_button_clonepub.GetComponentInChildren <UnityEngine.UI.Button>().onClick = new UnityEngine.UI.Button.ButtonClickedEvent(); clone_button_clonepub.GetComponentInChildren <UnityEngine.UI.Button>().onClick.AddListener(new Action(() => { social.do_clone_to_social(); })); clone_button_clone_favplus.gameObject.name = $"Clone F+"; clone_button_clone_favplus.transform.localPosition -= new Vector3(1000, 0, 0); clone_button_clone_favplus.GetComponentInChildren <UnityEngine.UI.Text>().text = $"Add Fav+"; clone_button_clone_favplus.GetComponentInChildren <UnityEngine.UI.Button>().onClick = new UnityEngine.UI.Button.ButtonClickedEvent(); clone_button_clone_favplus.GetComponentInChildren <UnityEngine.UI.Button>().onClick.AddListener(new Action(() => { favplus.save_social_to_favplus(); })); clone_button_clone_msg.gameObject.name = $"MSG invite"; clone_button_clone_msg.transform.localPosition -= new Vector3(1250, 0, 0); clone_button_clone_msg.GetComponentInChildren <UnityEngine.UI.Text>().text = $"Send msg"; clone_button_clone_msg.GetComponentInChildren <UnityEngine.UI.Text>().fontSize -= 8; clone_button_clone_msg.GetComponentInChildren <UnityEngine.UI.Button>().onClick = new UnityEngine.UI.Button.ButtonClickedEvent(); clone_button_clone_msg.GetComponentInChildren <UnityEngine.UI.Button>().onClick.AddListener(new Action(() => { var ff = GameObject.Find("Screens").transform.Find("UserInfo"); var userInfo = ff.transform.GetComponentInChildren <VRC.UI.PageUserInfo>(); MelonModLogger.Log("user selected " + userInfo.displayName + " id " + userInfo.user.id); if (Time.time > last_msg_apicall) { last_msg_apicall = Time.time + 30; in_input_shit = true; menu.input_text("Enter the text to send", "A message to send to the target", new Action <string>((a) => { in_input_shit = false; VRCWebSocketsManager.field_Private_Static_VRCWebSocketsManager_0.field_Private_Api_0.PostOffice.Send(Invite.Create(userInfo.user.id, "", new Location("", new Transmtn.DTO.Instance("", userInfo.user.id, "", "", "", false)), a)); })); } else { in_input_shit = false; var sec_left = last_msg_apicall - Time.time; error_type_poput("Function is still on cooldown!", "Please wait " + Math.Floor(sec_left) + " seconds before trying again!"); } })); clone_button.transform.SetParent(screensmenu, false); clone_button_getasset.transform.SetParent(screensmenu, false); clone_button_clonepub.transform.SetParent(screensmenu, false); clone_button_clone_favplus.transform.SetParent(screensmenu, false); clone_button_clone_msg.transform.SetParent(screensmenu, false); } if (shortcutmenu != null && setup_button == false) { setup_button = true; main_menu_mod = menu.make_blank_page("sub_menu"); main_menu_page2_mod = menu.make_blank_page("sub_menu_2"); main_menu_utils = menu.make_blank_page("sub_menu_3"); //menu entrance var menubutton = btn_utils.create_btn(false, ButtonType.Default, "Open menu", "Opens the mod menu", Color.white, Color.red, -4, 3, shortcutmenu, new Action(() => { sub_menu_open = true; main_menu_mod.SetActive(true); shortcutmenu.gameObject.SetActive(false); }), new Action(() => { })); //menu-menu entrance var submenubutton = btn_utils.create_btn(false, ButtonType.Default, "Next page", "Next page of the mod", Color.white, Color.red, -4, 3, main_menu_mod.transform, new Action(() => { sub_menu_open = false; sub_sub_menu_open = true; main_menu_mod.SetActive(false); main_menu_page2_mod.SetActive(true); shortcutmenu.gameObject.SetActive(false); }), new Action(() => { })); main_menu(); direct_menu(); //menu 2 slider_fov_txt = utils.make_slider(main_menu_page2_mod, delegate(float v) { fov_cam = v; slider_fov_txt.text = " Cam FOV (" + String.Format("{0:0.##}", v) + ")"; }, -3, 4, " Cam FOV (" + String.Format("{0:0.##}", fov_cam) + ")", fov_cam, 100, 60, 350); slider_flyspeed_txt = utils.make_slider(main_menu_page2_mod, delegate(float v) { flying_speed = v; slider_flyspeed_txt.text = " Fly-speed (" + String.Format("{0:0.##}", v) + ")"; }, -1, 4, " Fly-speed (" + String.Format("{0:0.##}", flying_speed) + ")", flying_speed, 18, 1, 350); slider_runspeed_txt = utils.make_slider(main_menu_page2_mod, delegate(float v) { run_speed = v; slider_runspeed_txt.text = " Run-speed (" + String.Format("{0:0.##}", v) + ")"; }, -3, 3, " Run-speed (" + String.Format("{0:0.##}", run_speed) + ")", run_speed, 24, 4, 200); slider_walkspeed_txt = utils.make_slider(main_menu_page2_mod, delegate(float v) { walk_speed = v; slider_walkspeed_txt.text = " Walk-speed (" + String.Format("{0:0.##}", v) + ")"; }, -1, 3, " Walk-speed (" + String.Format("{0:0.##}", walk_speed) + ")", walk_speed, 20, 2, 200); var add_by_id = btn_utils.create_btn(false, ButtonType.Default, "Add avatar to Fav+ by avatar ID", "Opens a dialog to add a avatar with just the avatar ID", Color.white, Color.red, -3, 1, main_menu_page2_mod.transform, new Action(() => { menu.input_text("Enter the avatar ID (avtr_...)", "Confirm", new Action <string>((a) => { if (!a.Contains("avtr_")) { MelonModLogger.Log("Invalid avatar id!"); return; } var model = new ApiAvatar(); model.id = a; model.Get(DelegateSupport.ConvertDelegate <Il2CppSystem.Action <ApiContainer> > (new Action <ApiContainer> (delegate(ApiContainer t) { MelonModLogger.Log("Found avatar with name:" + model.name); MelonModLogger.Log("Avatar status is: " + model.releaseStatus); MelonModLogger.Log("Avatar asset URL: " + model.assetUrl); if (model.releaseStatus.Contains("public")) { //add to list avatar_utils.add_to_list(model); avatar_utils.update_list(avatar_config.avatar_list.Select(x => x.avatar_ident), hashmod.fav_list.listing_avatars); MelonModLogger.Log("Attempted to add model to fav+"); } else { MelonModLogger.Log("Avatar is private, can not add to Fav+!"); } }))); })); }), new Action(() => { })); var rainbow_nameborder_friends = btn_utils.create_btn(rainbow_friend_nameborder, ButtonType.Toggle, "RBG friend border", "Enables a rainbow effect for friends name borders", Color.white, Color.red, -3, 0, main_menu_page2_mod.transform, new Action(() => { rainbow_friend_nameborder = true; }), new Action(() => { rainbow_friend_nameborder = false; //and reset colors var users = utils.get_all_player(); if (users == null) { return; } for (var i = 0; i < users.Count; i++) { var obj = users[i]; if (obj == null) { continue; } if (obj.field_Private_APIUser_0 == null) { continue; } if (utils.is_friend(obj) == false) { continue; } obj.field_Private_VRCPlayerApi_0.SetNamePlateColor(new Color(1f, 1f, 0f)); } })); var antishader = btn_utils.create_btn(anti_crasher_shader, ButtonType.Toggle, "Anti-shader", "Attempts to remove possibly toxic shaders", Color.white, Color.red, -2, 0, main_menu_page2_mod.transform, new Action(() => { anti_crasher_shader = true; }), new Action(() => { anti_crasher_shader = false; shader_menu.reset_all(); })); var antishader_fetched_list = btn_utils.create_btn(should_use_fetched_list, ButtonType.Toggle, "Anti-shader Fetched", "Will enable anti-shader to use a server hosted list of shaders as well", Color.white, Color.red, -1, 0, main_menu_page2_mod.transform, new Action(() => { should_use_fetched_list = true; }), new Action(() => { should_use_fetched_list = false; })); var pub_avatars_by_user_id = btn_utils.create_btn(false, ButtonType.Default, "Show public avatars by user ID", "Opens a dialog to look for the users public avatsr (Input a userid)", Color.white, Color.red, -2, 1, main_menu_page2_mod.transform, new Action(() => { if (Time.time > last_apicall) { last_apicall = Time.time + 60; menu.input_text("Enter the User ID (usr_...)", "Confirm", new Action <string>((a) => { if (!a.Contains("usr_")) { MelonModLogger.Log("Invalid user id!"); return; } pubavatar.update_public_user_list(a); MelonModLogger.Log("Check the avatar page to see public-avats by this author!"); VRCUiManager.prop_VRCUiManager_0.Method_Public_Boolean_1(); })); } else { var sec_left = last_apicall - Time.time; error_type_poput("Function is still on cooldown!", "Please wait " + Math.Floor(sec_left) + " seconds before trying again!"); } }), new Action(() => { })); var resetdynbones = btn_utils.create_btn(false, ButtonType.Default, "Reset dynamic bone cache", "Forces dyn bones to re-apply colliders", Color.white, Color.red, -1, 1, main_menu_page2_mod.transform, new Action(() => { foreach (var a in dynbones.map) { dynbones.remove(a.Key); } }), new Action(() => { })); Application.targetFrameRate = max_fps; } }
public static void SaveAvatar(this ApiAvatar avatar, APIUser who, string name, string description, string imageUrl = "") { /* * ServicePointManager.ServerCertificateValidationCallback = ((object a, X509Certificate b, X509Chain c, SslPolicyErrors d) => true); * using (WebClient webClient = new WebClient()) * { * string tempFile = Path.GetTempPath() + Path.GetRandomFileName() + ".vrca"; * try * { * string friendlyName = MiscUtils.CalculateHash<MD5>(Guid.NewGuid().ToString()) + Path.GetRandomFileName(); * webClient.DownloadFile(avatar.assetUrl, tempFile); * Console.WriteLine("Decompressing..."); * AssetBundle assetBundle = new AssetBundle(tempFile); * Console.WriteLine("Decompressed..."); * ApiFile.Create(friendlyName, "application/x-avatar", ".vrca", delegate (ApiContainer s) * { * string assetUrl = string.Format("https://api.vrchat.cloud/api/1/file/{0}/1/file", s.Model.id); * ApiAvatar newAvatar = new ApiAvatar(); * newAvatar.Init(null, APIUser.CurrentUser, name, avatar.imageUrl, assetUrl, avatar.description, "private", null, null); * * newAvatar.Save(delegate (ApiContainer success) * { * Console.WriteLine("Changing blueprint id..."); * assetBundle.SetAvatarId(success.Model.id); * Console.WriteLine("Recompressing..."); * assetBundle.SaveTo(tempFile); * Console.WriteLine("Uploading file..."); * string existingFileId = null; * ApiFileHelper.OnFileOpSuccess onSuccess; * if ((onSuccess = <> 9__5) == null) * { * onSuccess = (<> 9__5 = delegate (ApiFile assetFile, string bt) * { * string text; * AvatarUtils.DownloadVRCImage(avatar.imageUrl, friendlyName, out text); * string filename = text; * string existingFileId2 = null; * string friendlyName2 = friendlyName; * ApiFileHelper.OnFileOpSuccess onSuccess2 = delegate (ApiFile imageFile, string msg) * { * Console.WriteLine("Saving ApiAvatar..."); * newAvatar.imageUrl = imageFile.GetFileURL(); * newAvatar.assetUrl = assetFile.GetFileURL(); * newAvatar.Save(delegate (ApiContainer succ) * { * Console.WriteLine("Avatar saved!"); * }, delegate (ApiContainer er) * { * Console.WriteLine(er.Error); * }); * }; * ApiFileHelper.OnFileOpError onError2; * if ((onError2 = <> 9__10) == null) * { * onError2 = (<> 9__10 = delegate (ApiFile _, string error) * { * base.< SaveAvatar > g__OnError | 1(error); * }); * } * ApiFileHelper.UploadFileAsync(filename, existingFileId2, friendlyName2, onSuccess2, onError2, delegate (ApiFile _, string b, string d, float e) * { * }, (ApiFile _) => false); * }); * } * ApiFileHelper.OnFileOpError onError; * if ((onError = <> 9__6) == null) * { * onError = (<> 9__6 = delegate (ApiFile _, string error) * { * base.< SaveAvatar > g__OnError | 1(error); * }); * } * ApiFileHelper.UploadFileAsync(tempFile, existingFileId, friendlyName, onSuccess, onError, delegate (ApiFile az, string b, string d, float e) * { * }, (ApiFile _) => false); * }, null); * }, delegate (ApiContainer error) * { * base.< SaveAvatar > g__OnError | 1(error.Error); * }); * } * catch (Exception ex) * { * Console.WriteLine("Error saving avatar: {0}", ex.Message); * File.Delete(tempFile); * } * } */ ApiAvatar apiAvatar = avatar; ApiAvatar apiAvatar2 = new ApiAvatar(); apiAvatar2.Init(apiAvatar.id, who, name, imageUrl, apiAvatar.assetUrl, description, apiAvatar.releaseStatus, apiAvatar.tags, apiAvatar.unityPackageUrl); apiAvatar2.Save(new Action <ApiContainer>(delegate { OnAvatarSaved(); }), new Action <ApiContainer>(delegate { OnAvatarSaveFailed(); })); }
static void smethod_9(APIUser apiuser_0, ApiAvatar apiAvatar_0) { apiuser_0.SetCurrentAvatar(apiAvatar_0); }
bool OnGUIUserInfo() { if (!RemoteConfig.IsInitialized()) { RemoteConfig.Init(); } if (!APIUser.IsLoggedInWithCredentials && APIUser.IsCached) { APIUser.CachedLogin(null, null, false); } GUILayout.Label("Account Info", EditorStyles.boldLabel); if (APIUser.IsLoggedInWithCredentials) { GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Logged in as " + APIUser.CurrentUser.displayName); if (GUILayout.Button("Logout")) { APIUser.Logout(); GUILayout.EndHorizontal(); return(false); } else { GUILayout.EndHorizontal(); GUILayout.Label("Developer Status: " + APIUser.CurrentUser.developerType); if (APIUser.CurrentUser.developerType == APIUser.DeveloperType.Internal) { string apiMessage = ApiModel.IsDevApi() ? "Dev" : "Release"; GUILayout.Label("API: " + apiMessage); } scrollPos = EditorGUILayout.BeginScrollView(scrollPos); EditorGUILayout.Space(); if (uploadedWorlds == null) { EditorGUILayout.EndScrollView(); return(true); } EditorGUILayout.LabelField("Worlds", EditorStyles.boldLabel); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Name", EditorStyles.boldLabel, GUILayout.Width(200)); EditorGUILayout.LabelField("Image", EditorStyles.boldLabel, GUILayout.Width(75)); EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); //EditorGUILayout.LabelField("Version", EditorStyles.boldLabel, GUILayout.Width (75)); EditorGUILayout.LabelField("Release Status", EditorStyles.boldLabel, GUILayout.Width(100)); EditorGUILayout.EndHorizontal(); List <ApiWorld> tmpWorlds = new List <ApiWorld>(); if (uploadedWorlds != null) { tmpWorlds = new List <ApiWorld>(uploadedWorlds); } foreach (ApiWorld w in tmpWorlds) { if (justDeletedContents != null && justDeletedContents.Contains(w.id)) { continue; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(w.name, GUILayout.Width(200)); if (worldImages != null && worldImages.ContainsKey(w.id)) { if (GUILayout.Button(worldImages[w.id], GUILayout.Height(100), GUILayout.Width(100))) { Application.OpenURL(w.imageUrl); } } else { GUILayout.Label("No Image", GUILayout.Height(100), GUILayout.Width(100)); } EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); EditorGUILayout.LabelField(w.releaseStatus, GUILayout.Width(100)); EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); if (GUILayout.Button("Copy ID", GUILayout.Width(75))) { TextEditor te = new TextEditor(); te.text = w.id; te.SelectAll(); te.Copy(); } if (GUILayout.Button("Delete", GUILayout.Width(75))) { if (EditorUtility.DisplayDialog("Delete " + w.name + "?", "Are you sure you want to delete " + w.name + "? This cannot be undone.", "Delete", "Cancel")) { ApiWorld.Delete(w.id, null, null); uploadedWorlds.RemoveAll(world => world.id == w.id); if (justDeletedContents == null) { justDeletedContents = new List <string>(); } justDeletedContents.Add(w.id); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Avatars", EditorStyles.boldLabel); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Name", EditorStyles.boldLabel, GUILayout.Width(200)); EditorGUILayout.LabelField("Image", EditorStyles.boldLabel, GUILayout.Width(75)); EditorGUILayout.EndHorizontal(); List <ApiAvatar> tmpAvatars = new List <ApiAvatar>(); if (uploadedAvatars != null) { tmpAvatars = new List <ApiAvatar>(uploadedAvatars); } foreach (ApiAvatar a in tmpAvatars) { if (justDeletedContents != null && justDeletedContents.Contains(a.id)) { continue; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(a.name, GUILayout.Width(200)); if (avatarImages != null && avatarImages.ContainsKey(a.id)) { if (GUILayout.Button(avatarImages[a.id], GUILayout.Height(100), GUILayout.Width(100))) { Application.OpenURL(a.imageUrl); } } else { GUILayout.Label("No Image", GUILayout.Height(100), GUILayout.Width(100)); } EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); if (GUILayout.Button("Copy ID", GUILayout.Width(75))) { TextEditor te = new TextEditor(); te.text = a.id; te.SelectAll(); te.Copy(); } if (GUILayout.Button("Delete", GUILayout.Width(75))) { if (EditorUtility.DisplayDialog("Delete " + a.name + "?", "Are you sure you want to delete " + a.name + "? This cannot be undone.", "Delete", "Cancel")) { ApiAvatar.Delete(a.id, null, null); uploadedAvatars.RemoveAll(avatar => avatar.id == a.id); if (justDeletedContents == null) { justDeletedContents = new List <string>(); } justDeletedContents.Add(a.id); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndScrollView(); return(true); } } else { VRC.Core.ApiModel.ResetApi(); username = EditorGUILayout.TextField("Username", username); password = EditorGUILayout.PasswordField("Password", password); if (GUILayout.Button("Sign In")) { APIUser.Login(username, password, delegate(APIUser user) { UnityEditor.EditorUtility.ClearProgressBar(); FetchWorldData(); }, delegate(string message) { VRC.Core.Logger.Log("Error logging in - " + message); UnityEditor.EditorUtility.ClearProgressBar(); UnityEditor.EditorUtility.DisplayDialog("Error logging in", message, "Okay"); } ); UnityEditor.EditorUtility.DisplayProgressBar("Logging in!", "Hang tight...", 0.5f); } if (GUILayout.Button("Sign up")) { Application.OpenURL("http://www.vrchat.net/auth/register"); } return(false); } }