예제 #1
0
    public IapManager.BundleItem[] GetProductRewardsAsBundleItems(IapManager.InAppPurchaseItemType itemType)
    {
        Hashtable productRewards                = this.GetProductRewards(itemType);
        List <IapManager.BundleItem> list       = new List <IapManager.BundleItem>();
        IDictionaryEnumerator        enumerator = productRewards.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                object          obj             = enumerator.Current;
                DictionaryEntry dictionaryEntry = (DictionaryEntry)obj;
                if (Enum.IsDefined(typeof(IapManager.BundleItem.BundleItemType), (string)dictionaryEntry.Key))
                {
                    IapManager.BundleItem.BundleItemType type = (IapManager.BundleItem.BundleItemType)Enum.Parse(typeof(IapManager.BundleItem.BundleItemType), (string)dictionaryEntry.Key);
                    int count = int.Parse((string)dictionaryEntry.Value);
                    list.Add(new IapManager.BundleItem(type, count));
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
        return(list.ToArray());
    }
예제 #2
0
    private float GetPrice(IapManager.InAppPurchaseItemType item)
    {
        if (!Singleton <IapManager> .IsInstantiated() || !Singleton <IapManager> .Instance.ReadyForTransaction)
        {
            return(0f);
        }
        string prodId = Singleton <IapManager> .Instance.GetProductIdByItem(item);

        if (!string.IsNullOrEmpty(prodId))
        {
            IAPProductInfo iapproductInfo = null;
            foreach (IAPProductInfo x in Singleton <IapManager> .Instance.ProductList)
            {
                if (x.productId == prodId)
                {
                    iapproductInfo = x;
                    break;
                }
            }
            if (iapproductInfo == null)
            {
                return(0f);
            }
            string s = (!string.IsNullOrEmpty(iapproductInfo.unformattedPrice)) ? iapproductInfo.unformattedPrice : iapproductInfo.formattedPrice;
            try
            {
                return(float.Parse(s));
            }
            catch
            {
                return(0f);
            }
        }
        return(0f);
    }
예제 #3
0
 private void OnItemPurchase(IapManager.InAppPurchaseItemType type)
 {
     if (type == IapManager.InAppPurchaseItemType.WoodenLootCrate || type == IapManager.InAppPurchaseItemType.MetalLootCrate || type == IapManager.InAppPurchaseItemType.GoldenLootCrate)
     {
         this.partListingButton.UpdateNewTagState();
     }
 }
예제 #4
0
 private void UpdateInidicator(IapManager.InAppPurchaseItemType type)
 {
     if (Singleton <IapManager> .IsInstantiated())
     {
         base.GetComponent <Renderer>().enabled = Singleton <IapManager> .Instance.IsItemPurchased(this.m_purchaseItem);
     }
 }
예제 #5
0
 private void OnPurchaseSucceeded(IapManager.InAppPurchaseItemType type)
 {
     if (!string.IsNullOrEmpty(this.currentSaleKey) && type == this.saleItem)
     {
         GameProgress.SetBool(this.currentSaleKey + "_used", true, GameProgress.Location.Local);
     }
 }
예제 #6
0
 private void OnPurchase(IapManager.InAppPurchaseItemType type)
 {
     base.UpdateAmount(false);
     if (!Singleton <IapManager> .Instance.SnoutCoinPurchasable(type))
     {
         this.PlayPurchaseSound();
     }
 }
예제 #7
0
    public int GetProductRewardCount(IapManager.InAppPurchaseItemType itemType)
    {
        Hashtable productRewards = this.GetProductRewards(itemType);

        if (productRewards == null)
        {
            return(0);
        }
        return(productRewards.Count);
    }
예제 #8
0
 private void OnItemPurchase(IapManager.InAppPurchaseItemType type)
 {
     switch (type)
     {
     case IapManager.InAppPurchaseItemType.WoodenLootCrate:
     case IapManager.InAppPurchaseItemType.MetalLootCrate:
     case IapManager.InAppPurchaseItemType.GoldenLootCrate:
     case IapManager.InAppPurchaseItemType.WoodenLootCrateSale:
     case IapManager.InAppPurchaseItemType.MetalLootCrateSale:
     case IapManager.InAppPurchaseItemType.GoldenLootCrateSale:
         this.ButtonAwake();
         break;
     }
 }
예제 #9
0
    public string GetProductLocalizationKey(IapManager.InAppPurchaseItemType itemType)
    {
        string text = Singleton <IapManager> .Instance.GetProductIdByItem(itemType);

        if (string.IsNullOrEmpty(text))
        {
            return(string.Empty);
        }
        text = text.Substring(text.LastIndexOf(".") + 1);
        if (this.virtualCatalogDictionary != null && this.virtualCatalogDictionary.ContainsKey(text))
        {
            return(this.virtualCatalogDictionary[text].localizationKey);
        }
        return(string.Empty);
    }
예제 #10
0
    public int GetProductPrice(IapManager.InAppPurchaseItemType itemType)
    {
        string productIdByItem = Singleton <IapManager> .Instance.GetProductIdByItem(itemType);

        if (string.IsNullOrEmpty(productIdByItem))
        {
            return(-1);
        }
        string key = productIdByItem.Substring(productIdByItem.LastIndexOf(".") + 1);

        if (this.virtualCatalogDictionary != null && this.virtualCatalogDictionary.ContainsKey(key))
        {
            return(this.virtualCatalogDictionary[key].price);
        }
        return(-1);
    }
예제 #11
0
    private float CalculatePercentage()
    {
        this.purchaseInfo.CheckOnSale();
        IapManager.InAppPurchaseItemType inAppPurchaseItemType = (!this.purchaseInfo.isSaleItem) ? this.purchaseInfo.purchaseItem : this.purchaseInfo.saleItem;
        float num = (float)Singleton <IapManager> .Instance.GetPurchaseItemTypeCount(inAppPurchaseItemType);

        float num2 = (float)Singleton <IapManager> .Instance.GetPurchaseItemTypeCount(this.compareType);

        float price  = this.GetPrice(inAppPurchaseItemType);
        float price2 = this.GetPrice(this.compareType);

        if (num == 0f || num2 == 0f || price == 0f || price2 == 0f)
        {
            return(0f);
        }
        return(num / price / (num2 / price2) - 1f);
    }
예제 #12
0
    private void OnPurchase(IapManager.InAppPurchaseItemType item)
    {
        for (int i = 0; i < this.items.Length; i++)
        {
            if (this.items[i] == item)
            {
                this.particles.transform.position = base.transform.position;
                this.particles.Play();
                Singleton <AudioManager> .Instance.Play2dEffect(WPFMonoBehaviour.gameData.commonAudioCollection.snoutCoinPurchase);

                if (this.buildMenu != null)
                {
                    this.buildMenu.RefreshPowerUpCounts();
                }
                break;
            }
        }
    }
예제 #13
0
 private void HandleIapManageronPurchaseSucceeded(IapManager.InAppPurchaseItemType type)
 {
     this.autoBuildButton.transform.Find("AmountText").GetComponent <TextMesh>().text = GameProgress.BluePrintCount().ToString();
 }
예제 #14
0
 private void HandleIapManageronPurchaseFailed(IapManager.InAppPurchaseItemType type)
 {
     this.m_loader.SetActive(false);
 }
예제 #15
0
 private void HandleIapManageronPurchaseSucceeded(IapManager.InAppPurchaseItemType type)
 {
     this.SetVisible(false);
 }
예제 #16
0
 private void Purchase(IapManager.InAppPurchaseItemType type)
 {
     this.m_loader.SetActive(true);
     Singleton <IapManager> .Instance.PurchaseItem(type);
 }
예제 #17
0
 private void UnlockScreen(IapManager.InAppPurchaseItemType type = IapManager.InAppPurchaseItemType.Undefined)
 {
     this.m_LockOverlay.SetActive(false);
     Singleton <GuiManager> .Instance.IsEnabled = true;
 }
예제 #18
0
 private void HandleIapManageronPurchaseSucceeded(IapManager.InAppPurchaseItemType type)
 {
     this.ShowUnlocked();
 }
예제 #19
0
 private void HandleIapManagerOnPurchaseSucceeded(IapManager.InAppPurchaseItemType type)
 {
 }