Exemple #1
0
        virtual public void Initialize(GamebaseRequest.GamebaseConfiguration configuration, int handle)
        {
            string jsonData = JsonMapper.ToJson(
                new UnityMessage(
                    Gamebase.GAMEBASE_API_INITIALIZE,
                    handle: handle,
                    jsonData: JsonMapper.ToJson(configuration)
                    ));

            messageSender.GetAsync(jsonData);
        }
 private void SetGamebaseConfiguration(GamebaseRequest.GamebaseConfiguration configuration)
 {
     GamebaseUnitySDK.AppID                      = configuration.appID;
     GamebaseUnitySDK.AppVersion                 = configuration.appVersion;
     GamebaseUnitySDK.ZoneType                   = configuration.zoneType;
     GamebaseUnitySDK.DisplayLanguageCode        = configuration.displayLanguageCode;
     GamebaseUnitySDK.EnablePopup                = configuration.enablePopup;
     GamebaseUnitySDK.EnableLaunchingStatusPopup = configuration.enableLaunchingStatusPopup;
     GamebaseUnitySDK.EnableBanPopup             = configuration.enableBanPopup;
     GamebaseUnitySDK.EnableKickoutPopup         = configuration.enableKickoutPopup;
     GamebaseUnitySDK.FcmSenderId                = configuration.fcmSenderId;
     GamebaseUnitySDK.StoreCode                  = configuration.storeCode;
     GamebaseUnitySDK.UseWebViewLogin            = configuration.useWebViewLogin;
 }
        private GamebaseRequest.GamebaseConfiguration GetGamebaseConfiguration()
        {
            var configuration = new GamebaseRequest.GamebaseConfiguration();

            configuration.appID                      = GamebaseUnitySDK.AppID;
            configuration.appVersion                 = GamebaseUnitySDK.AppVersion;
            configuration.zoneType                   = GamebaseUnitySDK.ZoneType;
            configuration.displayLanguageCode        = GamebaseUnitySDK.DisplayLanguageCode;
            configuration.enablePopup                = GamebaseUnitySDK.EnablePopup;
            configuration.enableLaunchingStatusPopup = GamebaseUnitySDK.EnableLaunchingStatusPopup;
            configuration.enableBanPopup             = GamebaseUnitySDK.EnableBanPopup;
            configuration.enableKickoutPopup         = GamebaseUnitySDK.EnableKickoutPopup;
            configuration.fcmSenderId                = GamebaseUnitySDK.FcmSenderId;
            configuration.storeCode                  = GamebaseUnitySDK.StoreCode;
            configuration.useWebViewLogin            = GamebaseUnitySDK.UseWebViewLogin;
            return(configuration);
        }
        public void Initialize(GamebaseRequest.GamebaseConfiguration configuration, GamebaseCallback.GamebaseDelegate <GamebaseResponse.Launching.LaunchingInfo> callback)
        {
            var sb = new StringBuilder();

            sb.AppendLine(string.Format("Gamebase VERSION:{0}", GamebaseUnitySDK.SDKVersion));
            sb.AppendLine(string.Format("Gamebase Configuration:{0}", GamebaseJsonUtil.ToPrettyJsonString(configuration)));
            GamebaseLog.Debug(string.Format("{0}", sb), this);

            InitializeUnitySDK();

            configuration.zoneType = GetVerifiedZoneType(configuration.zoneType);

            SetGamebaseConfiguration(configuration);

            GamebaseCallback.GamebaseDelegate <GamebaseResponse.Launching.LaunchingInfo> initializeCallback = (launchingInfo, error) =>
            {
                if ((error == null || error.code == GamebaseErrorCode.SUCCESS))
                {
                    GamebaseDebugSettings.Instance.SetRemoteSettings(launchingInfo);

                    GamebaseWaterMark.ShowWaterMark();
                }

                GamebaseLogReport.Instance.AddBasicData(new Dictionary <string, string>()
                {
                    { GamebaseLogReport.BASIC_DATA_KEY_APP_ID, GamebaseUnitySDK.AppID }
                });

                SendUnityEditorInfomation();

                callback(launchingInfo, error);
            };

            int handle = GamebaseCallbackHandler.RegisterCallback(initializeCallback);

            sdk.Initialize(configuration, handle);
        }
Exemple #5
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());
        }
 public void Initialize(GamebaseRequest.GamebaseConfiguration configuration, int handle)
 {
     initializeHandle = handle;
     GamebaseUnitySDKSettings.Instance.StartCoroutine(Init());
 }
Exemple #7
0
        virtual public void Initialize(GamebaseRequest.GamebaseConfiguration configuration, int handle)
        {
            string jsonData = JsonMapper.ToJson(new UnityMessage(Gamebase.GAMEBASE_API_INITIALIZE, handle: handle, jsonData: JsonMapper.ToJson(configuration), gameObjectName: GamebaseUnitySDK.ObjectName, requestMethodName: "OnAsyncEvent"));

            messageSender.GetAsync(jsonData);
        }