Esempio n. 1
0
        public void SetConfiguration(GamebaseRequest.Purchase.Configuration iapConfiguration)
        {
            if (adapter == null)
            {
                GamebaseLog.Debug(GamebaseStrings.PURCHASE_ADAPTER_NOT_FOUND, this);
                return;
            }

            adapter.SetConfiguration(iapConfiguration);
        }
Esempio n. 2
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());
        }