Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="loginCallbackInfo"></param>
        private void OnAuthInterfaceLogin(OnlineServices.Auth.LoginCallbackInfo loginCallbackInfo)
        {
            if (loginCallbackInfo.ResultCode == Result.Success)
            {
                if (_enableDebugLogs)
                {
                    DebugLogger.RegularDebugLog("[EpicManager] - Auth Interface Login succeeded");
                }

                Result result = loginCallbackInfo.LocalUserId.ToString(out string accountIdString);

                if (Result.Success == result)
                {
                    if (_enableDebugLogs)
                    {
                        DebugLogger.RegularDebugLog("[EpicManager] - User ID:" + accountIdString);
                    }

                    AccountId = new EpicUser(loginCallbackInfo.LocalUserId, null);
                }

                ConnectInterfaceLogin();
            }
            else
            {
                if (_enableDebugLogs)
                {
                    DebugLogger.RegularDebugLog("[EpicManager] - Login returned " + loginCallbackInfo.ResultCode);
                }
            }
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="loginCallbackInfo"></param>
        private void OnConnectInterfaceLogin(OnlineServices.Connect.LoginCallbackInfo loginCallbackInfo)
        {
            if (loginCallbackInfo.ResultCode == Result.Success)
            {
                if (_enableDebugLogs)
                {
                    DebugLogger.RegularDebugLog("[EpicManager] - Connect Interface Login succeeded");
                }

                Result result = loginCallbackInfo.LocalUserId.ToString(out string productIdString);

                if (Result.Success == result)
                {
                    if (_enableDebugLogs)
                    {
                        DebugLogger.RegularDebugLog("[EpicManager] - User Product ID:" + productIdString);
                    }

                    AccountId = new EpicUser(AccountId.EpicAccountId, loginCallbackInfo.LocalUserId);

                    OnLoggedIn?.Invoke();
                }
            }
            else
            {
                if (_enableDebugLogs)
                {
                    DebugLogger.RegularDebugLog("[EpicManager] - Login returned " + loginCallbackInfo.ResultCode);
                }

                ConnectInterface.CreateUser(
                    new CreateUserOptions {
                    ContinuanceToken = loginCallbackInfo.ContinuanceToken
                }, null, cb =>
                {
                    if (cb.ResultCode != Result.Success)
                    {
                        if (_enableDebugLogs)
                        {
                            DebugLogger.RegularDebugLog(
                                $"[EpicManager] - User creation failed. Result: {cb.ResultCode}");
                        }
                        return;
                    }

                    AccountId = new EpicUser(AccountId.EpicAccountId, loginCallbackInfo.LocalUserId);

                    ConnectInterfaceLogin();
                });
            }
        }