コード例 #1
0
        /// <summary>
        /// The main initialization call for Unity Purchasing.
        /// </summary>
        /// <param name="listener"> The <c>IStoreListener</c> to receive callbacks for future transactions </param>
        /// <param name="builder"> The <c>ConfigurationBuilder</c> containing the product definitions mapped to stores </param>
        public static void Initialize(IStoreListener listener, ConfigurationBuilder builder)
        {
#if UNITY_2017_1_OR_NEWER
            Initialize(listener, builder, UnityEngine.Debug.unityLogger, Application.persistentDataPath, new UnityAnalytics(), builder.factory.GetCatalogProvider());
#else
            Initialize(listener, builder, UnityEngine.Debug.logger, Application.persistentDataPath, new UnityAnalytics(), builder.factory.GetCatalogProvider());
#endif
        }
コード例 #2
0
ファイル: Controller.cs プロジェクト: zendorx/testapp
        public void Init(ConfigurationBuilder configurationBuilder, string[] productDefinitions,
                         IStoreListener customStoreListener)
        {
            _configurationBuilder = configurationBuilder;
            if (_configurationBuilder == null)
            {
                var module = StandardPurchasingModule.Instance();
                _configurationBuilder = ConfigurationBuilder.Instance(module);
            }

            _compoundStoreListener.Clear();
            _compoundStoreListener.AddStoreListener(this);
            if (customStoreListener != null)
            {
                _compoundStoreListener.AddStoreListener(customStoreListener);
            }

            StopAllCoroutines();

            Settings.Check();
            isReady        = false;
            _specialOffers = new SpecialOffers();
            if (productDefinitions != null)
            {
                productDefinitions.ForEach(id =>
                {
                    _configurationBuilder.products.Add(CreateProduct(id, ProductType.Consumable));
                });
            }

            Login(
                loginData =>
            {
                if (_configurationBuilder.products.Count > 0)
                {
                    UnityPurchasingInit();
                }
                else
                {
                    isReady = true;
                    if (Initialized != null)
                    {
                        Initialized();
                    }
                }
                StartCoroutine(C_CheckSpecialOffers());
            },
                err =>
            {
                LogUtils.LogError("Logging error : " + err);
                UnityPurchasingInit();
            }
                );
        }
コード例 #3
0
        public static void Initialize(IStoreListener listener, ConfigurationBuilder builder)
        {
            #if UNITY_ANDROID
            _platform = new UnityAdsPurchasingPlatformAndroid();
            #elif UNITY_IOS
            _platform = new UnityAdsPurchasingPlatformIos();
            #else
            _platform = new UnityAdsPurchasingPlatformUnsupported();
            #endif

            _platform.Initialize(listener, builder);
        }
        public void Initialize(IStoreListener storeListener, ConfigurationBuilder builder)
        {
            InitializeUnityAdsPurchasingWrapper();
            UnityAdsSetDidInitiatePurchasingCommandCallback(UnityAdsDidInitiatePurchasingCommand);
            UnityAdsSetGetProductCatalogCallback(UnityAdsPurchasingGetProductCatalog);
            UnityAdsSetGetVersionCallback(UnityAdsPurchasingGetPurchasingVersion);
            UnityAdsSetInitializePurchasingCallback(UnityAdsPurchasingInitialize);

            UnityPurchasing.Initialize(storeListener, builder);

            SetMetaData();
        }
コード例 #5
0
        /// <summary>
        /// Created for integration testing.
        /// </summary>
        internal static void Initialize(IStoreListener listener, ConfigurationBuilder builder,
                                        ILogger logger, string persistentDatapath, IUnityAnalytics analytics, ICatalogProvider catalog)
        {
            var transactionLog    = new TransactionLog(logger, persistentDatapath);
            var manager           = new PurchasingManager(transactionLog, logger, builder.factory.service, builder.factory.storeName);
            var analyticsReporter = new AnalyticsReporter(analytics);

            // Proxy the PurchasingManager's callback interface to forward Transactions to Analytics.
            var proxy = new StoreListenerProxy(listener, analyticsReporter, builder.factory);

            FetchAndMergeProducts(builder.useCatalogProvider, builder.products, catalog, response =>
            {
                manager.Initialize(proxy, response);
            });
        }
コード例 #6
0
 public void RemoveStoreListener(IStoreListener listener)
 {
     _list.Remove(listener);
 }
コード例 #7
0
 public void AddStoreListener(IStoreListener listener)
 {
     _list.Add(listener);
 }
コード例 #8
0
 public StoreListenerProxy(IStoreListener forwardTo, AnalyticsReporter analytics, IExtensionProvider extensions)
 {
     this.m_ForwardTo  = forwardTo;
     this.m_Analytics  = analytics;
     this.m_Extensions = extensions;
 }
 public void Initialize(IStoreListener storeListener, ConfigurationBuilder builder)
 {
     UnityPurchasing.Initialize(storeListener, builder);
     m_UnityPurchasing.CallStatic("initialize", this);
     SetMetaData();
 }
コード例 #10
0
ファイル: Gow.cs プロジェクト: zendorx/testapp
 /// <summary>
 /// Initialize SDK functionality. Must be called first, before using other methods.
 /// Initialization takes some time. You should wait until system will ready.
 /// </summary>
 /// <param name="configurationBuilder">Unity IAP configuration.</param>
 /// <param name="customStoreListener">Optional custom IStoreListener that processes purchasing related events.</param>
 public static void Init(ConfigurationBuilder configurationBuilder, IStoreListener customStoreListener = null)
 {
     Controller.instance.Init(configurationBuilder, null, customStoreListener);
 }
コード例 #11
0
ファイル: Gow.cs プロジェクト: zendorx/testapp
 /// <summary>
 /// Initialize SDK functionality. Must be called first, before using other methods.
 /// Initialization takes some time. You should wait until system will ready.
 /// </summary>
 /// <param name="productIds">Optional array of ProductIds.</param>
 /// <param name="customStoreListener">Optional custom IStoreListener that processes purchasing related events.</param>
 public static void Init(string[] productIds = null, IStoreListener customStoreListener = null)
 {
     Controller.instance.Init(null, productIds, customStoreListener);
 }
コード例 #12
0
 /// <summary>
 /// The main initialization call for Unity Purchasing.
 /// </summary>
 /// <param name="listener"> The <c>IStoreListener</c> to receive callbacks for future transactions </param>
 /// <param name="builder"> The <c>ConfigurationBuilder</c> containing the product definitions mapped to stores </param>
 public static void Initialize(IStoreListener listener, ConfigurationBuilder builder)
 {
     Initialize(listener, builder, UnityEngine.Debug.unityLogger, Application.persistentDataPath, new UnityAnalytics(), builder.factory.GetCatalogProvider());
 }
コード例 #13
0
 public StoreListenerProxy(IStoreListener forwardTo, AnalyticsReporter analytics, IExtensionProvider extensions)
 {
     this.m_ForwardTo = forwardTo;
     this.m_Analytics = analytics;
     this.m_Extensions = extensions;
 }
コード例 #14
0
 public void Initialize(IStoreListener storeListener, ConfigurationBuilder builder)
 {
 }