void Login()
        {
            ApiCredentials.Load();
            APIUser.Login(
                delegate(APIUser user)
            {
                pipelineManager.user = user;

                API.Fetch <ApiAvatar>(pipelineManager.blueprintId,
                                      (c) =>
                {
                    Debug.Log("<color=magenta>Updating an existing avatar.</color>");
                    apiAvatar = c.Model as ApiAvatar;
                    pipelineManager.completedSDKPipeline = !string.IsNullOrEmpty(apiAvatar.authorId);
                    SetupUI();
                },
                                      (c) =>
                {
                    Debug.Log("<color=magenta>Creating a new avatar.</color>");
                    apiAvatar    = new ApiAvatar();
                    apiAvatar.id = pipelineManager.blueprintId;
                    pipelineManager.completedSDKPipeline = !string.IsNullOrEmpty(apiAvatar.authorId);
                    SetupUI();
                });
            }, LoginErrorCallback);
        }
        void Login()
        {
            ApiCredentials.Load();
            APIUser.Login(
                delegate(APIUser user)
            {
                pipelineManager.user = user;

                ApiAvatar.Fetch(pipelineManager.blueprintId, false,
                                delegate(ApiAvatar avatar)
                {
                    apiAvatar = avatar;
                    pipelineManager.completedSDKPipeline = !string.IsNullOrEmpty(apiAvatar.authorId);
                    SetupUI();
                },
                                delegate(string message)
                {
                    apiAvatar    = new ApiAvatar();
                    apiAvatar.id = pipelineManager.blueprintId;
                    pipelineManager.completedSDKPipeline = false;
                    SetupUI();
                }
                                );
            }, LoginErrorCallback);
        }
Esempio n. 3
0
 void Login()
 {
     ApiCredentials.Load();
     APIUser.Login(
         delegate(APIUser user)
     {
         pipelineManager.user = user;
         if (isUpdate)
         {
             ApiAvatar.Fetch(pipelineManager.blueprintId, false,
                             delegate(ApiAvatar avatar)
             {
                 apiAvatar = avatar;
                 SetupUI();
             },
                             delegate(string message)
             {
                 apiAvatar    = new ApiAvatar();
                 apiAvatar.id = pipelineManager.blueprintId;
                 SetupUI();
             });
         }
         else
         {
             apiAvatar    = new ApiAvatar();
             apiAvatar.id = pipelineManager.blueprintId;
             SetupUI();
         }
     }, LoginErrorCallback);
 }
Esempio n. 4
0
        new void Start()
        {
            if (!Application.isEditor || !Application.isPlaying)
            {
                return;
            }

            base.Start();

            Application.runInBackground       = true;
            UnityEngine.VR.VRSettings.enabled = false;

            uploadButton.onClick.AddListener(SetupUpload);

            shouldUpdateImageToggle.onValueChanged.AddListener(ToggleUpdateImage);

            releasePublic.gameObject.SetActive(false);

            ApiCredentials.Load();
            APIUser.Login(
                delegate(APIUser user)
            {
                pipelineManager.user = user;
                UserLoggedInCallback(user);
            },
                delegate(string err)
            {
                blueprintPanel.SetActive(false);
                errorPanel.SetActive(true);
            }
                );
        }
Esempio n. 5
0
        private static void AttemptLogin()
        {
            if (ApiCredentials.Load())
            {
                System.Action <bool> onAuthed = delegate(bool isSuccess) {
                    if (isSuccess)
                    {
                        refreshWindow = true;
                    }
                    else
                    {
                        Login();
                    }
                };

                switch (ApiCredentials.GetAuthTokenProvider())
                {
                case "vrchat":
                    AuthenticateWithVRChat(onAuthed);
                    break;
                }
            }
            else
            {
                Login();
            }
        }
Esempio n. 6
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();
        }
Esempio n. 7
0
        new void Start()
        {
            if (!Application.isEditor || !Application.isPlaying)
            {
                return;
            }

            base.Start();

            Application.runInBackground       = true;
            UnityEngine.XR.XRSettings.enabled = false;

            uploadButton.onClick.AddListener(SetupUpload);

            shouldUpdateImageToggle.onValueChanged.AddListener(ToggleUpdateImage);

            releasePublic.gameObject.SetActive(false);

            ApiCredentials.Load();
            APIUser.Login(
                delegate(APIUser user)
            {
                UserLoggedInCallback(user);
            },
                delegate(string err)
            {
                VRC.Core.Logger.LogError("Could not log in - " + err, DebugLevel.Always);
                blueprintPanel.SetActive(false);
                errorPanel.SetActive(true);
            }
                );
        }
        public static void Init()
        {
            if (!RemoteConfig.IsInitialized())
            {
                RemoteConfig.Init();
            }

            if (isInitialized)
            {
                return;
            }

            if (!APIUser.IsLoggedInWithCredentials && ApiCredentials.Load())
            {
                APIUser.Login(null, null);
            }

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

            signingIn     = false;
            isInitialized = true;
        }
