Esempio n. 1
0
 public ShopData(IAPManager.IAPProduct product, int tier, int price, int number)
 {
     this.product = product;
     this.tier    = tier;
     this.price   = price;
     this.number  = number;
 }
Esempio n. 2
0
 void RemovePurchasingItem(string productId)
 {
     if (purchasingList.Contains(productId))
     {
         purchasingList.Remove(productId);
         IAPManager.IAPProduct product = IAPManager.GetInstance().IDProductMap[productId];
         ChangeItemDisplayState(product, false);
     }
 }
Esempio n. 3
0
 void AddPurchasingItem(string productId)
 {
     if (purchasingList.Contains(productId) == false)
     {
         purchasingList.Add(productId);
         IAPManager.IAPProduct product = IAPManager.GetInstance().IDProductMap[productId];
         ChangeItemDisplayState(product, true);
     }
 }
Esempio n. 4
0
 void InitializePurchsingList(string purchasingData)
 {
     string[] dataStrings = purchasingData.Split(new char[] { ',' });
     foreach (string data in dataStrings)
     {
         purchasingList.Add(data);
         IAPManager.IAPProduct product = IAPManager.GetInstance().IDProductMap[data];
         ChangeItemDisplayState(product, true);
     }
 }
Esempio n. 5
0
 public static ShopData GetShopData(IAPManager.IAPProduct product)
 {
     foreach (ShopData shopData in gameShopData)
     {
         if (shopData.product == product)
         {
             return(shopData);
         }
     }
     return(null);
 }
Esempio n. 6
0
 public void ChangeItemDisplayState(IAPManager.IAPProduct product, bool isPurchasing)
 {
     foreach (ShopItem shopItem in shopItems)
     {
         if (shopItem.Data.product == product)
         {
             shopItem.ChangeDisplayState(isPurchasing);
             break;
         }
     }
 }
Esempio n. 7
0
    bool CheckIsPurchasing(IAPManager.IAPProduct product)
    {
        string productId = IAPManager.GetInstance().productIDMap[product];

        foreach (string existId in purchasingList)
        {
            if (existId.Equals(productId))
            {
                return(true);
            }
        }
        return(false);
    }
Esempio n. 8
0
    void RequestProductsFinished(string shopDataString)
    {
        ArrayList shopDataList = KTPlaySDKJson.KTJSON.jsonDecode(shopDataString) as ArrayList;

        foreach (Hashtable hashtable in shopDataList)
        {
            if (hashtable.Contains("price"))
            {
                string productId = hashtable["id"].ToString();
                int    price     = Convert.ToInt32(hashtable["price"]);
                IAPManager.IAPProduct product = IAPManager.GetInstance().IDProductMap[productId];
                foreach (ShopData shopData in ShopData.gameShopData)
                {
                    if (shopData.product == product)
                    {
                        shopData.price = price;
                        break;
                    }
                }
            }
        }
        RefreshShopData();
    }