示例#1
0
        public static void Init()
        {
            if (isInitialized)
            {
                return;
            }

            // make sure the api url is set correctly before attempting to log in
            RefreshApiUrlSetting();

            if (!APIUser.IsLoggedInWithCredentials && ApiCredentials.Load())
            {
                APIUser.FetchCurrentUser((c) => AnalyticsSDK.LoggedInUserChanged(c.Model as APIUser), null);
            }

            clientInstallPath = SDKClientUtilities.GetSavedVRCInstallPath();
            if (string.IsNullOrEmpty(clientInstallPath))
            {
                clientInstallPath = SDKClientUtilities.LoadRegistryVRCInstallPath();
            }

            signingIn     = false;
            isInitialized = true;

            VRCContentManagerWindow.ClearContent();
        }
示例#2
0
        public static void Init()
        {
            if (!RemoteConfig.IsInitialized())
            {
                RemoteConfig.Init();
            }

            if (isInitialized)
            {
                return;
            }

            if (!APIUser.IsLoggedInWithCredentials && ApiCredentials.Load())
            {
                APIUser.Login((user) => AnalyticsSDK.LoggedInUserChanged(user), null);
            }

            clientInstallPath = SDKClientUtilities.GetSavedVRCInstallPath();
            if (string.IsNullOrEmpty(clientInstallPath))
            {
                clientInstallPath = SDKClientUtilities.LoadRegistryVRCInstallPath();
            }

            signingIn     = false;
            isInitialized = true;

            VRCContentManagerWindow.ClearContent();
        }
示例#3
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);
        }
示例#4
0
        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();
                    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.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);
        }