Esempio n. 9
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();
        }
        new void Start()
        {
            if (!Application.isEditor || !Application.isPlaying)
            {
                return;
            }

            base.Start();

            IsCurrentWorldInCommunityLabs   = false;
            IsCurrentWorldUploaded          = false;
            IsCurrentWorldPubliclyPublished = false;


            var desc = pipelineManager.GetComponent <VRC_SceneDescriptor>();

            desc.PositionPortraitCamera(imageCapture.shotCamera.transform);

            Application.runInBackground       = true;
            UnityEngine.XR.XRSettings.enabled = false;

            uploadButton.onClick.AddListener(SetupUpload);

            openCommunityLabsDocsButton.onClick.AddListener(OpenCommunityLabsDocumentation);

            shouldUpdateImageToggle.onValueChanged.AddListener(ToggleUpdateImage);

            releasePublic.gameObject.SetActive(false);

            System.Action <string> onError = (err) => {
                VRC.Core.Logger.LogError("Could not authenticate - " + err, DebugLevel.Always);
                blueprintPanel.SetActive(false);
                errorPanel.SetActive(true);
            };

            if (!ApiCredentials.Load())
            {
                onError("Not logged in");
            }
            else
            {
                APIUser.FetchCurrentUser(
                    delegate(ApiModelContainer <APIUser> c)
                {
                    UserLoggedInCallback(c.Model as APIUser);
                },
                    delegate(ApiModelContainer <APIUser> c)
                {
                    onError(c.Error);
                }
                    );
            }

#if !COMMUNITY_LABS_SDK
            publishToCommunityLabsPanel.gameObject.SetActive(false);
#endif
        }
Esempio n. 11
0
 // Token: 0x06005727 RID: 22311 RVA: 0x001E0604 File Offset: 0x001DEA04
 public new static void Login(Action <APIUser> onFetchSuccess = null, Action <string> onFetchError = null)
 {
     ApiCredentials.Load();
     APIUser.Login(delegate(APIUser freshAPIUser)
     {
         User.mCurrentNonApiUser = new User();
         User.mCurrentNonApiUser.Init(APIUser.CurrentUser);
         User.SetNetworkProperties();
         if (onFetchSuccess != null)
         {
             onFetchSuccess(freshAPIUser);
         }
     }, onFetchError);
 }
Esempio n. 12
0
        private void OnApplicationStart()
        {
            if (!ApiCredentials.Load())
            {
                VRCModLogger.Log("No credential founds");
            }
            else
            {
                VRCModLogger.Log("Credentials:\n - Token: " + ApiCredentials.GetAuthToken() + "\n - Provider: " + ApiCredentials.GetAuthTokenProvider() + "\n - UserId: " + ApiCredentials.GetAuthTokenProviderUserId());
            }


            String lp    = "";
            bool   first = true;

            foreach (var lp2 in Environment.GetCommandLineArgs())
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    lp += " " + lp2;
                }
            }
            VRCModLogger.Log("Launch parameters:" + lp);

            ModPrefs.RegisterCategory("vrctools", "VRCTools");
            ModPrefs.RegisterPrefBool("vrctools", "remoteauthcheckasked", false, null, true);
            ModPrefs.RegisterPrefBool("vrctools", "remoteauthcheck", false, "Allow VRCModNetwork Auth");
            ModPrefs.RegisterPrefBool("vrctools", "avatarfavdownloadasked", false, null, true);
            ModPrefs.RegisterPrefBool("vrctools", "avatarfavdownload", false, "Enable AvatarFav Updater");

            ModPrefs.RegisterPrefBool("vrctools", "enablediscordrichpresence", true, "Enable Discord RichPresence");
            ModPrefs.RegisterPrefBool("vrctools", "enabledebugconsole", false, "Enable Debug Console");

            ModPrefs.RegisterPrefBool("vrctools", "hasvrcmnwtoken", false, null, true);

            ModPrefs.RegisterPrefBool("vrctools", "allowdiscordjoinrequests", true, "Allow Discord join requests");

            //Reset the credentials to ask login again if this is the first time the user login to the VRCMNW
            if (!ModPrefs.GetBool("vrctools", "hasvrcmnwtoken"))
            {
                ApiCredentials.Clear();
            }
        }
