public void InitializePurchasing(ProductIAP[] listProduct, UnityAction <Product> buyCallback, UnityAction initCallback = null) { if (IsInitialized()) { if (initCallback != null) { initCallback(); } return; } buyProductCallback = buyCallback; buyProductCallbackDefault = buyCallback; initializedCallback = initCallback; var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); for (int i = 0; i < listProduct.Length; i++) { builder.AddProduct(listProduct[i].productId, listProduct[i].productType); } #if UNITY_ANDROID || UNITY_IOS //@ToDo //validator = new CrossPlatformValidator(GooglePlayTangle.Data(), AppleTangle.Data(), Application.identifier); #endif UnityPurchasing.Initialize(this, builder); }
public void Initialize() { if (IsInitialized) { return; } m_Logger = new Logger(this); PurchasableItems = new Dictionary <string, ScriptDirectoryItem>(); var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); var items = ScriptRunnerManager.Instance.GetScriptRunners().Where(item => !string.IsNullOrEmpty(item.ProductIdentifier)); foreach (var item in items) { if (PurchasableItems.ContainsKey(item.ProductIdentifier)) { m_Logger.Warning(string.Format("PurchaseManager Purchasable item ({0}) already registered.", item.ProductIdentifier)); continue; } m_Logger.Verbose(string.Format("PurchaseManager Purchasable item ({0}) registered.", item.ProductIdentifier)); PurchasableItems.Add(item.ProductIdentifier, item); builder.AddProduct(item.ProductIdentifier, ProductType.NonConsumable); } UnityPurchasing.Initialize(this, builder); m_Logger.Verbose(string.Format("PurchaseManager {0} initialized.", this.GetType())); }
// public class MyPurchasingModule : UnityEngine.Purchasing.Extension.IPurchasingModule { // public void Configure (UnityEngine.Purchasing.Extension.IPurchasingBinder binder) { // binder.RegisterStore("MyManufacturerAppStore", InstantiateMyManufacturerAppStore()); // // Our Purchasing service implementation provides the real implementation. // binder.RegisterExtension<IStoreExtension>(new FakeManufacturerExtensions()); // } // UnityEngine.Purchasing.Extension.IStore InstantiateMyManufacturerAppStore () { // // Check for Manufacturer. "Android" used here for the sake of example. // // In your implementation, return platform-appropriate store instead of "null". // if (Application.platform == RuntimePlatform.Android) { return null; } // else { return null; } // } // public IStoreExtension IManufacturerExtensions() { return null; } // } // public class FakeManufacturerExtensions : IStoreExtension { // } private void ReadyIAPFeature(ProductInfo[] productInfos) { routerState = RouterState.LoadingStore; #if !Update_PurchaseLib var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); foreach (var productInfo in productInfos) { builder.AddProduct( productInfo.productId, ProductType.Consumable, new IDs { { productInfo.platformProductId, storeKind } } ); } /* * check network connectivity again. because Unity IAP never tells offline. */ if (Application.internetReachability == NetworkReachability.NotReachable) { failedToReady(PurchaseReadyError.Offline, 0, "network is offline."); return; } UnityPurchasing.Initialize(this, builder); #endif }
public override void RestoreReciepts(IExtensionProvider sentProvider) { var apple = sentProvider.GetExtension <IAppleExtensions>(); apple.RestoreTransactions((result) => { if (result) { try { ConfigurationBuilder builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); appleReceipt = GetReceiptData(builder); foreach (AppleInAppPurchaseReceipt productReceipt in appleReceipt.inAppPurchaseReceipts) { PurchaseAction(productReceipt.productID); } } catch (System.Exception e) { e.ToString(); Debug.Log("Faled to restore purchases"); } } RestoreAction(result); }); }
public void InitializePurchasing() { if (IsInitialized()) { return; } var module = StandardPurchasingModule.Instance(); ConfigurationBuilder builder = ConfigurationBuilder.Instance(module); builder.AddProduct(Pentatiles.RemoveAds, ProductType.Consumable, new IDs { { Pentatiles.Google.RemoveAds, GooglePlay.Name }, { Pentatiles.Apple.RemoveAds, AppleAppStore.Name } }); builder.AddProduct(Pentatiles.Hint_110, ProductType.Consumable, new IDs { { Pentatiles.Google.Hint_110, GooglePlay.Name }, { Pentatiles.Apple.Hint_110, AppleAppStore.Name } }); builder.AddProduct(Pentatiles.Hint_55, ProductType.Consumable, new IDs { { Pentatiles.Google.Hint_55, GooglePlay.Name }, { Pentatiles.Apple.Hint_55, AppleAppStore.Name } }); builder.AddProduct(Pentatiles.Hint_10, ProductType.Consumable, new IDs { { Pentatiles.Google.Hint_10, GooglePlay.Name }, { Pentatiles.Apple.Hint_10, AppleAppStore.Name } }); UnityPurchasing.Initialize(this, builder); }
public void InitializePurchasing() { // If we have already connected to Purchasing ... if (IsInitialized()) { // ... we are done here. return; } // Create a builder, first passing in a suite of Unity provided stores. var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); // Add a product to sell / restore by way of its identifier, associating the general identifier // with its store-specific identifiers. builder.AddProduct(oneEuroDonation, ProductType.Consumable); builder.AddProduct(threeEuroDonation, ProductType.Consumable); builder.AddProduct(fiveEuroDonation, ProductType.Consumable); builder.AddProduct(tenEuroDonation, ProductType.Consumable); // Kick off the remainder of the set-up with an asynchrounous call, passing the configuration // and this class' instance. Expect a response either in OnInitialized or OnInitializeFailed. UnityPurchasing.Initialize(this, builder); }
public void InitializePurchasing() { // If we have already connected to Purchasing ... if (IsInitialized()) { // ... we are done here. return; } // Create a builder, first passing in a suite of Unity provided stores. var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); // Add a product to sell / restore by way of its identifier, associating the general identifier with its store-specific identifiers. builder.AddProduct(kProductIDGold099, ProductType.Consumable, new IDs() { { kProductNameAppleGold099, AppleAppStore.Name }, { kProductNameGooglePlayGold099, GooglePlay.Name }, }); builder.AddProduct(kProductIDGold199, ProductType.NonConsumable, new IDs() { { kProductNameAppleGold199, AppleAppStore.Name }, { kProductNameGooglePlayGold199, GooglePlay.Name }, }); builder.AddProduct(kProductIDGold499, ProductType.Subscription, new IDs() { { kProductNameAppleGold499, AppleAppStore.Name }, { kProductNameGooglePlayGold499, GooglePlay.Name }, }); // Kick off the remainder of the set-up with an asynchrounous call, passing the configuration and this class' instance. Expect a response either in OnInitialized or OnInitializeFailed. UnityPurchasing.Initialize(this, builder); }
public void initialize(PurchaseScriptable[] list) { if (IsInitialized) { return; } var module = StandardPurchasingModule.Instance(); #if UNITY_EDITOR module.useFakeStoreUIMode = FakeStoreUIMode.StandardUser; #endif var builder = ConfigurationBuilder.Instance(module); foreach (var item in list) { builder.AddProduct(item.product_id, item.type, new IDs { { item.product_id, GooglePlay.Name }, { item.product_id, AppleAppStore.Name }, }); } // async -> OnInitialized or OnInitializeFailed UnityPurchasing.Initialize(this, builder); }
public void InitializePurchasing() { if (IsInitialized()) { return; } #if UNITY_PURCHASING m_StoreListener = new StoreListener(); m_StoreListener.storeManager = this; var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); foreach (StoreItem item in products) { builder.AddProduct(item.id, item.GetProductType(), new IDs() { { item.appleAppStore, AppleAppStore.Name }, { item.googlePlayStore, GooglePlay.Name }, { item.macAppStore, MacAppStore.Name }, { item.amazonAppStore, AmazonApps.Name }, }); } UnityPurchasing.Initialize(m_StoreListener, builder); #endif }
public void InitializePurchasing() { // If we have already connected to Purchasing ... if (IsInitialized()) { // ... we are done here. return; } //Don't think I'm able to fix this error here. // Create a builder, first passing in a suite of Unity provided stores. var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); builder.AddProduct(Product_1_99, ProductType.Consumable); builder.AddProduct(Product_14_99, ProductType.Consumable); builder.AddProduct(Product_49_99, ProductType.Consumable); builder.AddProduct(Product_79_99, ProductType.Consumable); builder.AddProduct(Product_144_99, ProductType.Consumable); builder.AddProduct(Product_299_99, ProductType.Consumable); builder.AddProduct(kProductIDNonConsumable, ProductType.NonConsumable); // Kick off the remainder of the set-up with an asynchrounous call, passing the configuration // and this class' instance. Expect a response either in OnInitialized or OnInitializeFailed. UnityPurchasing.Initialize(this, builder); }
public void InitializePurchasing() { // If we have already connected to Purchasing ... if (IsInitialized()) { // ... we are done here. return; } // Create a builder, first passing in a suite of Unity provided stores. var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); // Add a product to sell / restore by way of its identifier, associating the general identifier // with its store-specific identifiers. (РАсходуемые) builder.AddProduct(THEME_LAWYER, ProductType.Consumable); // Continue adding the non-consumable product. (Не расходуемые) builder.AddProduct(THEME_RETRO, ProductType.NonConsumable); builder.AddProduct(THEME_CARD, ProductType.NonConsumable); builder.AddProduct(THEME_MAJONG, ProductType.NonConsumable); builder.AddProduct(THEME_SCI_FI, ProductType.NonConsumable); builder.AddProduct(THEME_VISA, ProductType.NonConsumable); // Kick off the remainder of the set-up with an asynchrounous call, passing the configuration // and this class' instance. Expect a response either in OnInitialized or OnInitializeFailed. UnityPurchasing.Initialize(this, builder); }
public void InitializePurchasing() { // If we have already connected to Purchasing ... if (IsInitialized()) { // ... we are done here. return; } // Create a builder, first passing in a suite of Unity provided stores. var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); builder.AddProduct(PRODUCT_CHEST_SIMPLE, ProductType.Consumable); builder.AddProduct(PRODUCT_CHEST_ELITE, ProductType.Consumable); builder.AddProduct(PRODUCT_COINS_SMALL, ProductType.Consumable); builder.AddProduct(PRODUCT_COINS_LARGE, ProductType.Consumable); builder.AddProduct(PRODUCT_AUTOCLICKER, ProductType.NonConsumable); builder.AddProduct(PRODUCT_MEDKIT, ProductType.Consumable); builder.AddProduct(PRODUCT_SECOND_CHANCE, ProductType.Consumable); builder.AddProduct(PRODUCT_UPGRADE, ProductType.Consumable); // Kick off the remainder of the set-up with an asynchrounous call, passing the configuration // and this class' instance. Expect a response either in OnInitialized or OnInitializeFailed. UnityPurchasing.Initialize(this, builder); }
public void InitializePurchasing() { if (IsInitialized()) { return; } var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); //Step 2: Choose if your product is a consumable or non consumable builder.AddProduct(removeAds, ProductType.NonConsumable); builder.AddProduct(doubleCoins, ProductType.NonConsumable); builder.AddProduct(coins7500, ProductType.Consumable); builder.AddProduct(coins45000, ProductType.Consumable); builder.AddProduct(coins90000, ProductType.Consumable); builder.AddProduct(coins180k, ProductType.Consumable); builder.AddProduct(coins500k, ProductType.Consumable); builder.AddProduct(coins1m, ProductType.Consumable); builder.AddProduct(hearts25, ProductType.Consumable); builder.AddProduct(hearts50, ProductType.Consumable); builder.AddProduct(hearts110, ProductType.Consumable); builder.AddProduct(hearts300, ProductType.Consumable); builder.AddProduct(hearts650, ProductType.Consumable); UnityPurchasing.Initialize(this, builder); }
public void InitializePurchasing() { // If we have already connected to Purchasing ... if (IsInitialized()) { // ... we are done here. return; } // Create a builder, first passing in a suite of Unity provided stores. var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); builder.Configure <IGooglePlayConfiguration>().SetPublicKey(MyLicenseKey); //Debug.Log("INIT COMPLETE :: MODULE!!!!"); // 구글플레이 및 iOS 개발센터에 등록된 상품코드 매칭용 // 상품 코드 변경시 같이 변경할것. for (int i = 1; i <= 252; i++) { builder.AddProduct(i.ToString(), ProductType.Consumable); } Debug.Log("INIT IAP Add Product ( 0 ~ 252 ) COMPLETE!!! "); UnityPurchasing.Initialize(this, builder); }
/// <summary> /// Setup the purchasing, add our products we have and set up callbacks /// </summary> public void InitPurchasing() { // If for some reason we already are initalized if (isInitalized()) { // ... then just return since we are already configured return; } // Define the products that we can sell / restore var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); // Go through the products above and add them foreach (IAPProduct product in products) { // Add each one to the builder builder.AddProduct(product.internalID, product.productType, new IDs { { product.appleID, AppleAppStore.Name }, { product.googlePlayID, GooglePlay.Name } }); } // Initalize the purchasing system in unity using our new products above, assign all call backs to our script here UnityPurchasing.Initialize(this, builder); }
public void InitializePurchasing() { // If we have already connected to Purchasing ... if (IsInitialized()) { if (MyOnAllError_ != null) { MyOnAllError_("Already initialized"); } return; } // Create a builder, first passing in a suite of Unity provided stores. var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); // Add a product to list MyProductList.ForEach(x => { builder.AddProduct(x.ProductName, x.ProductType); }); UnityPurchasing.Initialize(this, builder); if (MyOnInitialized_ != null) { MyOnInitialized_(); } }
public void InitializePurchasing() { // If we have already connected to Purchasing ... if (IsInitialized()) { Debug.Log("Init Completed"); // ... we are done here. return; } // Create a builder, first passing in a suite of Unity provided stores. var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); #if UNITY_ANDROID Debug.Log("Init Android"); builder.AddProduct(productIDAndroidRemoveAds, ProductType.NonConsumable); #else builder.AddProduct(productIDiOSRemoveAds, ProductType.NonConsumable); #endif // Kick off the remainder of the set-up with an asynchrounous call, passing the configuration // and this class' instance. Expect a response either in OnInitialized or OnInitializeFailed. UnityPurchasing.Initialize(this, builder); }
public void InitializePurchasing() { // If we have already connected to Purchasing ... if (IsInitialized()) { // ... we are done here. return; } // Create a builder, first passing in a suite of Unity provided stores. var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); builder.AddProduct(PRODUCT_1000_DIAMOND, ProductType.Consumable); builder.AddProduct(PRODUCT_3500_DIAMOND, ProductType.Consumable); builder.AddProduct(PRODUCT_7000_DIAMOND, ProductType.Consumable); builder.AddProduct(PRODUCT_10000_DIAMOND, ProductType.Consumable); builder.AddProduct(PRODUCT_15000_DIAMOND, ProductType.Consumable); builder.AddProduct(PRODUCT_20000_DIAMOND, ProductType.Consumable); builder.AddProduct(PRODUCT_30000_DIAMOND, ProductType.Consumable); builder.AddProduct(PRODUCT_40000_DIAMOND, ProductType.Consumable); builder.AddProduct(PRODUCT_50000_DIAMOND, ProductType.Consumable); builder.AddProduct(PRODUCT_70000_DIAMOND, ProductType.Consumable); builder.AddProduct(PRODUCT_150000_DIAMOND, ProductType.Consumable); builder.AddProduct(PRODUCT_NOADS, ProductType.NonConsumable); // Kick off the remainder of the set-up with an asynchrounous call, passing the configuration // and this class' instance. Expect a response either in OnInitialized or OnInitializeFailed. UnityPurchasing.Initialize(this, builder); }
private void InitializePurchasing() { if (HasInitialized()) { return; } var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); #if UNITY_ANDROID string storeName = GooglePlay.Name; #elif UNITY_IOS string storeName = AppleAppStore.Name; #endif // Add managedProducts to the builder. foreach (string productName in managedProducts) { builder.AddProduct( productName, ProductType.Consumable, new IDs { { productName, storeName } }); } UnityPurchasing.Initialize(this, builder); }
public void InitializePurchasing() { // If we have already connected to Purchasing ... if (IsInitialized()) { // ... we are done here. return; } var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); builder.AddProduct(GEMS_200, ProductType.Consumable); builder.AddProduct(GEMS_400, ProductType.Consumable); builder.AddProduct(GEMS_600, ProductType.Consumable); builder.AddProduct(GEMS_1100, ProductType.Consumable); builder.AddProduct(GEMS_2300, ProductType.Consumable); builder.AddProduct(GEMS_7200, ProductType.Consumable); builder.AddProduct(GEMS_12500, ProductType.Consumable); builder.AddProduct(GEMS_30000, ProductType.Consumable); builder.AddProduct(NO_ADS, ProductType.NonConsumable); builder.AddProduct(STARTER_PACK, ProductType.Consumable); builder.AddProduct(WEEKEND_PACK, ProductType.Consumable); builder.AddProduct(STATIC_PACK, ProductType.Consumable); builder.AddProduct(SPECIAL_PACK_1, ProductType.Consumable); builder.AddProduct(SPECIAL_PACK_2, ProductType.Consumable); builder.AddProduct(SPECIAL_PACK_3, ProductType.Consumable); builder.AddProduct(WEEK_SUB, ProductType.Subscription); builder.AddProduct(MONTH_SUB, ProductType.Subscription); builder.AddProduct(YEAR_SUB, ProductType.Subscription); UnityPurchasing.Initialize(this, builder); }
public void InitializePurchasing() { if (GetInitialized()) { return; } if (isLog) { Debug.Log("Percent [IAP] InitializePurchasing!"); } var module = StandardPurchasingModule.Instance(); ConfigurationBuilder builder = ConfigurationBuilder.Instance(module); { ProductType type = ProductType.Consumable; // Event var keys = TableManager.Get().ShopProductList.Keys; TDataShopProductList dataEvent; foreach (var key in keys) { if (TableManager.Get().ShopProductList.GetData(key, out dataEvent)) { #if UNITY_IOS builder.AddProduct(dataEvent.appleProductId, type); #elif UNITY_ANDROID builder.AddProduct(dataEvent.googleProductId, type); #endif } } } UnityPurchasing.Initialize(this, builder); }
public void InitializePurchasing() { // If we have already connected to Purchasing ... if (IsInitialized()) { // ... we are done here. return; } // Create a builder, first passing in a suite of Unity provided stores. var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); // Consumable builder.AddProduct(COINS_299, ProductType.Consumable); builder.AddProduct(COINS_99, ProductType.Consumable); // Non-consumable builder.AddProduct(DESTROYER, ProductType.NonConsumable); builder.AddProduct(FIGTER, ProductType.NonConsumable); builder.AddProduct(UFO, ProductType.NonConsumable); builder.AddProduct(PROMETHEUS, ProductType.NonConsumable); builder.AddProduct(NO_ADS, ProductType.NonConsumable); // Kick off the remainder of the set-up with an asynchrounous call, passing the configuration // and this class' instance. Expect a response either in OnInitialized or OnInitializeFailed. UnityPurchasing.Initialize(this, builder); }
public void InitializePurchasing() { // If we have already connected to Purchasing ... LDebug.Log("====> If we have already connected to Purchasing ..."); if (IsInitialized()) { // ... we are done here. LDebug.Log("====> ....we are done here."); return; } var productDict = PurchaserDataModel.Instance.ProductsDict; // Create a builder, first passing in a suite of Unity provided stores. var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.OSXPlayer) { foreach (var product in productDict) { builder.AddProduct(product.Value.BuyID, ProductType.Consumable, new IDs { { product.Value.BuyID, AppleAppStore.Name } }); //Discount Item if (!string.IsNullOrEmpty(product.Value.AlternativeBuyID)) { builder.AddProduct(product.Value.AlternativeBuyID, ProductType.Consumable, new IDs { { product.Value.AlternativeBuyID, AppleAppStore.Name } }); } } } //Android && PC else { foreach (var product in productDict) { builder.AddProduct(product.Value.BuyID, ProductType.Consumable, new IDs { { product.Value.BuyID, GooglePlay.Name } }); //Discount Item if (!string.IsNullOrEmpty(product.Value.AlternativeBuyID)) { builder.AddProduct(product.Value.AlternativeBuyID, ProductType.Consumable, new IDs { { product.Value.AlternativeBuyID, GooglePlay.Name } }); } } } // Kick off the remainder of the set-up with an asynchrounous call, passing the configuration // and this class' instance. Expect a response either in OnInitialized or OnInitializeFailed. UnityPurchasing.Initialize(this, builder); }
void Awake() { ConfigurationBuilder builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); builder.AddProduct("levelpackfoo", ProductType.NonConsumable); UnityPurchasing.Initialize(this, builder); }
//----- property ----- //----- method ----- public void Initialize() { var purchasingModule = StandardPurchasingModule.Instance(); var configurationBuilder = ConfigurationBuilder.Instance(purchasingModule); if (configurationBuilder != null) { var googlePlayConfiguration = configurationBuilder.Configure <IGooglePlayConfiguration>(); if (googlePlayConfiguration != null) { Action <Product> onDeferredPurchaseCallback = product => { OnDeferredPurchase(product); if (onDeferredPurchase != null) { onDeferredPurchase.OnNext(product); } }; googlePlayConfiguration.SetDeferredPurchaseListener(onDeferredPurchaseCallback); } } }
private void InitializePurchasing() { if (IsInitialized()) { return; } try { var module = StandardPurchasingModule.Instance(); ConfigurationBuilder builder = ConfigurationBuilder.Instance(module); for (int i = 0, max = DataManager.GetInstance().GetProductListCount(); i < max; i++) { string productKey = ""; if (DataManager.GetInstance().TryGetProductKey(i, ref productKey)) { builder.AddProduct(productKey, ProductType.Consumable, new IDs { { productKey, AppleAppStore.Name }, { productKey, GooglePlay.Name }, }); } } UnityPurchasing.Initialize(this, builder); } catch (System.Exception e) { Debug.LogError(e.ToString()); } }
/*void Start() * { * * if (m_StoreController == null) * { * // Begin to configure our connection to Purchasing * InitializePurchasing(); * } * }*/ public void InitializePurchasing() { Debug.Log("[IAPManager] Initing Unity IAP"); // If we have already connected to Purchasing ... if (IsInitialized()) { // ... we are done here. return; } Debug.Log("[IAPManager] Inicializando IAP..."); // Create a builder, first passing in a suite of Unity provided stores. var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); builder.AddProduct(PRODUCT_HUELLAS200, ProductType.Consumable); builder.AddProduct(PRODUCT_HUELLAS500, ProductType.Consumable); builder.AddProduct(PRODUCT_HUELLAS1000, ProductType.Consumable); // Continue adding the non-consumable product. builder.AddProduct(kProductIDNonConsumable, ProductType.NonConsumable); // And finish adding the subscription product. Notice this uses store-specific IDs, illustrating // if the Product ID was configured differently between Apple and Google stores. Also note that // one uses the general kProductIDSubscription handle inside the game - the store-specific IDs // must only be referenced here. builder.AddProduct(kProductIDSubscription, ProductType.Subscription, new IDs() { { kProductNameAppleSubscription, AppleAppStore.Name }, { kProductNameGooglePlaySubscription, GooglePlay.Name }, }); // Kick off the remainder of the set-up with an asynchrounous call, passing the configuration // and this class' instance. Expect a response either in OnInitialized or OnInitializeFailed. UnityPurchasing.Initialize(this, builder); Debug.Log("[IAPManager] IAP inicializado !!!"); }
public void Restore() { if (Application.platform == RuntimePlatform.WSAPlayerX86 || Application.platform == RuntimePlatform.WSAPlayerX64 || Application.platform == RuntimePlatform.WSAPlayerARM) { this.mExtensions.GetExtension <IMicrosoftExtensions>().RestoreTransactions(); } else if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.tvOS) { this.mExtensions.GetExtension <IAppleExtensions>().RestoreTransactions(this.OnTransactionsRestored); } else if (Application.platform == RuntimePlatform.Android && StandardPurchasingModule.Instance().appStore == AppStore.SamsungApps) { this.mExtensions.GetExtension <ISamsungAppsExtensions>().RestoreTransactions(this.OnTransactionsRestored); } else if (Application.platform == RuntimePlatform.Android && StandardPurchasingModule.Instance().appStore == AppStore.CloudMoolah) { this.mExtensions.GetExtension <IMoolahExtension>().RestoreTransactionID((restoreTransactionIDState) => { this.OnTransactionsRestored( restoreTransactionIDState != RestoreTransactionIDState.RestoreFailed && restoreTransactionIDState != RestoreTransactionIDState.NotKnown); }); } else { Debug.LogWarning(Application.platform.ToString() + " is not a supported platform for the Codeless IAP restore button"); } }
public void InitializePurchasing() { // If we have already connected to Purchasing ... if (IsInitialized()) { // ... we are done here. return; } // Create a builder, first passing in a suite of Unity provided stores. var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); // Add a product to sell / restore by way of its identifier, associating the general identifier // with its store-specific identifiers. //builder.AddProduct(kProductIDConsumable, ProductType.Consumable); // Continue adding the non-consumable product. //builder.AddProduct(kProductIDNonConsumable, ProductType.NonConsumable); // And finish adding the subscription product. Notice this uses store-specific IDs, illustrating // if the Product ID was configured differently between Apple and Google stores. Also note that // one uses the general kProductIDSubscription handle inside the game - the store-specific IDs // must only be referenced here. //builder.AddProduct(kProductIDSubscription, ProductType.Subscription, new IDs(){ //{ kProductNameAppleSubscription, AppleAppStore.Name }, //{ kProductNameGooglePlaySubscription, GooglePlay.Name }, //}); builder.AddProduct(PRODUCT_50_COINS, ProductType.Consumable); builder.AddProduct(PRODUCT_100_COINS, ProductType.Consumable); builder.AddProduct(PRODUCT_200_COINS, ProductType.Consumable); builder.AddProduct(PRODUCT_NOADS, ProductType.NonConsumable); // Kick off the remainder of the set-up with an asynchrounous call, passing the configuration // and this class' instance. Expect a response either in OnInitialized or OnInitializeFailed. UnityPurchasing.Initialize(this, builder); }
////////////////////////////////////////////////////////////// //// ILifeCycle ////////////////////////////////////////////////////////////// public override void OnInit() { // If we haven't set up the Unity Purchasing reference if (m_StoreController == null) { // Begin to configure our connection to Purchasing // If we have already connected to Purchasing ... if (IsInitialized()) { // ... we are done here. return; } // Create a builder, first passing in a suite of Unity provided stores. var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); komal.Config.ID.iap.ForEach(it => { if (it.Type == komal.Config.PurchaseType.Consumable) { // Add a product to sell / restore by way of its identifier, associating the general identifier // with its store-specific identifiers. builder.AddProduct(it.ID, ProductType.Consumable); } else if (it.Type == komal.Config.PurchaseType.NonConsumable) { // Continue adding the non-consumable product. builder.AddProduct(it.ID, ProductType.NonConsumable); } }); // Kick off the remainder of the set-up with an asynchrounous call, passing the configuration // and this class' instance. Expect a response either in OnInitialized or OnInitializeFailed. UnityPurchasing.Initialize(this, builder); } }