Exemplo n.º 1
0
        private void StoreLoadedCompletion()
        {
            for (int i = 0; i < spawnedStoreItems.Count; i++)
            {
                StoreItemScript spawnedStoreItem = spawnedStoreItems[i];
                Destroy(spawnedStoreItem.gameObject);
            }
            storeBonusScript.gameObject.SetActive(false);
            spawnedStoreItems = new List <StoreItemScript>();

            for (int i = 0; i < storeSettings.StoreProducts.Length; i++)
            {
                if (!ShouldShowItem(storeSettings.StoreProducts[i]))
                {
                    continue;
                }
                StoreProductSettings settings = storeSettings.StoreProducts[i];
                if (settings.IsMostPopular)
                {
                    storeBonusScript.SetUpValues(settings, purchaser);
                    storeBonusScript.gameObject.SetActive(true);
                    continue;
                }
                StoreItemScript spawnedStoreItem = Instantiate(storeObject, storeProductsRoot);
                spawnedStoreItems.Add(spawnedStoreItem);
                spawnedStoreItem.SetUpValues(storeSettings.StoreProducts[i], purchaser);
            }
            StartCoroutine(RemoveLoadingWithDelay());
        }
        public void SetUpValues(StoreProductSettings productSettings, Purchaser purchaser)
        {
            this.settings = productSettings;

            priceLabel.text = purchaser.GetItemPrice(productSettings.ProductId);

            productName.text    = settings.LocalisableItemNameKey; // TODO: = LocalisationSystem.GetKey (settings.LocalisableItemNameKey)
            productImage.sprite = settings.ProductImage;
            mostPopularBanner.gameObject.SetActive(settings.IsMostPopular);
            removesAdsText.SetActive(settings.RemovesAds);
            removesAdsBackground.SetActive(settings.RemovesAds);
        }
Exemplo n.º 3
0
 private bool PurchaseIsMostPopular(string productId)
 {
     for (int i = 0; i < storeSettings.StoreProducts.Length; i++)
     {
         StoreProductSettings setting = storeSettings.StoreProducts[i];
         if (setting.ProductId.Equals(productId))
         {
             return(setting.IsMostPopular);
         }
     }
     return(false);
 }
Exemplo n.º 4
0
        //private StoreItemScript ItemForID(string purchaseId)
        //{
        //    for (int i = 0; i < spawnedStoreItems.Count; i++)
        //    {
        //        StoreItemScript script = spawnedStoreItems[i];
        //        if (script.purchaseId.Equals(purchaseId))
        //        {
        //            return script;
        //        }
        //    }
        //    return null;
        //}

        private bool PurchaseRemovesAds(string productId)
        {
            for (int i = 0; i < storeSettings.StoreProducts.Length; i++)
            {
                StoreProductSettings setting = storeSettings.StoreProducts[i];
                if (setting.ProductId.Equals(productId))
                {
                    return(setting.RemovesAds);
                }
            }
            return(false);
        }
Exemplo n.º 5
0
 public int CoinsForProduct(string productId)
 {
     for (int i = 0; i < storeSettings.StoreProducts.Length; i++)
     {
         StoreProductSettings setting = storeSettings.StoreProducts[i];
         if (setting.ProductId.Equals(productId))
         {
             return(setting.CoinAmount);
         }
     }
     return(0);
 }
Exemplo n.º 6
0
        private bool ShouldShowItem(StoreProductSettings item)
        {
            Player player = SceneActivationBehaviour <GameLogicActivator> .Instance.GameController.Player;

            if (item.IsMostPopular && player.IsBonusPurchased(item.ProductId))
            {
                DebugLog($"HIDE ITEM: {item.ProductId}");
                return(false);
            }
            DebugLog($"SHOW ITEM: {item.ProductId}");
            return(true);
        }