コード例 #1
0
 public void GetAsync(string jsonString)
 {
     GamebaseLog.Debug(string.Format("jsonString : {0}", jsonString), this, "GetAsync");
     jc.CallStatic("getAsync", jsonString);
 }
コード例 #2
0
        public void GetAsync(string jsonString)
        {
            GamebaseLog.Debug(string.Format("jsonString : {0}", GamebaseJsonUtil.ToPrettyJsonString(jsonString)), this);

            jc.CallStatic("getAsync", jsonString);
        }
コード例 #3
0
 public static void FireNotSupportedAPI(object classObj, string methodName)
 {
     GamebaseLog.Warn(string.Format("{0}", CreateNotSupportedMessage()), classObj, methodName);
 }
コード例 #4
0
 public string GetSync(string jsonString)
 {
     GamebaseLog.Debug(string.Format("jsonString : {0}", jsonString), this, "GetSync");
     return(jc.CallStatic <string>("getSync", jsonString));
 }
コード例 #5
0
 public JsonException(string message) : base(message)
 {
     GamebaseLog.Debug(string.Format("JsonException message:{0}", message), this, "JsonException");
 }
コード例 #6
0
 private void OnError(object sender, ErrorEventArgs e)
 {
     errorMessage = e.Message;
     GamebaseLog.Warn(GamebaseJsonUtil.ToPrettyJsonString(e), this);
 }
        private void GetAccessToken(string providerName, System.Action <WebSocketRequest.RequestVO> callback)
        {
            WebSocketRequest.RequestVO requestVO = null;

            GamebaseResponse.Launching.LaunchingInfo launchingInfo = Gamebase.Launching.GetLaunchingInformations();

            if (null == launchingInfo.launching.app.loginUrls ||
                true == string.IsNullOrEmpty(launchingInfo.launching.app.loginUrls.gamebaseUrl))
            {
#if UNITY_EDITOR
                GamebaseLog.Error("You need to switch platform the Standalone.", this, "GetAccessToken");
#else
                GamebaseLog.Debug("launchingInfo.launching.standalone is null.", this, "GetAccessToken");
#endif
                callback(requestVO);
                return;
            }

            if (null == launchingInfo)
            {
                GamebaseLog.Debug("launchingInfo is null.", this, "GetAccessToken");
                callback(requestVO);
                return;
            }

            GamebaseResponse.Launching.LaunchingInfo.GamebaseLaunching.APP.LaunchingIDPInfo launchingIDPInfo = launchingInfo.launching.app.idP["gbid"];

            if (null == launchingIDPInfo)
            {
                GamebaseLog.Debug("gbid is null.", this, "GetAccessToken");
                callback(requestVO);
                return;
            }

            string clientID = launchingIDPInfo.clientId;

            StringBuilder url = new StringBuilder(launchingInfo.launching.app.loginUrls.gamebaseUrl);
            url.Append("?clientId=").Append(clientID);
            url.Append("&snsCd=").Append(providerName);
            url.Append("&svcUrl=").Append(WWW.EscapeURL(SCHEME_AUTH_LOGIN));
            url.Append("&tokenKind=").Append("SNS");

            WebviewAdapterManager.Instance.ShowWebView(
                url.ToString(),
                null,
                (error) =>
            {
                callback(requestVO);
            },
                new List <string>()
            {
                SCHEME_AUTH_LOGIN
            },
                (scheme, error) =>
            {
                WebviewAdapterManager.SchemeInfo schemeInfo = WebviewAdapterManager.Instance.ConvertURLToSchemeInfo(scheme);

                if (true == schemeInfo.parameterDictionary.ContainsKey(ACCESS_TOKEN_KEY))
                {
                    var IDPAccessToken = schemeInfo.parameterDictionary[ACCESS_TOKEN_KEY];
                    requestVO          = AuthMessage.GetIDPLoginMessage(providerName, IDPAccessToken);

                    WebviewAdapterManager.Instance.CloseWebView();
                }
            }
                );
        }
