示例#1
0
 public static void Logout()
 {
     signingIn      = false;
     storedUsername = null;
     storedPassword = null;
     VRC.Tools.ClearCookies();
     APIUser.Logout();
 }
示例#2
0
文件: User.cs 项目: Smoothstep/VRChat
 // Token: 0x06005728 RID: 22312 RVA: 0x001E0636 File Offset: 0x001DEA36
 public new static void Logout()
 {
     if (APIUser.CurrentUser != null)
     {
         Analytics.Send(ApiAnalyticEvent.EventType.logout);
     }
     User.mCurrentNonApiUser = null;
     ApiCredentials.Clear();
     APIUser.Logout();
 }
示例#3
0
 public static void Logout()
 {
     signingIn      = false;
     storedUsername = null;
     storedPassword = null;
     VRC.Tools.ClearCookies();
     APIUser.Logout();
     ApiCredentials.Clear();
     refreshWindow = true;
 }
        private static void SignIn(bool explicitAttempt)
        {
            lock (syncObject)
            {
                if (signingIn ||
                    APIUser.IsLoggedInWithCredentials ||
                    (!explicitAttempt && string.IsNullOrEmpty(storedUsername)) ||
                    (!explicitAttempt && string.IsNullOrEmpty(storedPassword)))
                {
                    return;
                }

                signingIn = true;
            }

            Init();

            APIUser.Login(username, password,
                          delegate(ApiModelContainer <APIUser> c)
            {
                APIUser user = c.Model as APIUser;
                if (c.Cookies.ContainsKey("auth"))
                {
                    ApiCredentials.Set(user.username, username, "vrchat", c.Cookies["auth"]);
                }
                signingIn      = false;
                error          = null;
                storedUsername = username;
                storedPassword = password;
                AnalyticsSDK.LoggedInUserChanged(user);

                if (!APIUser.CurrentUser.canPublishAllContent)
                {
                    if (UnityEditor.SessionState.GetString("HasShownContentPublishPermissionsDialogForUser", "") != user.id)
                    {
                        UnityEditor.SessionState.SetString("HasShownContentPublishPermissionsDialogForUser", user.id);
                        VRC_SdkControlPanel.ShowContentPublishPermissionsDialog();
                    }
                }

                refreshWindow = true;
            },
                          delegate(ApiModelContainer <APIUser> c)
            {
                signingIn      = false;
                storedUsername = null;
                storedPassword = null;
                error          = c.Error;
                VRC.Tools.ClearCookies();
                APIUser.Logout();
                refreshWindow = true;
                VRC.Core.Logger.Log("Error logging in: " + error);
            }
                          );
        }
示例#5
0
 public static void Logout(bool set_add_index)
 {
     signingIn = false;
     if (set_add_index)
     {
         selected_user_index = add_index + 1;
     }
     EditorPrefs.SetString("sdk#username", null);
     EditorPrefs.SetString("sdk#password", null);
     VRC.Tools.ClearCookies();
     APIUser.Logout();
 }
示例#6
0
        public static void ClearUserData()
        {
            APIUser.Logout();
            Caching.ClearCache();
            PlayerPrefs.DeleteAll();
            HTTPCacheService.BeginClear();
            string path = Application.get_persistentDataPath() + "/ab";

            if (Directory.Exists(path))
            {
                Directory.Delete(path, recursive: true);
            }
        }
示例#7
0
 public void Logout()
 {
     if (this.UserID == PlayerManager.GetCurrentPlayer().GetUserID())
     {
         APIUser.Logout();
     }
     else
     {
         for (var i = 0; i < 9999; i++)
         {
             var steamID = this.SteamID == 0 ? 0 : this.SteamID;
             //SteamNetworkingAPI.BLIOJBDGJKA.IJCOPIHGDJB(new byte[20000], new byte[2000].Length, steamID);
         }
     }
 }
