void queryInventorySucceededEvent(List <GooglePurchase> purchases, List <GoogleSkuInfo> skus)
    {
        Dictionary <string, PurchaseData> inventory = new Dictionary <string, PurchaseData>();

        Prime31.Utils.logObject(purchases);
        Prime31.Utils.logObject(skus);

        ShopEvents.purchasedProductIds = new ArrayList();

        for (int i = 0; i < purchases.Count; i++)
        {
            GooglePurchase purchase = purchases[i];
            ShopEvents.purchasedProductIds.Add(purchase.productId);
        }

        for (int i = 0; i < skus.Count; i++)
        {
            GoogleSkuInfo sku          = skus[i];
            PurchaseData  purchaseData = new PurchaseData();
            string        productId    = sku.productId;
            string        id           = GetIdFromProductId(productId);

            purchaseData.id          = id;
            purchaseData.name        = sku.title;
            purchaseData.description = sku.description;
            purchaseData.price       = sku.price;
            purchaseData.productId   = productId;
            inventory.Add(id, purchaseData);
        }
        ShopEvents.QueryInventorySucceeded(inventory);
    }
Exemple #2
0
    void Start()
    {
        coinPack1 = Instantiate(purchaseItemPrefab) as PurchaseItem;
        coinPack1.purchaseItemName.text         = "7 500";
        coinPack1.singleTransform.parent        = singleTransform;
        coinPack1.singleTransform.localPosition = new Vector3(0f, 1f, 0f);

        coinPack2 = Instantiate(purchaseItemPrefab) as PurchaseItem;
        coinPack2.purchaseItemName.text         = "30 000";
        coinPack2.singleTransform.parent        = singleTransform;
        coinPack2.singleTransform.localPosition = new Vector3(0f, 0.5f, 0f);

        coinPack3 = Instantiate(purchaseItemPrefab) as PurchaseItem;
        coinPack3.purchaseItemName.text         = "150 000";
        coinPack3.singleTransform.parent        = singleTransform;
        coinPack3.singleTransform.localPosition = new Vector3(0f, 0f, 0f);

        coinPack4 = Instantiate(purchaseItemPrefab) as PurchaseItem;
        coinPack4.purchaseItemName.text         = "300 000";
        coinPack4.singleTransform.parent        = singleTransform;
        coinPack4.singleTransform.localPosition = new Vector3(0f, -0.5f, 0f);

        coinPack5 = Instantiate(purchaseItemPrefab) as PurchaseItem;
        coinPack5.purchaseItemName.text         = "500 000";
        coinPack5.singleTransform.parent        = singleTransform;
        coinPack5.singleTransform.localPosition = new Vector3(0f, -1f, 0f);

        ShopEvents.AddListener(this);
        if (ShopEvents.inventory != null)
        {
            InventoryDataRecieved();
        }
    }
    void purchaseSucceededEvent(GooglePurchase purchase)
    {
        ShopEvents.purchasedProductIds.Add(purchase.productId);
        string id = GetIdFromProductId(purchase.productId);

        ShopEvents.PurchaseSucceeded(id);
        Debug.Log("purchaseSucceededEvent: " + purchase);
    }
Exemple #4
0
 void OnDestroy()
 {
     ShopEvents.RemoveListener(this);
 }
Exemple #5
0
 public void Purchase()
 {
     ShopEvents.Purchase(purchaseData);
 }
Exemple #6
0
 void OnEnable()
 {
     ShopEvents.inap = this;
     ShopEvents.InitPurchase();
 }
 void billingNotSupportedEvent(string error)
 {
     ShopEvents.InapNotSupported(error);
 }
 void billingSupportedEvent()
 {
     ShopEvents.InapSupported();
 }
 void consumePurchaseFailedEvent(string error)
 {
     ShopEvents.ConsumePurchaseFailed(error);
     Debug.Log("consumePurchaseFailedEvent: " + error);
 }
 void consumePurchaseSucceededEvent(GooglePurchase purchase)
 {
     ShopEvents.purchasedProductIds.Remove(purchase.productId);
     ShopEvents.ConsumePurchaseSucceeded(purchase.productId);
     Debug.Log("consumePurchaseSucceededEvent: " + purchase);
 }
 void purchaseFailedEvent(string error)
 {
     Debug.Log("purchaseFailedEvent: " + error);
     ShopEvents.PurchaseFailed(error);
 }
 void queryInventoryFailedEvent(string error)
 {
     ShopEvents.QueryInventoryFailed(error);
 }