コード例 #8
0
        public void Initialize(GamebaseRequest.GamebaseConfiguration configuration, int handle)
        {
            if (initializeHandle != -1)
            {
                GamebaseCallbackHandler.UnregisterCallback(initializeHandle);
            }

            GamebaseCallback.GamebaseDelegate <GamebaseResponse.Launching.LaunchingInfo> initializeCallback = (launchingInfo, error) =>
            {
                GamebaseResponse.Launching.LaunchingInfo.GamebaseLaunching.TCGBClient.Stability stability = null;
                if (error == null || error.code == GamebaseErrorCode.SUCCESS)
                {
                    #region Iap Setting
                    GamebaseLog.Debug("ToastSdk Initialize", this);
                    ToastSdk.Initialize();

                    if (PurchaseAdapterManager.Instance.CreateIDPAdapter("iapadapter") == true)
                    {
                        var iapConfiguration = new GamebaseRequest.Purchase.Configuration();
                        iapConfiguration.appKey    = launchingInfo.tcProduct.iap.appKey;
                        iapConfiguration.storeCode = configuration.storeCode;
                        PurchaseAdapterManager.Instance.SetConfiguration(iapConfiguration);
                    }

                    stability = launchingInfo.launching.tcgbClient.stability;
                    #endregion
                }

                GamebaseIndicatorReport.Initialize(
                    stability,
                    () => {
                    if (Gamebase.IsSuccess(error) == false)
                    {
                        initializeFailCount++;
                        if (initializeFailCount > GamebaseIndicatorReport.stability.initFailCount)
                        {
                            GamebaseIndicatorReport.SendIndicatorData(
                                GamebaseIndicatorReportType.LogType.INIT,
                                GamebaseIndicatorReportType.StabilityCode.GB_INIT_FAILED_MULTIPLE_TIMES,
                                GamebaseIndicatorReportType.LogLevel.WARN,
                                new Dictionary <string, string>()
                            {
                                { GamebaseIndicatorReportType.AdditionalKey.GB_CONFIGURATION, JsonMapper.ToJson(configuration) }
                            });
                            initializeFailCount = 0;
                        }
                    }
                    else
                    {
                        initializeFailCount = 0;
                    }

                    var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Launching.LaunchingInfo> >(handle);

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

                    GamebaseCallbackHandler.UnregisterCallback(handle);
                });
            };

            initializeHandle = GamebaseCallbackHandler.RegisterCallback(initializeCallback);
            GamebaseCoroutineManager.StartCoroutine(GamebaseGameObjectManager.GameObjectType.CORE_TYPE, Init());
        }
コード例 #9
0
 public AdapterBase()
 {
     GamebaseLog.Debug(string.Format("{0} ver.{1}", domain, version), this, "Constructor");
 }
コード例 #10
0
 public void FireNotSupportedAPI(string domain, string methodName)
 {
     GamebaseLog.Warn(string.Format("{0} API is not supported by {1}.", methodName, domain), this, "FireNotSupportedAPI");
 }
 public void Initialize(string className)
 {
     GamebaseLog.Debug(string.Format("className : {0}", className), this, "Initialize");
     initialize(className);
 }
 public void GetAsync(string jsonString)
 {
     GamebaseLog.Debug(string.Format("jsonString : {0}", jsonString), this, "GetAsync");
     getAsync(jsonString);
 }
コード例 #13
0
        private void SendHeartbeat()
        {
            var requestVO = HeartbeatMessage.GetHeartbeatMessage();

            WebSocket.Instance.Request(requestVO, (response, error) =>
            {
                GamebaseError heartbeatError = error;

                if (null == heartbeatError)
                {
                    var vo = JsonMapper.ToObject <LaunchingResponse.HeartbeatInfo>(response);
                    if (true == vo.header.isSuccessful)
                    {
                        GamebaseLog.Debug("Send heartbeat succeeded", this);
                    }
                    else
                    {
                        heartbeatError = GamebaseErrorUtil.CreateGamebaseErrorByServerErrorCode(requestVO.transactionId, requestVO.apiId, vo.header, string.Empty);
                    }
                }

                if (null != heartbeatError)
                {
                    if (GamebaseErrorCode.BANNED_MEMBER == heartbeatError.code || GamebaseErrorCode.INVALID_MEMBER == heartbeatError.code)
                    {
                        var vo  = new GamebaseResponse.SDK.ObserverMessage();
                        vo.type = GamebaseObserverType.HEARTBEAT;
                        vo.data = new System.Collections.Generic.Dictionary <string, object>();
                        vo.data.Add("code", heartbeatError.code);

                        if (GamebaseErrorCode.BANNED_MEMBER == heartbeatError.code)
                        {
                            GamebaseIndicatorReport.SendIndicatorData(
                                GamebaseIndicatorReportType.LogType.EVENT,
                                GamebaseIndicatorReportType.StabilityCode.GB_EVENT_OBSERVER_BANNED_MEMBER,
                                GamebaseIndicatorReportType.LogLevel.INFO,
                                new Dictionary <string, string>()
                            {
                                { GamebaseIndicatorReportType.AdditionalKey.GB_OBSERVER_DATA, JsonMapper.ToJson(vo) }
                            });
                        }
                        else
                        {
                            GamebaseIndicatorReport.SendIndicatorData(
                                GamebaseIndicatorReportType.LogType.EVENT,
                                GamebaseIndicatorReportType.StabilityCode.GB_EVENT_OBSERVER_INVALID_MEMBER,
                                GamebaseIndicatorReportType.LogLevel.INFO,
                                new Dictionary <string, string>()
                            {
                                { GamebaseIndicatorReportType.AdditionalKey.GB_OBSERVER_DATA, JsonMapper.ToJson(vo) }
                            });
                        }

                        GamebaseSystemPopup.Instance.ShowHeartbeatErrorPopup(heartbeatError);

                        var observerCallback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.DataDelegate <GamebaseResponse.SDK.ObserverMessage> >(GamebaseObserverManager.Instance.Handle);
                        if (null != observerCallback)
                        {
                            observerCallback(vo);
                        }
                    }
                    GamebaseLog.Debug(string.Format("Send heartbeat failed. error:{0}", GamebaseJsonUtil.ToPrettyJsonString(heartbeatError)), this);
                }

                lastSentTime = DateTime.Now;
            });
        }