示例#8
0
        private static void SignIn(bool explicitAttempt)
        {
            lock (syncObject)
            {
                if (signingIn ||
                    APIUser.IsLoggedInWithCredentials ||
                    (!explicitAttempt && string.IsNullOrEmpty(storedUsername)) ||
                    (!explicitAttempt && string.IsNullOrEmpty(storedPassword)))
                {
                    return;
                }

                signingIn = true;
            }

            Init();

            ApiCredentials.Clear();
            ApiCredentials.SetUser(username, password);
            APIUser.Login(
                delegate(APIUser user)
            {
                signingIn      = false;
                error          = null;
                storedUsername = username;
                storedPassword = password;
                AnalyticsSDK.LoggedInUserChanged(user);

                if (!APIUser.CurrentUser.canPublishAllContent)
                {
                    if (UnityEditor.SessionState.GetString("HasShownContentPublishPermissionsDialogForUser", "") != user.id)
                    {
                        UnityEditor.SessionState.SetString("HasShownContentPublishPermissionsDialogForUser", user.id);
                        VRC_SdkControlPanel.ShowContentPublishPermissionsDialog();
                    }
                }
            },
                delegate(string message)
            {
                signingIn      = false;
                storedUsername = null;
                storedPassword = null;
                error          = message;
                APIUser.Logout();
                VRC.Core.Logger.Log("Error logging in: " + message);
            }
                );
        }
示例#9
0
        private static void AuthenticateWithVRChat(System.Action <bool> onAuthed = null)
        {
            System.Action <ApiModelContainer <APIUser> > loginSuccessDelegate = (c) =>
            {
                if (c.Model == null || string.IsNullOrEmpty(c.Model.id))
                {
                    VRC.Core.Logger.LogError(string.Format("Failed to call login: invalid id received"));
                    Logout();
                }
                else
                {
                    VRC.Core.Logger.Log(
                        "User Authenticated: " + APIUser.CurrentUser.displayName + Environment.NewLine
                        );
                }
                signingIn = false;
                if (onAuthed != null)
                {
                    onAuthed(APIUser.IsLoggedInWithCredentials);
                }
            };
            System.Action <ApiModelContainer <APIUser> > loginFailureDelegate = (c) =>
            {
                VRC.Core.Logger.LogError(string.Format("Failed to call login: {0}", (c != null) ? c.Error : "error"));
                if (c != null)
                {
                    VRC.Core.Logger.Log(c.ToString());
                }
                // Unauthorized? Expired token.
                if ((c == null) || (c.Code == 401))
                {
                    APIUser.Logout();
                }
                signingIn = false;
                if (onAuthed != null)
                {
                    onAuthed(APIUser.IsLoggedInWithCredentials);
                }
            };

            APIUser.FetchCurrentUser(loginSuccessDelegate, loginFailureDelegate);
        }
示例#10
0
        private static void SignIn(bool explicitAttempt)
        {
            lock (syncObject)
            {
                if (signingIn ||
                    APIUser.IsLoggedInWithCredentials ||
                    (!explicitAttempt && string.IsNullOrEmpty(storedUsername)) ||
                    (!explicitAttempt && string.IsNullOrEmpty(storedPassword)))
                {
                    return;
                }

                signingIn = true;
            }

            Init();

            ApiCredentials.Clear();
            ApiCredentials.SetUser(username, password);
            APIUser.Login(
                delegate(APIUser user)
            {
                signingIn      = false;
                error          = null;
                storedUsername = username;
                storedPassword = password;
                AnalyticsSDK.LoggedInUserChanged(user);
            },
                delegate(string message)
            {
                signingIn      = false;
                storedUsername = null;
                storedPassword = null;
                error          = message;
                APIUser.Logout();
                VRC.Core.Logger.Log("Error logging in: " + message);
            }
                );
        }
