public override void Withdraw(int handle)
        {
            if (false == GamebaseUnitySDK.UseWebview)
            {
                base.Withdraw(handle);
                return;
            }

            if (false == CanLogout(handle))
            {
                return;
            }

            var requestVO = AuthMessage.GetWithdrawMessage();

            WebSocket.Instance.Request(requestVO, (response, error) =>
            {
                GamebaseSystemPopup.Instance.ShowErrorPopup(error);

                var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.ErrorDelegate>(handle);

                if (null == callback)
                {
                    return;
                }

                GamebaseCallbackHandler.UnregisterCallback(handle);

                DataContainer.RemoveData(VOKey.Auth.LOGIN_INFO);
                Heartbeat.Instance.StopHeartbeat();

                callback(null);
            });
        }
Beispiel #2
0
        public virtual void Withdraw(int handle)
        {
            if (false == CanLogout(handle))
            {
                return;
            }

            var requestVO = AuthMessage.GetWithdrawMessage();

            WebSocket.Instance.Request(requestVO, (response, error) =>
            {
                var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.ErrorDelegate>(handle);
                if (null == callback)
                {
                    return;
                }
                GamebaseCallbackHandler.UnregisterCallback(handle);

                if (null == error)
                {
                    var vo = JsonMapper.ToObject <AuthResponse.WithdrawInfo>(response);
                    if (true == vo.header.isSuccessful)
                    {
                        DataContainer.RemoveData(VOKey.Auth.LOGIN_INFO);
                        Heartbeat.Instance.StopHeartbeat();
                        AuthAdapterManager.Instance.IDPLogoutAll();
                        PurchaseAdapterManager.Instance.Destroy();
                    }
                    else
                    {
                        if (GamebaseServerErrorCode.MEMBER_ALREADY_WITHDRAWN == vo.header.resultCode)
                        {
                            DataContainer.RemoveData(VOKey.Auth.LOGIN_INFO);
                            Heartbeat.Instance.StopHeartbeat();
                        }
                        else
                        {
                            error = GamebaseErrorUtil.CreateGamebaseErrorByServerErrorCode(requestVO.transactionId, requestVO.apiId, vo.header, Domain);
                            GamebaseSystemPopup.Instance.ShowErrorPopup(error);
                        }
                    }
                }
                else
                {
                    GamebaseSystemPopup.Instance.ShowErrorPopup(error);
                }
                callback(error);
            });
        }
Beispiel #3
0
        public void Withdraw(int handle)
        {
            GamebaseCallback.ErrorDelegate withdrawCallback = (error) =>
            {
                if (Gamebase.IsSuccess(error) == true)
                {
                    GamebaseIndicatorReport.SendIndicatorData(
                        GamebaseIndicatorReportType.LogType.AUTH,
                        GamebaseIndicatorReportType.StabilityCode.GB_AUTH_WITHDRAW_SUCCESS,
                        GamebaseIndicatorReportType.LogLevel.INFO,
                        new Dictionary <string, string>()
                    {
                        { GamebaseIndicatorReportType.AdditionalKey.GB_SUB_CATEGORY1, GamebaseIndicatorReportType.SubCategory.WITHDRAW }
                    });
                }
                else
                {
                    GamebaseIndicatorReport.SendIndicatorData(
                        GamebaseIndicatorReportType.LogType.AUTH,
                        GamebaseIndicatorReportType.StabilityCode.GB_AUTH_WITHDRAW_FAILED,
                        GamebaseIndicatorReportType.LogLevel.ERROR,
                        new Dictionary <string, string>()
                    {
                        { GamebaseIndicatorReportType.AdditionalKey.GB_SUB_CATEGORY1, GamebaseIndicatorReportType.SubCategory.WITHDRAW }
                    },
                        error);
                }

                var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.ErrorDelegate>(handle);

                if (callback != null)
                {
                    callback(error);
                }

                GamebaseCallbackHandler.UnregisterCallback(handle);
            };


            int withdrawHandle = GamebaseCallbackHandler.RegisterCallback(withdrawCallback);

            if (CanLogout(withdrawHandle) == false)
            {
                return;
            }

            var requestVO = AuthMessage.GetWithdrawMessage();

            WebSocket.Instance.Request(requestVO, (response, error) =>
            {
                GamebaseAnalytics.Instance.IdPCode = string.Empty;

                var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.ErrorDelegate>(withdrawHandle);
                if (callback == null)
                {
                    return;
                }
                GamebaseCallbackHandler.UnregisterCallback(withdrawHandle);

                if (error == null)
                {
                    var vo = JsonMapper.ToObject <AuthResponse.WithdrawInfo>(response);
                    if (vo.header.isSuccessful == true)
                    {
                        RemoveLoginData();
                    }
                    else
                    {
                        if (GamebaseServerErrorCode.MEMBER_ALREADY_WITHDRAWN == vo.header.resultCode)
                        {
                            RemoveLoginData();
                        }
                        else
                        {
                            error = GamebaseErrorUtil.CreateGamebaseErrorByServerErrorCode(requestVO.transactionId, requestVO.apiId, vo.header, Domain);
                            GamebaseSystemPopup.Instance.ShowErrorPopup(error);
                        }
                    }
                }
                else
                {
                    GamebaseSystemPopup.Instance.ShowErrorPopup(error);
                }
                callback(error);
            });
        }