コード例 #14
0
 public void Initialize(string className)
 {
     GamebaseLog.Debug(string.Format("className : {0}", className), this);
     jc.CallStatic("initialize", className);
 }
コード例 #15
0
        public void ShowLaunchingPopup(LaunchingResponse.LaunchingInfo launchingInfo)
        {
            if (false == GamebaseUnitySDK.EnablePopup || false == GamebaseUnitySDK.EnableLaunchingStatusPopup)
            {
                return;
            }

            GamebaseLog.Debug(string.Format("LaunchingStatusCode : {0}", launchingInfo.launching.status.code), this);

            CheckNotice(launchingInfo);

            switch (launchingInfo.launching.status.code)
            {
            case GamebaseLaunchingStatus.INSPECTING_SERVICE:            // 서비스 점검
            {
                if (null != launchingInfo.launching.maintenance)
                {
                    StringBuilder msg = new StringBuilder();
                    msg.AppendLine(DisplayLanguage.Instance.GetString("launching_maintenance_message"));
                    msg.AppendLine();
                    msg.AppendLine(MakePeriod(launchingInfo.launching.maintenance.localBeginDate, launchingInfo.launching.maintenance.localEndDate));

                    ShowSystemPopup(
                        GetButtonTypeWithPageTypeCode(launchingInfo.launching.maintenance.pageTypeCode),
                        DisplayLanguage.Instance.GetString("launching_maintenance_title"),
                        msg.ToString(),
                        DisplayLanguage.Instance.GetString("common_show_detail_button"),
                        DisplayLanguage.Instance.GetString("common_close_button"),
                        DisplayLanguage.Instance.GetString("common_show_detail_message"),
                        (buttonID) =>
                        {
                            if (GamebaseUtilAlertButtonID.BUTTON_ONE == buttonID)
                            {
                                if (false == string.IsNullOrEmpty(launchingInfo.launching.maintenance.url))
                                {
                                    GamebaseWebviewImplementation.Instance.OpenWebBrowser(launchingInfo.launching.maintenance.url);
                                }
                            }
                        });
                }
                break;
            }

            case GamebaseLaunchingStatus.INSPECTING_ALL_SERVICES:       // 서비스 전체 점검
            {
                if (null != launchingInfo.launching.maintenance)
                {
                    StringBuilder msg = new StringBuilder();
                    msg.AppendLine(DisplayLanguage.Instance.GetString("launching_maintenance_message"));
                    msg.AppendLine();
                    msg.AppendLine(MakePeriod(launchingInfo.launching.maintenance.localBeginDate, launchingInfo.launching.maintenance.localEndDate));

                    ShowSystemPopup(
                        GetButtonTypeWithPageTypeCode(launchingInfo.launching.maintenance.pageTypeCode),
                        DisplayLanguage.Instance.GetString("launching_maintenance_title"),
                        msg.ToString(),
                        DisplayLanguage.Instance.GetString("common_show_detail_button"),
                        DisplayLanguage.Instance.GetString("common_close_button"),
                        DisplayLanguage.Instance.GetString("common_show_detail_message"),
                        (buttonID) =>
                        {
                            if (GamebaseUtilAlertButtonID.BUTTON_ONE == buttonID)
                            {
                                if (false == string.IsNullOrEmpty(launchingInfo.launching.maintenance.url))
                                {
                                    GamebaseWebviewImplementation.Instance.OpenWebBrowser(launchingInfo.launching.maintenance.url);
                                }
                            }
                        });
                }
                break;
            }

            case GamebaseLaunchingStatus.TERMINATED_SERVICE:            // 서비스 종료
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendLine(launchingInfo.launching.status.message);

                ShowSystemPopup(
                    GamebaseUtilAlertType.ALERT_OK,
                    DisplayLanguage.Instance.GetString("launching_service_closed_title"),
                    msg.ToString(),
                    string.Empty,
                    DisplayLanguage.Instance.GetString("common_close_button"),
                    string.Empty,
                    (buttonID) => { });
                break;
            }

            case GamebaseLaunchingStatus.RECOMMEND_UPDATE:              // 업데이트 권장
            {
#if !UNITY_WEBGL
                StringBuilder msg = new StringBuilder();
                msg.Append(launchingInfo.launching.status.message);

                ShowSystemPopup(
                    GamebaseUtilAlertType.ALERT_OKCANCEL,
                    DisplayLanguage.Instance.GetString("launching_update_recommended_title"),
                    msg.ToString(),
                    DisplayLanguage.Instance.GetString("launching_update_now_label"),
                    DisplayLanguage.Instance.GetString("launching_update_later_label"),
                    string.Empty,
                    (buttonID) =>
                    {
                        if (GamebaseUtilAlertButtonID.BUTTON_ONE == buttonID)
                        {
                            GamebaseWebviewImplementation.Instance.OpenWebBrowser(launchingInfo.launching.app.install.url);
                            Application.Quit();
                        }
                    });

                Application.Quit();
#endif
                break;
            }

            case GamebaseLaunchingStatus.REQUIRE_UPDATE:                // 업데이트 필수
            {
#if !UNITY_WEBGL
                StringBuilder msg = new StringBuilder();
                msg.Append(launchingInfo.launching.status.message);

                ShowSystemPopup(
                    GamebaseUtilAlertType.ALERT_OK,
                    DisplayLanguage.Instance.GetString("launching_update_required_title"),
                    msg.ToString(),
                    string.Empty,
                    DisplayLanguage.Instance.GetString("launching_update_now_label"),
                    string.Empty,
                    (buttonID) =>
                    {
                        if (GamebaseUtilAlertButtonID.BUTTON_ONE == buttonID)
                        {
                            GamebaseWebviewImplementation.Instance.OpenWebBrowser(launchingInfo.launching.app.install.url);
                            Application.Quit();
                        }
                    });
#endif
                break;
            }

            default:
            {
                break;
            }
            }
        }
