Ejemplo n.º 1
0
    private IEnumerator DoubleRewardsEOFRoutine()
    {
        yield return(Wait.ForEndOfFrame());

        for (int i = 0; i != elements.Count; i++)
        {
            if (shopItems[i].type == ShopMenu.ShopItemType.Coin)
            {
                AnimatedCurrencyController.AnimateCoins(shopItems[i].count / 2, MenuController.UICamera.WorldToViewportPoint(elements[i].transform.position), MenuController.TotalCoinsPositionViewport, 5, null, delegate(int ts)
                {
                    MenuController.instance.topTotalCoinsText.Tick(ts);
                });
            }
            else if (shopItems[i].type == ShopMenu.ShopItemType.Gem)
            {
                AnimatedCurrencyController.AnimateGems(shopItems[i].count / 2, MenuController.UICamera.WorldToViewportPoint(elements[i].transform.position), MenuController.TotalGemsPositionViewport, 1, null, delegate(int ts)
                {
                    MenuController.instance.topTotalGemsText.Tick(ts);
                });
            }
        }
        offerPressed        = false;
        doubleRewardingDone = true;
        MenuController.backButtonOverrideAction = null;
    }
Ejemplo n.º 2
0
 public void GetFreeGems()
 {
     LeanTween.delayedCall(1.2f, (Action) delegate
     {
         ShopMenu shopMenu = this;
         AnimatedCurrencyController.AnimateGems((int)1, MenuController.UICamera.WorldToViewportPoint(shopMenu.gemIAPItems[1].transform.position), MenuController.TotalGemsPositionViewport, 1, null, delegate(int tc)
         {
         });
         AudioMap.PlayClipAt(AudioMap.instance["gemCollect"], Vector3.zero, AudioMap.instance.uiMixerGroup);
         MenuController.UpdateTopMenu();
         Debug.Log(PlayerDataManager.GetGems());
     });
 }
Ejemplo n.º 3
0
    private IEnumerator RewardAnimationRoutine()
    {
        int dailyBonusIndex = PlayerDataManager.GetDailyBonusIndex();

        AnimatedCurrencyController.AnimateGems(Variables.instance.dailyBonusAmounts[dailyBonusIndex], MenuController.UICamera.WorldToViewportPoint(rewardDays[dailyBonusIndex].transform.position), MenuController.TotalGemsPositionViewport, 1, null, delegate(int tc)
        {
            //*MenuController.instance.topTotalGemsText.Tick(tc);
        });
        yield return(StartCoroutine(CheckMarkAnimation(dailyBonusIndex)));

        yield return(new WaitForSeconds(1f));

        MenuController.HideMenu <RewardCalendarPopup>();
    }
Ejemplo n.º 4
0
    private IEnumerator InitIAP()
    {
        while (!iapItem.IsInitialized)
        {
            yield return(null);
        }
        gemAmountText.GetComponent <LocalizationParamsManager>().SetParameterValue("AMOUNT", iapItem.product.definition.payout.quantity.ToString());
        bool someIAPbought = IAPManager.GetSomeIAPBought();

        iapItem.SetOnComplete(delegate
        {
            TankAnalytics.BoughtNoAdsOffer(!someIAPbought);
            LeanTween.delayedCall(1.25f, (Action) delegate
            {
                AnimatedCurrencyController.AnimateGems((int)iapItem.product.definition.payout.quantity, MenuController.UICamera.WorldToViewportPoint(iapItem.transform.position), MenuController.TotalGemsPositionViewport, 1, null, delegate(int tc)
                {
                    //MenuController.instance.topTotalGemsText.Tick(tc);
                });
                AudioMap.PlayClipAt(AudioMap.instance["gemCollect"], Vector3.zero, AudioMap.instance.uiMixerGroup);
                TankPrefs.SaveAndSendToCloud(forced: true);
                MenuController.HideMenu <NoAdsPopup>();
            });
        });
    }