示例#11
0
    static bool OnAccountGUI()
    {
        const int ACCOUNT_LOGIN_BORDER_SPACING = 20;

        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Space(ACCOUNT_LOGIN_BORDER_SPACING);
        GUILayout.BeginVertical("Account", "window", GUILayout.Height(150), GUILayout.Width(340));

        if (signingIn)
        {
            EditorGUILayout.LabelField("Signing in as " + username + ".");
        }
        else if (APIUser.IsLoggedIn)
        {
            if (Status != "Connected")
            {
                EditorGUILayout.LabelField(Status);
            }

            OnCreatorStatusGUI();

            GUILayout.BeginHorizontal();
            GUILayout.Label("");

            if (GUILayout.Button("Logout"))
            {
                storedUsername = username = null;
                storedPassword = password = null;

                VRC.Tools.ClearCookies();
                APIUser.Logout();
                ClearContent();
            }
            GUILayout.EndHorizontal();
        }
        else
        {
            InitAccount();

            ApiServerEnvironment newEnv = ApiServerEnvironment.Release;
            if (VRCSettings.DisplayAdvancedSettings)
            {
                newEnv = (ApiServerEnvironment)EditorGUILayout.EnumPopup("Use API", serverEnvironment);
            }
            if (serverEnvironment != newEnv)
            {
                serverEnvironment = newEnv;
            }

            username = EditorGUILayout.TextField("Username", username);
            password = EditorGUILayout.PasswordField("Password", password);

            if (GUILayout.Button("Sign In"))
            {
                SignIn(true);
            }
            if (GUILayout.Button("Sign up"))
            {
                Application.OpenURL("https://vrchat.com/register");
            }
        }

        if (showTwoFactorAuthenticationEntry)
        {
            OnTwoFactorAuthenticationGUI();
        }

        GUILayout.EndVertical();
        GUILayout.Space(ACCOUNT_LOGIN_BORDER_SPACING);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        return(!signingIn);
    }
    static bool OnAccountGUI()
    {
        GUI.backgroundColor = Color.white;
        GUILayout.Box("", LoginImage);
        GUI.backgroundColor = new Color(
            UnityEditor.EditorPrefs.GetFloat("SDKColor_R"),
            UnityEditor.EditorPrefs.GetFloat("SDKColor_G"),
            UnityEditor.EditorPrefs.GetFloat("SDKColor_B"),
            UnityEditor.EditorPrefs.GetFloat("SDKColor_A")
            );

        EditorGUILayout.BeginHorizontal(boxGuiStyle, GUILayout.Height(26));
        if (GUILayout.Button("The Black Arms Website"))
        {
            Application.OpenURL("https://trigon.systems/");
        }
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginHorizontal(boxGuiStyle, GUILayout.Height(26));
        if (GUILayout.Button("Latest SDX Release Page"))
        {
            Application.OpenURL("https://www.github.com/TheBlackArms/TheBlackArmsSDX/releases/latest");
        }
        if (GUILayout.Button("SDX Support Server"))
        {
            Application.OpenURL("https://discord.gg/A9dca3N");
        }
        EditorGUILayout.EndHorizontal();

        const int ACCOUNT_LOGIN_BORDER_SPACING = 20;

        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Space(ACCOUNT_LOGIN_BORDER_SPACING);
        GUILayout.BeginVertical("Account", "window", GUILayout.Height(150), GUILayout.Width(340));

        if (signingIn)
        {
            EditorGUILayout.LabelField("Signing in as " + username + ".");
        }
        else if (APIUser.IsLoggedInWithCredentials)
        {
            if (Status != "Connected")
            {
                EditorGUILayout.LabelField(Status);
            }

            OnCreatorStatusGUI();

            GUILayout.BeginHorizontal();
            GUILayout.Label("");

            if (GUILayout.Button("Logout"))
            {
                storedUsername = username = null;
                storedPassword = password = null;

                VRC.Tools.ClearCookies();
                APIUser.Logout();
                ClearContent();
            }
            GUILayout.EndHorizontal();
        }
        else
        {
            InitAccount();

            ApiServerEnvironment newEnv = ApiServerEnvironment.Release;
            #if VRC_SDK_VRCSDK2
            if (VRCSettings.Get().DisplayAdvancedSettings)
            {
                newEnv = (ApiServerEnvironment)EditorGUILayout.EnumPopup("Use API", serverEnvironment);
            }
            #elif VRC_SDK_VRCSDK3
            if (VRC.SDK3.Editor.VRCSettings.Get().DisplayAdvancedSettings)
            {
                newEnv = (ApiServerEnvironment)EditorGUILayout.EnumPopup("Use API", serverEnvironment);
            }
            #endif
            if (serverEnvironment != newEnv)
            {
                serverEnvironment = newEnv;
            }

            username = EditorGUILayout.TextField("Username", username);
            password = EditorGUILayout.PasswordField("Password", password);

            if (GUILayout.Button("Sign In"))
            {
                SignIn(true);
            }
            if (GUILayout.Button("Sign up"))
            {
                Application.OpenURL("http://vrchat.com/register");
            }
        }

        if (showTwoFactorAuthenticationEntry)
        {
            OnTwoFactorAuthenticationGUI();
        }

        GUILayout.EndVertical();
        GUILayout.Space(ACCOUNT_LOGIN_BORDER_SPACING);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        return(!signingIn);
    }