コード例 #16
0
        protected void RequestGamebaseLogin(WebSocketRequest.RequestVO requestVO, int handle)
        {
            isAuthenticationAlreadyProgress = true;

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

                GamebaseCallbackHandler.UnregisterCallback(handle);

                if (null == error)
                {
                    AuthRequest.LoginVO.Payload payload = JsonMapper.ToObject <AuthRequest.LoginVO.Payload>(requestVO.payload);
                    GamebaseAnalytics.Instance.IdPCode  = payload.idPInfo.idPCode;

                    var vo = JsonMapper.ToObject <AuthResponse.LoginInfo>(response);
                    if (true == vo.header.isSuccessful)
                    {
                        DataContainer.SetData(VOKey.Auth.LOGIN_INFO, vo);
                        Heartbeat.Instance.StartHeartbeat();
                        Introspect.Instance.StartIntrospect();
                    }
                    else
                    {
                        error = GamebaseErrorUtil.CreateGamebaseErrorByServerErrorCode(requestVO.transactionId, requestVO.apiId, vo.header, Domain);
                        if (null != vo.ban)
                        {
                            DataContainer.SetData(VOKey.Auth.BAN_INFO, vo.ban);

                            GamebaseSystemPopup.Instance.ShowErrorPopup(error, vo);
                        }
                    }
                }
                else
                {
                    GamebaseSystemPopup.Instance.ShowErrorPopup(error);
                }

                isAuthenticationAlreadyProgress = false;

                if (error == null)
                {
                    GamebaseLog.Debug("ToastSdk UserId", this);
                    GamebaseResponse.Auth.AuthToken authToken = JsonMapper.ToObject <GamebaseResponse.Auth.AuthToken>(response);
                    ToastSdk.UserId = authToken.member.userId;
                    AuthRequest.LoginVO.Payload payload = JsonMapper.ToObject <AuthRequest.LoginVO.Payload>(requestVO.payload);
                    SetIapExtraData(payload.idPInfo.idPCode);
                    GamebaseLog.Debug("GamebaseIapManager Initialize", this);

                    PurchaseAdapterManager.Instance.Initialize();

                    callback(authToken, error);
                }
                else
                {
                    callback(null, error);
                }
            });
        }