Esempio n. 13
0
 private static bool VerifyCredentials()
 {
     if (!RemoteConfig.IsInitialized())
     {
         RemoteConfig.Init((Action)null, (Action)null);
     }
     if (!APIUser.get_IsLoggedInWithCredentials() && ApiCredentials.Load())
     {
         APIUser.FetchCurrentUser((Action <ApiModelContainer <APIUser> >) delegate(ApiModelContainer <APIUser> c)
         {
             AnalyticsSDK.LoggedInUserChanged(c.get_Model() as APIUser);
         }, (Action <ApiModelContainer <APIUser> >)null);
     }
     if (!APIUser.get_IsLoggedInWithCredentials())
     {
         GUILayout.Label("Please use the \"VRChat SDK/Settings\" window to log in.", EditorStyles.get_boldLabel(), (GUILayoutOption[])new GUILayoutOption[0]);
         return(false);
     }
     return(true);
 }
Esempio n. 14
0
        void Login()
        {
            if (!ApiCredentials.Load())
            {
                LoginErrorCallback("Not logged in");
            }
            else
            {
                APIUser.FetchCurrentUser(
                    delegate(ApiModelContainer <APIUser> c)
                {
                    pipelineManager.user = c.Model as APIUser;

                    ApiAvatar av = new ApiAvatar()
                    {
                        id = pipelineManager.blueprintId
                    };
                    av.Get(false,
                           (c2) =>
                    {
                        VRC.Core.Logger.Log("<color=magenta>Updating an existing avatar.</color>", DebugLevel.API);
                        apiAvatar = c2.Model as ApiAvatar;
                        pipelineManager.completedSDKPipeline = !string.IsNullOrEmpty(apiAvatar.authorId);
                        SetupUI();
                    },
                           (c2) =>
                    {
                        VRC.Core.Logger.Log("<color=magenta>Creating a new avatar.</color>", DebugLevel.API);
                        apiAvatar    = new ApiAvatar();
                        apiAvatar.id = pipelineManager.blueprintId;
                        pipelineManager.completedSDKPipeline = !string.IsNullOrEmpty(apiAvatar.authorId);
                        SetupUI();
                    });
                }, (c) => {
                    LoginErrorCallback(c.Error);
                });
            }
        }
Esempio n. 15
0
    public static void InitAccount()
    {
        if (isInitialized)
        {
            return;
        }

        if (!APIUser.IsLoggedIn && 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;

        ClearContent();
    }
    public override void OnInspectorGUI()
    {
        //IL_01b5: Unknown result type (might be due to invalid IL or missing references)
        //IL_01cb: Unknown result type (might be due to invalid IL or missing references)
        PipelineManager pipeline = (PipelineManager)this.get_target();

        EditorGUILayout.LabelField("Unity Version", Application.get_unityVersion(), (GUILayoutOption[])new GUILayoutOption[0]);
        if (!loggingIn)
        {
            bool flag = ApiCredentials.IsLoaded();
            if (!flag)
            {
                flag = ApiCredentials.Load();
            }
            if (!APIUser.IsLoggedInWithCredentials && flag)
            {
                API.SetOnlineMode(online: true);
                loggingIn = true;
                APIUser.FetchCurrentUser(delegate(ApiModelContainer <APIUser> c)
                {
                    loggingIn     = false;
                    pipeline.user = (c.Model as APIUser);
                }, delegate
                {
                    loggingIn = false;
                });
            }
            else if (APIUser.IsLoggedInWithCredentials && !flag)
            {
                pipeline.user = null;
            }
        }
        pipeline.launchedFromSDKPipeline = launchedFromSDKPipeline;
        string text = (!APIUser.IsLoggedInWithCredentials) ? "None" : pipeline.blueprintId;

        if (string.IsNullOrEmpty(text))
        {
            tmpBlueprintId = EditorGUILayout.TextField("Blueprint ID (Optional)", tmpBlueprintId, (GUILayoutOption[])new GUILayoutOption[0]);
        }
        else
        {
            EditorGUILayout.PrefixLabel("Blueprint ID");
            EditorGUILayout.SelectableLabel(text, (GUILayoutOption[])new GUILayoutOption[0]);
        }
        string text2 = (!string.IsNullOrEmpty(text)) ? "Detach (Optional)" : "Attach (Optional)";

        if (APIUser.IsLoggedInWithCredentials && GUILayout.Button(text2, (GUILayoutOption[])new GUILayoutOption[0]))
        {
            if (string.IsNullOrEmpty(text))
            {
                text = (pipeline.blueprintId = tmpBlueprintId);
                pipeline.completedSDKPipeline = true;
            }
            else
            {
                pipeline.blueprintId          = string.Empty;
                pipeline.completedSDKPipeline = false;
            }
            EditorUtility.SetDirty(pipeline);
            EditorSceneManager.MarkSceneDirty(pipeline.get_gameObject().get_scene());
            EditorSceneManager.SaveScene(pipeline.get_gameObject().get_scene());
        }
        if (!APIUser.IsLoggedInWithCredentials)
        {
            GUILayout.Label("Use the settings menu to log in.", EditorStyles.get_boldLabel(), (GUILayoutOption[])new GUILayoutOption[0]);
        }
    }