Ejemplo n.º 5
0
    private IEnumerator ChestOpenAnimationRoutine(Rarity chestRarity)
    {
        rewardingDone       = false;
        chestExploded       = false;
        currentChestRewards = Variables.instance.GenerateChestRewards(chestRarity);
        PlayerDataManager.AddChestRewards(currentChestRewards);
        contentGridLayoutGroup.enabled = true;
        for (int j = 0; j != currentChestRewards.cards.Count; j++)
        {
            CardElement       component = UnityEngine.Object.Instantiate(cardPrefab).GetComponent <CardElement>();
            Card              card      = currentChestRewards.cards[j];
            ShopMenu.ShopItem item      = new ShopMenu.ShopItem
            {
                rarity = card.rarity,
                count  = card.count,
                id     = card.id,
                type   = ((card.type == CardType.TankCard) ? ShopMenu.ShopItemType.TankCard : ShopMenu.ShopItemType.BoosterCard),
                isNew  = card.isNew
            };
            shopItems.Add(item);
            AddElement(component);
            if (card.type == CardType.TankCard)
            {
                Tank tank = Variables.instance.GetTank(card.id);
                if (card.isNew)
                {
                    newCards.Push(new KeyValuePair <Collectible, CardElement>(tank, component));
                }
            }
        }
        if (currentChestRewards.gems > 0)
        {
            CardElement       component2 = UnityEngine.Object.Instantiate(cardPrefab).GetComponent <CardElement>();
            ShopMenu.ShopItem item2      = new ShopMenu.ShopItem
            {
                rarity = Rarity.Epic,
                count  = currentChestRewards.gems,
                type   = ShopMenu.ShopItemType.Gem
            };
            shopItems.Add(item2);
            AddElement(component2);
        }
        CardElement component3 = UnityEngine.Object.Instantiate(cardPrefab).GetComponent <CardElement>();

        ShopMenu.ShopItem item3 = new ShopMenu.ShopItem
        {
            rarity = chestRarity,
            count  = currentChestRewards.coins,
            type   = ShopMenu.ShopItemType.Coin
        };
        shopItems.Add(item3);
        AddElement(component3);
        LayoutRebuilder.ForceRebuildLayoutImmediate(contentGridLayoutGroup.GetComponent <RectTransform>());
        contentGridLayoutGroup.enabled = false;
        foreach (CardElement element in elements)
        {
            element.gameObject.SetActive(value: false);
        }
        chest.gameObject.SetActive(value: true);
        Image  image = chest;
        object sprite;

        switch (chestRarity)
        {
        default:
            sprite = commonChestSprite;
            break;

        case Rarity.Rare:
            sprite = rareChestSprite;
            break;

        case Rarity.Epic:
            sprite = epicChestSprite;
            break;
        }
        image.sprite = (Sprite)sprite;
        chest.SetNativeSize();
        yield return(new WaitForSeconds(currentOptions.shakeTime));

        AudioMap.PlayClipAt(AudioMap.instance["chestShake"], Vector3.zero, AudioMap.instance.uiMixerGroup);
        LeanTween.delayedCall(currentOptions.windupTime - 0.367f, (Action) delegate
        {
            AudioMap.PlayClipAt(AudioMap.instance["chestWindup"], Vector3.zero, AudioMap.instance.uiMixerGroup);
        });
        for (float time = 0f; time <= currentOptions.windupTime; time += Time.deltaTime)
        {
            chest.transform.rotation = Quaternion.Euler(0f, 0f, 50f * (Mathf.PingPong(time / 0.2f, 0.3f) - 0.2f));
            glowImage.color          = new Color(1f, 1f, 1f, LeanTween.easeInExpo(0f, 1f, time / currentOptions.windupTime));
            yield return(null);
        }
        chest.gameObject.SetActive(value: false);
        chest.transform.rotation = Quaternion.identity;
        currentOptions.explosion.Play();
        AudioMap.PlayClipAt(AudioMap.instance["chestOpen"], Vector3.zero, AudioMap.instance.uiMixerGroup);
        if (chestRarity == Rarity.Epic)
        {
            AudioMap.PlayClipAt(AudioMap.instance["chestOpenChime"], Vector3.zero, AudioMap.instance.uiMixerGroup);
        }
        yield return(new WaitForSeconds(currentOptions.postExplosionWaitTime));

        doubleRewardsOfferButton.gameObject.SetActive(!isSubscribed);
        doubleRewardingDone = !isSubscribed;
        chestExploded       = true;
        MenuController.backButtonOverrideAction = FinishAnimation;
        int num;

        for (int i = 0; i < elements.Count; i = num)
        {
            if (!(elements[i] == null))
            {
                CardElement cardElement = elements[i];
                AudioMap.PlayClipAt(AudioMap.instance["cardReveal"], Vector3.zero, AudioMap.instance.uiMixerGroup);
                cardElement.gameObject.SetActive(value: true);
                cardElement.SetValues(shopItems[i], animateRoll: true, deductCount: true, isSubscribed);
                if (shopItems[i].type == ShopMenu.ShopItemType.TankCard && shopItems[i].isNew)
                {
                    SetNewCard(i);
                }
                if (shopItems[i].type == ShopMenu.ShopItemType.Coin)
                {
                    AnimatedCurrencyController.AnimateCoins(isSubscribed ? (shopItems[i].count / 2) : shopItems[i].count, MenuController.UICamera.WorldToViewportPoint(cardElement.transform.position), MenuController.TotalCoinsPositionViewport, 5, null, delegate(int ts)
                    {
                        MenuController.instance.topTotalCoinsText.Tick(ts);
                    });
                }
                else if (shopItems[i].type == ShopMenu.ShopItemType.Gem)
                {
                    AnimatedCurrencyController.AnimateGems(isSubscribed ? (shopItems[i].count / 2) : shopItems[i].count, MenuController.UICamera.WorldToViewportPoint(cardElement.transform.position), MenuController.TotalGemsPositionViewport, 1, null, delegate(int ts)
                    {
                        MenuController.instance.topTotalGemsText.Tick(ts);
                    });
                }
                yield return(new WaitForSeconds(0.25f));
            }
            num = i + 1;
        }
        if (isSubscribed)
        {
            doubleRewardRoutine = StartCoroutine(DoubleRewardsRoutine());
        }
        FinishAnimation();
    }