コード例 #17
0
 public void SetDebugMode(bool isDebugMode)
 {
     GamebaseLog.SetDebugMode(isDebugMode);
 }
コード例 #18
0
        private void GetAccessToken(string providerName, System.Action <WebSocketRequest.RequestVO> callback)
        {
            WebSocketRequest.RequestVO requestVO = null;

            GamebaseResponse.Launching.LaunchingInfo launchingInfo = Gamebase.Launching.GetLaunchingInformations();

            if (launchingInfo.launching.app.loginUrls == null ||
                string.IsNullOrEmpty(launchingInfo.launching.app.loginUrls.gamebaseUrl) == true)
            {
#if UNITY_EDITOR
                GamebaseLog.Error("You need to switch platform the Standalone.", this);
#else
                GamebaseLog.Debug("launchingInfo.launching.standalone is null.", this);
#endif
                callback(requestVO);
                return;
            }

            if (launchingInfo == null)
            {
                GamebaseLog.Debug("launchingInfo is null.", this);
                callback(requestVO);
                return;
            }

            GamebaseResponse.Launching.LaunchingInfo.GamebaseLaunching.APP.LaunchingIDPInfo launchingIDPInfo = launchingInfo.launching.app.idP["gbid"];

            if (launchingIDPInfo == null)
            {
                GamebaseLog.Debug("gbid is null.", this);
                callback(requestVO);
                return;
            }

            string clientID = launchingIDPInfo.clientId;

            StringBuilder url = new StringBuilder(launchingInfo.launching.app.loginUrls.gamebaseUrl);
            url.AppendFormat("?clientId={0}", clientID);
            url.AppendFormat("&snsCd={0}", providerName);
            url.AppendFormat("&svcUrl={0}", Uri.EscapeDataString(SCHEME_AUTH_LOGIN));
            url.AppendFormat("&tokenKind={0}", "SNS");
            url.Append("&isMobile=true");
            url.Append(MakeProviderAdditionalInfo(providerName));

            WebviewAdapterManager.Instance.ShowWebView(
                url.ToString(),
                null,
                (error) =>
            {
                callback(requestVO);
            },
                new List <string>()
            {
                SCHEME_AUTH_LOGIN,
                SCHEME_WEBVIEW_CLOSE
            },
                (scheme, error) =>
            {
                WebviewAdapterManager.SchemeInfo schemeInfo = WebviewAdapterManager.Instance.ConvertURLToSchemeInfo(scheme);

                if (schemeInfo.scheme.Equals(SCHEME_AUTH_LOGIN) == true)
                {
                    var idPAccessToken = string.Empty;
                    if (schemeInfo.parameterDictionary.TryGetValue(ACCESS_TOKEN_KEY, out idPAccessToken) == true)
                    {
                        requestVO = AuthMessage.GetIDPLoginMessage(providerName, idPAccessToken);

                        WebviewAdapterManager.Instance.CloseWebView();
                    }
                }
                else if (schemeInfo.scheme.Equals(SCHEME_WEBVIEW_CLOSE) == true)
                {
                    WebviewAdapterManager.Instance.CloseWebView();
                }
            });
        }
コード例 #19
0
 public static void FireNotSupportedAPI(object classObj, [System.Runtime.CompilerServices.CallerMemberName] string methodName = "")
 {
     GamebaseLog.Warn(string.Format("{0}", CreateNotSupportedMessage()), classObj, methodName);
 }
コード例 #20
0
 private void OnOpen(object sender, EventArgs e)
 {
     GamebaseLog.Debug("socket connected.", this);
 }
コード例 #21
0
        public void StopIntrospect()
        {
            GamebaseLog.Debug("Stop Introspect", this);

            GamebaseCoroutineManager.StopAllCoroutines(GamebaseGameObjectManager.GameObjectType.INTROSPECT_TYPE);
        }
コード例 #22
0
 private void OnClose(object sender, CloseEventArgs e)
 {
     GamebaseLog.Debug("socket disconnected.", this);
 }
コード例 #23
0
 public void SetDebugMode(bool isDebugMode)
 {
     IsDebugMode = isDebugMode;
     GamebaseLog.SetDebugLog(logSetting.IsDebugMode(isDebugMode));
 }