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; }
public void InitCoinItems() { Debug.Log("金币总量为:" + PlayerDataManager.GetCoins()); for (int i = 0; i != coinItems.Length; i++) { CoinItem item = coinItems[i]; item.coinAmountText.text = item.coinAmount.ToString(); if (item.dealValue > 0) { item.dealValueText.GetComponent <LocalizationParamsManager>().SetParameterValue("AMOUNT", $"+{item.dealValue.ToString()}"); item.dealValueText.text = "<color=#9806FD>" + item.dealValue.ToString() + "%" + "额外赠送!"; } item.priceText.text = item.gemPrice.ToString(); item.button.onClick.AddListener(delegate { TryPurchase(item.gemPrice, CurrencyType.Gems, delegate { AnimatedCurrencyController.AnimateCoins(item.coinAmount, MenuController.UICamera.WorldToViewportPoint(item.graphicButton.transform.position), MenuController.TotalCoinsPositionViewport, 1, null, delegate(int tc) { }); MenuController.instance.topTotalGemsText.Tick(-item.gemPrice); //宝石扣除 PlayerDataManager.AddCoins(item.coinAmount, sync: true, cloudSync: false); //金币添加 MenuController.UpdateTopMenu(); Debug.Log("金币总量为:" + PlayerDataManager.GetCoins()); Debug.Log("钻石总量为:" + PlayerDataManager.GetGems()); }); }); } }
public void AnimateGameCoins(int count, Transform from) { AnimatedCurrencyController.AnimateCoins(count, TankGame.instance.ingameCameras[0].WorldToViewportPoint(from.position), CoinPositionViewport, 1, delegate { }, delegate(int value) { coinsText.Tick(value); }, departureSound: false); }
public static void HideNewestMenu() { if (instance.visibleMenus.Count > 0) { instance.visibleMenus[instance.visibleMenus.Count - 1].gameObject.SetActive(value: false); instance.visibleMenus.RemoveAt(instance.visibleMenus.Count - 1); AnimatedCurrencyController.CancelAllAnimations(); ApplyNewestMenuSettings(); } }
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()); }); }
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>(); }
private void Start() { if (PlayerPrefs.GetInt("Isbought") == 1) { isSubscribed = true; } else { doubleRewardsOfferButton.onClick.AddListener(delegate { offerPressed = true; AnimatedCurrencyController.CancelAllAnimations(); MenuController.ShowMenu <SubscriptionOfferPopup>().Init("ChestPopup"); isSubscribed = true; }); } Exit.onClick.AddListener(delegate { MenuController.HideMenu <ChestPopup>(); }); }
private void OnDisable() { GameModeButton[] array = new GameModeButton[1] { //play1V1Button, //play2V2Button, playAdventureButton }; foreach (GameModeButton obj in array) { obj.glow.enabled = false; obj.GetComponent <RectTransform>().anchoredPosition = new Vector2(0f, -300f); } AnimatedCurrencyController.CancelAllAnimations(); starsToAddPerGameMode = new int[5]; UpdatePlayMenu(); MenuController.backButtonFallbackAction = (MenuController.OnBackButtonPress)Delegate.Remove(MenuController.backButtonFallbackAction, new MenuController.OnBackButtonPress(ShowQuitDialog)); }
private void OnDisable() { FinishAnimation(); for (int i = 0; i != elements.Count; i++) { UnityEngine.Object.Destroy(elements[i].gameObject); } globalBackground.material = defaultBackgroundMaterial; if (currentOptions.enable != null) { currentOptions.enable.SetActive(value: false); } AnimatedCurrencyController.CancelAllAnimations(); if (onComplete != null) { onComplete(); } MenuController.UpdateTopMenu(); currentOptions = null; MenuController.backButtonOverrideAction = null; doubleRewardRoutine = null; }
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>(); }); }); }
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(); }
private void OnDisable() { AnimatedCurrencyController.AnimateCoins(Variables.instance.easterEggCoins, MenuController.UICamera.WorldToViewportPoint(base.transform.position), MenuController.TotalCoinsPositionViewport, 5); PlayerDataManager.CollectEasterEgg(); TankPrefs.Save(); }
private void OnEnable() { instance = this; StartAnimateRoutine(); }
private IEnumerator AddStars() { while (true) { int j; for (int i = 0; i < starsToAddPerGameMode.Length; i = j) { if (starsToAddPerGameMode[i] > 0) { //yield return new WaitWhile(() => AdsManager.ShowingAd); yield return(new WaitForSeconds(1.25f)); GameMode mode = (GameMode)i; GameModeButton button = null; Vector3 to = default(Vector3); switch (mode) { case GameMode.Arena: to = MenuController.UICamera.WorldToViewportPoint(pvpChest.starAnimationTarget.position); // button = play1V1Button; break; case GameMode.Arena2v2: to = MenuController.UICamera.WorldToViewportPoint(pvpChest.starAnimationTarget.position); //button = play2V2Button; break; case GameMode.Adventure: to = MenuController.UICamera.WorldToViewportPoint(adventureChest.starAnimationTarget.position); button = playAdventureButton; break; } button.glow.enabled = true; RectTransform glowRect = button.glow.GetComponent <RectTransform>(); Vector2 startPosition = new Vector2(0f, -300f); Vector2 targetPosition = new Vector2(0f, 300f); if (mode == GameMode.Adventure) { RectOpacityContainer[] adventureButtonElements = GetAdventureButtonElements(adventureLogoLevel); StartCoroutine(FadeElementOut(adventureButtonElements[2], 0.15f, 0.1f)); StartCoroutine(FadeElementOut(adventureButtonElements[1], 0.22f, 0.1f)); StartCoroutine(FadeElementOut(adventureButtonElements[0], 0.26f, 0.14f)); } for (float t = 0f; t < 0.5f; t += Time.deltaTime) { glowRect.anchoredPosition = Vector2.Lerp(startPosition, targetPosition, t / 0.5f); yield return(null); } button.glow.enabled = false; AnimateFlash[] componentsInChildren = button.GetComponentsInChildren <AnimateFlash>(); for (j = 0; j < componentsInChildren.Length; j++) { componentsInChildren[j].Play(); } button.sparkleParticles.Play(); Vector3 fromViewportSpace = MenuController.UICamera.WorldToViewportPoint(button.starFlightStart.position); int startCount = 0; Action <int> onLeaveTick = delegate { }; Action <int> action = (Action <int>) delegate { }; if (mode == GameMode.Adventure) { int num = starsToAddPerGameMode[i]; startCount = PlayerDataManager.GetChestProgress(ChestProgressionType.Adventure) - num; Action <int> onArriveTick = delegate(int tickCount) { float progress2 = (float)(startCount + tickCount) / (float)Variables.instance.GetChestPointsNeeded(ChestProgressionType.Adventure); adventureChest.SetProgress(progress2); adventureChest.progressText.Tick(tickCount); adventureChest.GetComponentInChildren <AnimateFlash>().Play(); AudioMap.PlayClipAt("progressBarTick", Vector3.zero, AudioMap.instance.uiMixerGroup); MenuController.UpdateTopMenu(); StartCoroutine(AnimateFadeMapChange()); }; AnimatedCurrencyController.AnimateSilverStars(num, fromViewportSpace, to, 1, onLeaveTick, onArriveTick); } else { int num = starsToAddPerGameMode[i]; startCount = PlayerDataManager.GetChestProgress(ChestProgressionType.Pvp) - num; Action <int> onArriveTick = delegate(int tickCount) { float progress = (float)(startCount + tickCount) / (float)Variables.instance.GetChestPointsNeeded(ChestProgressionType.Pvp); pvpChest.SetProgress(progress); pvpChest.progressText.Tick(tickCount); pvpChest.GetComponentInChildren <AnimateFlash>().Play(); AudioMap.PlayClipAt("progressBarTick", Vector3.zero, AudioMap.instance.uiMixerGroup); MenuController.UpdateTopMenu(); }; AnimatedCurrencyController.AnimateGoldenStars(num, fromViewportSpace, to, 1, onLeaveTick, onArriveTick); } starsToAddPerGameMode[i] = 0; } j = i + 1; } yield return(null); } }