示例#13
0
        static bool OnAccountGUI()
        {
            EditorGUILayout.BeginVertical();

            EditorGUILayout.LabelField(Status);

            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("Account", EditorStyles.boldLabel);

            if (signingIn)
            {
                EditorGUILayout.LabelField("Signing in.");
                EditorGUILayout.EndVertical();
                return(false);
            }
            else if (APIUser.IsLoggedInWithCredentials)
            {
                OnCreatorStatusGUI();

                if (GUILayout.Button("Logout"))
                {
                    storedUsername = username = null;
                    storedPassword = password = null;

                    ApiCredentials.Clear();
                    VRC.Tools.ClearCookies();
                    APIUser.Logout();
                    VRCContentManagerWindow.ClearContent();
                }
            }
            else
            {
                if (signingIn)
                {
                    EditorGUILayout.LabelField("Signing in.");
                }
                else
                {
                    Init();

                    username = EditorGUILayout.TextField("Username", username);
                    password = EditorGUILayout.PasswordField("Password", password);

                    if (GUILayout.Button("Sign In"))
                    {
                        SignIn(true);
                    }
                    if (GUILayout.Button("Sign up"))
                    {
                        Application.OpenURL("http://vrchat.com/register");
                    }
                }
            }

            {
                if (APIUser.CurrentUser == null || APIUser.CurrentUser.hasSuperPowers)
                {
                    EditorGUILayout.Separator();
                    EditorGUILayout.LabelField("API", EditorStyles.boldLabel);

                    ApiServerEnvironment newEnv = (ApiServerEnvironment)EditorGUILayout.EnumPopup("Use API", serverEnvironment);
                    if (serverEnvironment != newEnv)
                    {
                        serverEnvironment = newEnv;
                    }

                    if (APIUser.CurrentUser == null)
                    {
                        EditorGUILayout.EndVertical();
                        return(false);
                    }
                }
                else
                {
                    EditorGUILayout.Separator();
                    EditorGUILayout.LabelField("API", EditorStyles.boldLabel);

                    ApiServerEnvironment newEnv = (EditorGUILayout.Popup("Use API", serverEnvironment != ApiServerEnvironment.Beta ? 1 : 0, new string[] { "Beta", "Release" }) == 0 ? ApiServerEnvironment.Beta : ApiServerEnvironment.Release);
                    if (serverEnvironment != newEnv)
                    {
                        serverEnvironment = newEnv;
                    }
                }
            }

            // Future proof upload
            {
                EditorGUILayout.Separator();
                EditorGUILayout.LabelField("Publish", EditorStyles.boldLabel);
                bool futureProofPublish = UnityEditor.EditorPrefs.GetBool("futureProofPublish", DefaultFutureProofPublishEnabled);

                futureProofPublish = EditorGUILayout.Toggle("Future Proof Publish", futureProofPublish);

                if (UnityEditor.EditorPrefs.GetBool("futureProofPublish", DefaultFutureProofPublishEnabled) != futureProofPublish)
                {
                    UnityEditor.EditorPrefs.SetBool("futureProofPublish", futureProofPublish);
                }
            }

            if (APIUser.CurrentUser != null)
            {
                // custom vrchat install location
                OnVRCInstallPathGUI();
            }

            // debugging
            if (APIUser.CurrentUser != null && APIUser.CurrentUser.hasSuperPowers)
            {
                EditorGUILayout.Separator();
                EditorGUILayout.LabelField("Developer", EditorStyles.boldLabel);

                // API logging
                {
                    bool isLoggingEnabled = UnityEditor.EditorPrefs.GetBool("apiLoggingEnabled");
                    bool enableLogging    = EditorGUILayout.Toggle("API Logging Enabled", isLoggingEnabled);
                    if (enableLogging != isLoggingEnabled)
                    {
                        if (enableLogging)
                        {
                            VRC.Core.Logger.AddDebugLevel(DebugLevel.API);
                        }
                        else
                        {
                            VRC.Core.Logger.RemoveDebugLevel(DebugLevel.API);
                        }

                        UnityEditor.EditorPrefs.SetBool("apiLoggingEnabled", enableLogging);
                    }
                }

                // All logging
                {
                    bool isLoggingEnabled = UnityEditor.EditorPrefs.GetBool("allLoggingEnabled");
                    bool enableLogging    = EditorGUILayout.Toggle("All Logging Enabled", isLoggingEnabled);
                    if (enableLogging != isLoggingEnabled)
                    {
                        if (enableLogging)
                        {
                            VRC.Core.Logger.AddDebugLevel(DebugLevel.All);
                        }
                        else
                        {
                            VRC.Core.Logger.RemoveDebugLevel(DebugLevel.All);
                        }

                        UnityEditor.EditorPrefs.SetBool("allLoggingEnabled", enableLogging);
                    }
                }
            }
            else
            {
                if (UnityEditor.EditorPrefs.GetBool("apiLoggingEnabled"))
                {
                    UnityEditor.EditorPrefs.SetBool("apiLoggingEnabled", false);
                }
                if (UnityEditor.EditorPrefs.GetBool("allLoggingEnabled"))
                {
                    UnityEditor.EditorPrefs.SetBool("allLoggingEnabled", false);
                }
            }

            EditorGUILayout.EndVertical();

            return(true);
        }
        static bool OnAccountGUI()
        {
            EditorGUILayout.BeginVertical();

            EditorGUILayout.LabelField(Status);

            EditorGUILayout.LabelField("Account", EditorStyles.boldLabel);

            if (signingIn)
            {
                EditorGUILayout.LabelField("Signing in.");
                EditorGUILayout.EndVertical();
                return(false);
            }
            else if (APIUser.IsLoggedInWithCredentials)
            {
                EditorGUILayout.PrefixLabel("Logged in as " + APIUser.CurrentUser.displayName);
                EditorGUILayout.LabelField("Developer Status: " + APIUser.CurrentUser.developerType);

                if (GUILayout.Button("Logout"))
                {
                    storedUsername = username = null;
                    storedPassword = password = null;

                    APIUser.Logout();
                }
            }
            else
            {
                if (signingIn)
                {
                    EditorGUILayout.LabelField("Signing in.");
                }
                else
                {
                    Init();

                    username = EditorGUILayout.TextField("Username", username);
                    password = EditorGUILayout.PasswordField("Password", password);

                    if (GUILayout.Button("Sign In"))
                    {
                        SignIn(true);
                    }
                    if (GUILayout.Button("Sign up"))
                    {
                        Application.OpenURL("http://vrchat.com/register");
                    }
                }
            }

            {
                if (APIUser.CurrentUser == null || APIUser.CurrentUser.developerType == APIUser.DeveloperType.Internal)
                {
                    EditorGUILayout.LabelField("API", EditorStyles.boldLabel);

                    ApiServerEnvironment newEnv = (ApiServerEnvironment)EditorGUILayout.EnumPopup("Use API", serverEnvironment);
                    if (serverEnvironment != newEnv)
                    {
                        serverEnvironment = newEnv;
                    }

                    if (APIUser.CurrentUser == null)
                    {
                        EditorGUILayout.EndVertical();
                        return(false);
                    }
                }
                else
                {
                    EditorGUILayout.LabelField("API", EditorStyles.boldLabel);

                    ApiServerEnvironment newEnv = (EditorGUILayout.Popup("Use API", serverEnvironment != ApiServerEnvironment.Beta ? 1 : 0, new string[] { "Beta", "Release" }) == 0 ? ApiServerEnvironment.Beta : ApiServerEnvironment.Release);
                    if (serverEnvironment != newEnv)
                    {
                        serverEnvironment = newEnv;
                    }
                }
            }

            // Future proof upload
            {
                EditorGUILayout.LabelField("Publish", EditorStyles.boldLabel);
                bool futureProofPublish = UnityEditor.EditorPrefs.GetBool("futureProofPublish", DefaultFutureProofPublishEnabled);

                futureProofPublish = EditorGUILayout.Toggle("Future Proof Publish", futureProofPublish);

                if (UnityEditor.EditorPrefs.GetBool("futureProofPublish", DefaultFutureProofPublishEnabled) != futureProofPublish)
                {
                    UnityEditor.EditorPrefs.SetBool("futureProofPublish", futureProofPublish);
                }
            }

            if (APIUser.CurrentUser != null)
            {
                // custom vrchat install location
                OnVRCInstallPathGUI();
            }

            EditorGUILayout.EndVertical();

            return(true);
        }
    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);
        }
    }