Advertisement
Guest User

purchasing

a guest
Feb 9th, 2016
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 18.99 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. using UnityEngine.Purchasing;
  7. using UnityEngine.SceneManagement;
  8.  
  9. // Placing the Purchaser class in the CompleteProject namespace allows it to interact with ScoreManager, one of the existing Survival Shooter scripts.
  10. namespace CompleteProject
  11. {
  12.  
  13.     // Deriving the Purchaser class from IStoreListener enables it to receive messages from Unity Purchasing.
  14.     public class Purchaser : MonoBehaviour, IStoreListener
  15.     {
  16.         private static IStoreController m_StoreController;                                                                  // Reference to the Purchasing system.
  17.         private static IExtensionProvider m_StoreExtensionProvider;                                                         // Reference to store-specific Purchasing subsystems.
  18.         private int compra;
  19.         // Product identifiers for all products capable of being purchased: "convenience" general identifiers for use with Purchasing, and their store-specific identifier counterparts
  20.         // for use with and outside of Unity Purchasing. Define store-specific identifiers also on each platform's publisher dashboard (iTunes Connect, Google Play Developer Console, etc.)
  21.         public TragaNoPj miTraga;
  22.    
  23.         public GameObject Aviso;
  24.         public Text avisotx;
  25.         public string lalola;
  26.         public string lazplayer;
  27.         public string name;
  28.         public GameObject AvisTr;
  29.         public Text avistrtx;
  30.         public GameObject AviSt;
  31.         public Text Avistx;
  32.         private bool compras;
  33.  
  34.         private bool useMockBillingSystem = false;
  35.  
  36.         void Start()
  37.         {
  38.             Aviso.SetActive (false);
  39.             AvisTr.SetActive (false);
  40.  
  41.             compras = false;
  42.             compra = PlayerPrefs.GetInt ("Comprados");
  43.             // If we haven't set up the Unity Purchasing reference
  44.             if (m_StoreController == null)
  45.             {
  46.                 // Begin to configure our connection to Purchasing
  47.                 InitializePurchasing();
  48.             }
  49.         }
  50.  
  51.         public void InitializePurchasing()
  52.         {
  53.             // If we have already connected to Purchasing ...
  54.             if (IsInitialized())
  55.             {
  56.  
  57.                 return;
  58.             }
  59.             #if UNITY_IPHONE || UNITY_ANDROID || UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO
  60.             var module = StandardPurchasingModule.Instance();
  61.             module.useMockBillingSystem = useMockBillingSystem;
  62.             var builder = ConfigurationBuilder.Instance(module);
  63.             builder.Configure<IMicrosoftConfiguration>().useMockBillingSystem = useMockBillingSystem;
  64.  
  65.             #endif
  66.             #if UNITY_ANDROID
  67.             var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
  68.             builder.Configure<IGooglePlayConfiguration>().SetPublicKey(lalola);
  69.             #endif
  70.             /*
  71.             foreach(Skin sk in SkinManager.instance.skins){
  72.                 builder.AddProduct(sk.sku, ProductType.NonConsumable);
  73.                 //          Debug.Log("Add product " + sk.sku);
  74.             }
  75.             */
  76.  
  77.  
  78.  
  79.             builder.AddProduct("b2d2", ProductType.NonConsumable, new IDs
  80.                 {
  81.                     {"b2d2", GooglePlay.Name},
  82.                     {"b2d2", AppleAppStore.Name},
  83.                     {"cincuentakgemasn", WinRT.Name}
  84.                 });
  85.  
  86.             builder.AddProduct("creepers", ProductType.NonConsumable, new IDs
  87.                 {
  88.                     {"creepers", GooglePlay.Name},
  89.                     {"creepers", AppleAppStore.Name},
  90.                     {"creepers", WinRT.Name}
  91.                 });
  92.  
  93.             builder.AddProduct("darckknight", ProductType.NonConsumable, new IDs
  94.                 {
  95.                     {"darckinight", GooglePlay.Name},
  96.                     {"darckinight", AppleAppStore.Name},
  97.                     {"darckinight", WinRT.Name}
  98.                 });
  99.            
  100.             builder.AddProduct("dogi", ProductType.NonConsumable, new IDs
  101.                 {
  102.                     {"dogi", GooglePlay.Name},
  103.                     {"dogi", AppleAppStore.Name},
  104.                     {"dogi", WindowsPhone8.Name}
  105.                 });
  106.  
  107.             builder.AddProduct("drbanner", ProductType.NonConsumable, new IDs
  108.                 {
  109.                     {"drbanner", GooglePlay.Name},
  110.                     {"drbanner", AppleAppStore.Name},
  111.                     {"drbanner", WindowsPhone8.Name}
  112.                 });
  113.            
  114.             builder.AddProduct("enderman", ProductType.NonConsumable, new IDs
  115.                 {
  116.                     {"enderman", GooglePlay.Name},
  117.                     {"enderman", AppleAppStore.Name},
  118.                     {"enderman", WindowsPhone8.Name}
  119.                 });
  120.            
  121.             builder.AddProduct("hannsolo", ProductType.NonConsumable, new IDs
  122.                 {
  123.                     {"hannsolo", GooglePlay.Name},
  124.                     {"hannsolo", AppleAppStore.Name},
  125.                     {"hannsolo", WinRT.Name}
  126.                 });
  127.  
  128.             builder.AddProduct("jedi", ProductType.NonConsumable, new IDs
  129.                 {
  130.                     {"jedi", GooglePlay.Name},
  131.                     {"jedi", AppleAppStore.Name},
  132.                     {"jedi", WinRT.Name}
  133.                 });
  134.            
  135.             builder.AddProduct("kylorem", ProductType.NonConsumable, new IDs
  136.                 {
  137.                     {"kylorem", GooglePlay.Name},
  138.                     {"kylorem", AppleAppStore.Name},
  139.                     {"kylorem", WinRT.Name}
  140.                 });
  141.  
  142.             builder.AddProduct("luis", ProductType.NonConsumable, new IDs
  143.                 {
  144.                     {"luis", GooglePlay.Name},
  145.                     {"luis", AppleAppStore.Name},
  146.                     {"luis", WinRT.Name}
  147.                 });
  148.            
  149.             builder.AddProduct("manofsteel", ProductType.NonConsumable, new IDs
  150.                 {
  151.                     {"manofsteel", GooglePlay.Name},
  152.                     {"manofsteel", AppleAppStore.Name},
  153.                     {"manofsteel", WinRT.Name}
  154.                 });
  155.  
  156.             builder.AddProduct("marcos", ProductType.NonConsumable, new IDs
  157.                 {
  158.                     {"marcos", GooglePlay.Name},
  159.                     {"marcos", AppleAppStore.Name},
  160.                     {"marcos", WinRT.Name}
  161.                 });
  162.  
  163.             builder.AddProduct("soldieramerica", ProductType.NonConsumable, new IDs
  164.                 {
  165.                     {"soldieramerica", GooglePlay.Name},
  166.                     {"soldieramerica", AppleAppStore.Name},
  167.                     {"soldieramerica", WinRT.Name}
  168.                 });
  169.  
  170.             builder.AddProduct("tonystars", ProductType.NonConsumable, new IDs
  171.                 {
  172.                     {"tonystars", GooglePlay.Name},
  173.                     {"tonystars", AppleAppStore.Name},
  174.                     {"tonystars", WinRT.Name}
  175.                 });
  176.  
  177.             builder.AddProduct("wondergirl", ProductType.NonConsumable, new IDs
  178.                 {
  179.                     {"wondergirl", GooglePlay.Name},
  180.                     {"wondergirl", AppleAppStore.Name},
  181.                     {"wondergirl", WinRT.Name}
  182.                 });
  183.  
  184.             builder.AddProduct("bb8", ProductType.NonConsumable, new IDs
  185.                 {
  186.                     {"bb8", GooglePlay.Name},
  187.                     {"bb8", AppleAppStore.Name},
  188.                     {"bb8", WinRT.Name}
  189.                 });
  190.  
  191.             builder.AddProduct("ren", ProductType.NonConsumable, new IDs
  192.                 {
  193.                     {"ren", GooglePlay.Name},
  194.                     {"ren", AppleAppStore.Name},
  195.                     {"ren", WinRT.Name}
  196.                 });
  197.            
  198.             builder.AddProduct("finn", ProductType.NonConsumable, new IDs
  199.                 {
  200.                     {"finn", GooglePlay.Name},
  201.                     {"finn", AppleAppStore.Name},
  202.                     {"finn", WinRT.Name}
  203.                 });
  204.  
  205.             builder.AddProduct("poedaemon", ProductType.NonConsumable, new IDs
  206.                 {
  207.                     {"poe", GooglePlay.Name},
  208.                     {"poe", AppleAppStore.Name},
  209.                     {"poe", WinRT.Name}
  210.                 });
  211.  
  212.             builder.AddProduct("trooper", ProductType.NonConsumable, new IDs
  213.                 {
  214.                     {"trooper", GooglePlay.Name},
  215.                     {"trooper", AppleAppStore.Name},
  216.                     {"trooper", WinRT.Name}
  217.                 });
  218.  
  219.             builder.AddProduct("phasma", ProductType.NonConsumable, new IDs
  220.                 {
  221.                     {"phasma", GooglePlay.Name},
  222.                     {"phasma", AppleAppStore.Name},
  223.                     {"phasma", WinRT.Name}
  224.                 });
  225.  
  226.             builder.AddProduct("captrooper", ProductType.NonConsumable, new IDs
  227.                 {
  228.                     {"captrooper", GooglePlay.Name},
  229.                     {"captrooper", AppleAppStore.Name},
  230.                     {"captrooper", WinRT.Name}
  231.                 });
  232.  
  233.             builder.AddProduct("50kgemas", ProductType.Consumable, new IDs
  234.                 {
  235.                     {"cincuentakgemasn", GooglePlay.Name},
  236.                     {"cincuentakgemasnn", AppleAppStore.Name},
  237.                     {"cincuentakgemasn", WinRT.Name}
  238.                 });
  239.  
  240.                    
  241.  
  242.             UnityPurchasing.Initialize(this, builder);
  243.  
  244.         }
  245.  
  246.  
  247.         private bool IsInitialized()
  248.         {
  249.             // Only say we are initialized if both the Purchasing references are set.
  250.             return m_StoreController != null && m_StoreExtensionProvider != null;
  251.         }
  252.  
  253.  
  254.         public void BuyNonConsumable(string mypj)
  255.         {
  256.  
  257.             compras = true;
  258.             BuyProductID(mypj);
  259.             StartCoroutine (StopAviso ());
  260.  
  261.         }
  262.  
  263.         public void BuyConsumable()
  264.         {
  265.             compras = true;
  266.             BuyProductID("50kGemas");
  267.             StartCoroutine (StopAviso ());
  268.         }
  269.  
  270.         void BuyProductID(string productId)
  271.         {
  272.             print (productId);
  273.             if (compras) {
  274.                 Aviso.SetActive (true);
  275.                 AvisTr.SetActive (true);
  276.            
  277.             }
  278.             // If the stores throw an unexpected exception, use try..catch to protect my logic here.
  279.             try
  280.             {
  281.                 // If Purchasing has been initialized ...
  282.                 if (IsInitialized())
  283.                 {
  284.                     // ... look up the Product reference with the general product identifier and the Purchasing system's products collection.
  285.                     Product product = m_StoreController.products.WithID(productId);
  286.  
  287.  
  288.                     // If the look up found a product for this device's store and that product is ready to be sold ...
  289.                     if (product != null && product.availableToPurchase)
  290.                     {
  291.                         if(compras){
  292.                         avistrtx.text = "Purchasing extra Pack!!";
  293.                         avisotx.text = "Purchasing hero " + product.definition.id;
  294.                         }
  295.                         Debug.Log (string.Format("Purchasing product asychronously: '{0}'", product.definition.id));// ... buy the product. Expect a response either through ProcessPurchase or OnPurchaseFailed asynchronously.
  296.                         m_StoreController.InitiatePurchase(product);
  297.  
  298.                     }
  299.                     // Otherwise ...
  300.                     else
  301.                     {
  302.                         if(compras){
  303.                             avistrtx.text = "Purchasing FAIL!!";
  304.                             avisotx.text = "Purchasing FAIL!!";
  305.                         }
  306.                         // ... report the product look-up failure situation  
  307.                         Debug.Log ("BuyProductID: FAIL. Not purchasing product, either is not found or is not available for purchase");
  308.                     }
  309.                 }
  310.                 // Otherwise ...
  311.                 else
  312.                 {
  313.                     if(compras){
  314.                         avistrtx.text = "Purchasing FAIL!!";
  315.                         avisotx.text = "Purchasing FAIL!!";
  316.                     }
  317.                     // ... report the fact Purchasing has not succeeded initializing yet. Consider waiting longer or retrying initiailization.
  318.                     Debug.Log("BuyProductID FAIL. Not initialized.");
  319.                 }
  320.             }
  321.             // Complete the unexpected exception handling ...
  322.             catch (Exception e)
  323.             {
  324.                 // ... by reporting any unexpected exception for later diagnosis.
  325.                 Debug.Log ("BuyProductID: FAIL. Exception during purchase. " + e);
  326.             }
  327.         }
  328.  
  329.  
  330.         // Restore purchases previously made by this customer. Some platforms automatically restore purchases. Apple currently requires explicit purchase restoration for IAP.
  331.         public void RestorePurchases()
  332.         {
  333.             AviSt.SetActive (true);
  334.             // If Purchasing has not yet been set up ...
  335.             if (!IsInitialized())
  336.             {
  337.                 // ... report the situation and stop restoring. Consider either waiting longer, or retrying initialization.
  338.                 Debug.Log("RestorePurchases FAIL. Not initialized.");
  339.                 return;
  340.             }
  341.  
  342.             // If we are running on an Apple device ...
  343.             if (Application.platform == RuntimePlatform.IPhonePlayer ||
  344.                 Application.platform == RuntimePlatform.OSXPlayer)
  345.             {
  346.                 // ... begin restoring purchases
  347.                 Debug.Log("RestorePurchases started ...");
  348.  
  349.  
  350.                 // Fetch the Apple store-specific subsystem.
  351.                 var apple = m_StoreExtensionProvider.GetExtension<IAppleExtensions>();
  352.                 Avistx.text = "RestorePurchases started ...";
  353.                 // Begin the asynchronous process of restoring purchases. Expect a confirmation response in the Action<bool> below, and ProcessPurchase if there are previously purchased products to restore.
  354.                 apple.RestoreTransactions((result) => {
  355.                     // The first phase of restoration. If no more responses are received on ProcessPurchase then no purchases are available to be restored.
  356.                     Debug.Log("RestorePurchases continuing: " + result + ". If no further messages, no purchases available to restore.");
  357.                     Avistx.text = "Restore continuing: " + result + "If no further messages, no purchases availables!";
  358.                 });
  359.             }
  360.             // Otherwise ...
  361.             else
  362.             {
  363.                 // We are not running on an Apple device. No work is necessary to restore purchases.
  364.                 Debug.Log("RestorePurchases FAIL. Not supported on this platform. Current = " + Application.platform);
  365.                 Avistx.text = "RestorePurchases FAIL. Not supported on this platform. Current = " + Application.platform;
  366.             }
  367.  
  368.         }
  369.  
  370.  
  371.         //  
  372.         // --- IStoreListener
  373.         //
  374.  
  375.         public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
  376.         {
  377.             // Purchasing has succeeded initializing. Collect our Purchasing references.
  378.             Debug.Log("OnInitialized: PASS");
  379.  
  380.             // Overall Purchasing system, configured with products for this application.
  381.             m_StoreController = controller;
  382.             // Store specific subsystem, for accessing device-specific store features.
  383.             m_StoreExtensionProvider = extensions;
  384.         }
  385.  
  386.  
  387.         public void OnInitializeFailed(InitializationFailureReason error)
  388.         {
  389.             // Purchasing set-up has not succeeded. Check error for reason. Consider sharing this reason with the user.
  390.             Debug.Log("OnInitializeFailed InitializationFailureReason:" + error);
  391.         }
  392.  
  393.  
  394.         public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
  395.         {
  396.  
  397.  
  398.             Debug.Log("Purchase OK: " + args.purchasedProduct.definition.id);
  399.  
  400.             Debug.Log("Receipt: " + args.purchasedProduct.receipt);
  401.  
  402.             if (args.purchasedProduct.definition.id == "50kGemas") {
  403.                
  404.                 MasterCore.misDiam += 50000;
  405.                 PlayerPrefs.SetInt ("Piedras", MasterCore.misDiam);
  406.                 PlayerPrefs.SetInt ("Pack", 1);
  407.                 miTraga.UpdaGema (MasterCore.misDiam);
  408.                 SceneManager.LoadScene ("Play");
  409.  
  410.  
  411.             } else {
  412.                 switch (args.purchasedProduct.definition.id) {
  413.  
  414.                 case "ren":
  415.                     PlayerPrefs.SetInt ("Ren", 1);
  416.                     compra++;
  417.                     PlayerPrefs.SetInt ("Comprados", compra);
  418.                     break;
  419.  
  420.                 case "soldieramerica":
  421.                     PlayerPrefs.SetInt ("SoldierAmerica", 1);
  422.                     compra++;
  423.                     PlayerPrefs.SetInt ("Comprados", compra);
  424.                     break;
  425.  
  426.                 case "endermen":
  427.                     PlayerPrefs.SetInt ("EnderMen", 1);
  428.                     compra++;
  429.                     PlayerPrefs.SetInt ("Comprados", compra);
  430.                     break;
  431.  
  432.                 case "creepers":
  433.                     PlayerPrefs.SetInt ("Creepers", 1);
  434.                     compra++;
  435.                     PlayerPrefs.SetInt ("Comprados", compra);
  436.                     break;
  437.  
  438.                 case "darckknight":
  439.                     PlayerPrefs.SetInt ("Darck Knight", 1);
  440.                     compra++;
  441.                     PlayerPrefs.SetInt ("Comprados", compra);
  442.                     break;
  443.  
  444.                 case "b2d2":
  445.                     PlayerPrefs.SetInt ("B2D2", 1);
  446.                     compra++;
  447.                     PlayerPrefs.SetInt ("Comprados", compra);
  448.                     break;
  449.  
  450.                 case "tonystars":
  451.                     PlayerPrefs.SetInt ("Tony Stars", 1);
  452.                     compra++;
  453.                     PlayerPrefs.SetInt ("Comprados", compra);
  454.                     break;
  455.  
  456.                 case "marcos":
  457.                     PlayerPrefs.SetInt ("Marcos", 1);
  458.                     compra++;
  459.                     PlayerPrefs.SetInt ("Comprados", compra);
  460.                     break;
  461.  
  462.                 case "drbanner":
  463.                     PlayerPrefs.SetInt ("DrBanner", 1);
  464.                     compra++;
  465.                     PlayerPrefs.SetInt ("Comprados", compra);
  466.                     break;
  467.  
  468.                 case "jedi":
  469.                     PlayerPrefs.SetInt ("Jedi", 1);
  470.                     compra++;
  471.                     PlayerPrefs.SetInt ("Comprados", compra);
  472.                     break;
  473.  
  474.                 case "hannsolo":
  475.                     PlayerPrefs.SetInt ("Hann Solo", 1);
  476.                     compra++;
  477.                     PlayerPrefs.SetInt ("Comprados", compra);
  478.                     break;
  479.  
  480.                 case "luis":
  481.                     PlayerPrefs.SetInt ("luis", 1);
  482.                     compra++;
  483.                     PlayerPrefs.SetInt ("Comprados", compra);
  484.                     break;
  485.  
  486.                 case "manofsteel":
  487.                     PlayerPrefs.SetInt ("Man Of Steel", 1);
  488.                     compra++;
  489.                     PlayerPrefs.SetInt ("Comprados", compra);
  490.                     break;
  491.  
  492.                 case "kylorem":
  493.                     PlayerPrefs.SetInt ("Kylo Rem", 1);
  494.                     compra++;
  495.                     PlayerPrefs.SetInt ("Comprados", compra);
  496.                     break;
  497.  
  498.                 case "wondergirl":
  499.                     PlayerPrefs.SetInt ("Wonder Girl", 1);
  500.                     compra++;
  501.                     PlayerPrefs.SetInt ("Comprados", compra);
  502.                     break;
  503.  
  504.                 case "dogi":
  505.                     PlayerPrefs.SetInt ("Dogi", 1);
  506.                     compra++;
  507.                     PlayerPrefs.SetInt ("Comprados", compra);
  508.                     break;
  509.  
  510.                 case "bb8":
  511.                     PlayerPrefs.SetInt ("BB8", 1);
  512.                     compra++;
  513.                     PlayerPrefs.SetInt ("Comprados", compra);
  514.                     break;
  515.  
  516.                 case "captrooper":
  517.                     PlayerPrefs.SetInt ("Cap Trooper", 1);
  518.                     compra++;
  519.                     PlayerPrefs.SetInt ("Comprados", compra);
  520.                     break;
  521.  
  522.                 case "finn":
  523.                     PlayerPrefs.SetInt ("Finn", 1);
  524.                     compra++;
  525.                     PlayerPrefs.SetInt ("Comprados", compra);
  526.                     break;
  527.  
  528.                 case "phasma":
  529.                     PlayerPrefs.SetInt ("Phasma", 1);
  530.                     compra++;
  531.                     PlayerPrefs.SetInt ("Comprados", compra);
  532.                     break;
  533.  
  534.                 case "poe":
  535.                     PlayerPrefs.SetInt ("Poe Daemon", 1);
  536.                     compra++;
  537.                     PlayerPrefs.SetInt ("Comprados", compra);
  538.                     break;
  539.  
  540.                 case "trooper":
  541.                     PlayerPrefs.SetInt ("TRooper", 1);
  542.                     compra++;
  543.                     PlayerPrefs.SetInt ("Comprados", compra);
  544.                     break;
  545.  
  546.                 }
  547.                    
  548.             }
  549.  
  550.             return PurchaseProcessingResult.Complete;
  551.         }
  552.  
  553.         /*
  554.         public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
  555.         {
  556.             // A consumable product has been purchased by this user.
  557.             if (String.Equals(args.purchasedProduct.definition.id, kProductIDConsumable, StringComparison.Ordinal))
  558.             {
  559.                 Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));//If the consumable item has been successfully purchased, add 100 coins to the player's in-game score.
  560.                 //              ScoreManager.score += 100;
  561.             }
  562.  
  563.             // Or ... a non-consumable product has been purchased by this user.
  564.             else if (String.Equals(args.purchasedProduct.definition.id, kProductIDNonConsumable, StringComparison.Ordinal))
  565.             {
  566.                 Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
  567.                 Skin boughtSkin = SkinManager.instance.skins.Find(sk=>sk.sku.Equals(args.purchasedProduct.definition.id));
  568.                 boughtSkin.unlocked = true;
  569.                 ShopDataManager.instance.SaveItems();
  570.  
  571.                 FarmController.instance.OnSkinBought();
  572.  
  573.                 //ANALYTICS
  574.                 Analytics.Transaction(args.purchasedProduct.definition.id,args.purchasedProduct.metadata.localizedPrice,args.purchasedProduct.metadata.isoCurrencyCode,args.purchasedProduct.receipt,null);
  575.  
  576.  
  577.                 if(boughtSkin.skinType == SkinManager.SkinType.Special){
  578.                     FinishController.instance.buySkinWidget.CloseWidget();
  579.  
  580.                     //ANALYTICS
  581.                     OneSignal.SendTag("SpecialSkinBought",boughtSkin.skinName);
  582.                     OneSignal.SendPurchase((double)args.purchasedProduct.metadata.localizedPrice);
  583.                 }
  584.  
  585.                 AudioManager.instance.PlayClip("iap");
  586.  
  587.  
  588.             }// Or ... a subscription product has been purchased by this user.
  589.             else if (String.Equals(args.purchasedProduct.definition.id, kProductIDSubscription, StringComparison.Ordinal))
  590.             {
  591.                 Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));}// Or ... an unknown product has been purchased by this user. Fill in additional products here.
  592.             else
  593.             {
  594.                 Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));}// Return a flag indicating wither this product has completely been received, or if the application needs to be reminded of this purchase at next app launch. Is useful when saving purchased products to the cloud, and when that save is delayed.
  595.             return PurchaseProcessingResult.Complete;
  596.         }*/
  597.  
  598.         IEnumerator StopAviso(){
  599.  
  600.             yield return new WaitForSeconds (4.0f);
  601.             AviSt.SetActive (false);
  602.             if (compras) {
  603.                 Aviso.SetActive (false);
  604.                 AvisTr.SetActive (false);
  605.             }
  606.         }
  607.  
  608.  
  609.         public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason)
  610.         {
  611.             // A product purchase attempt did not succeed. Check failureReason for more detail. Consider sharing this reason with the user.
  612.             Debug.Log(string.Format("OnPurchaseFailed: FAIL. Product: '{0}', PurchaseFailureReason: {1}",product.definition.storeSpecificId, failureReason));}
  613.     }
  614. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement