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); }
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); }
//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); }
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); }
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); }