private void SetupOfflineEarnings() { CalculateTimeSpawn(); if (timeDifference.TotalSeconds < 30) { return; // so that after RewardVideo we do not open this panel } if (GameManager.In.OfflineEarningsOneSecond == 0) { return; } float limitTotalSeconds = (float)timeDifference.TotalSeconds; double freeOfflineEarnings = (GameManager.In.OfflineEarningsOneSecond * limitTotalSeconds) / 10f; string textFreeOfflineEarnings = NumberSystem.Output(freeOfflineEarnings); double adsOfflineEarnings = freeOfflineEarnings * 5f; string textadsOfflineEarnings = NumberSystem.Output(adsOfflineEarnings); textadsOfflineEarnings += "(Ads)"; UIGetBonusCoins uiOfflineEarnings = GameManager.In.PanelOfflineEarnings.GetComponent <UIGetBonusCoins>(); uiOfflineEarnings.FreeCoins = freeOfflineEarnings; uiOfflineEarnings.AdsCoins = adsOfflineEarnings; uiOfflineEarnings.FreeButton.text = "+" + textFreeOfflineEarnings; uiOfflineEarnings.AdsButton.text = "+" + textadsOfflineEarnings; GameManager.In.PanelOfflineEarnings.SetActive(true); }
private void UIUpdateData() { CurrentCostUpdate = updateData.AllCostUpdates[updateData.CurrentUpdate]; if (updateData.CurrentUpdate == updateData.MaxUpdate) { cost.text = "MAX"; } else { cost.text = NumberSystem.Output(CurrentCostUpdate); } currentLvl.text = "Lv " + (1 + updateData.CurrentUpdate).ToString(); CheckEnoughMoney(); // After opening the update window(OpenUpdate();), there is no check for opening buttons(updateButton.interactable) }
public static void lerpTextLabel(Text textLabel, double oldValue, double newValue, float lerpValue, Action callback = null) { float lerp = 0f; float lerpEndVal = lerpValue; Sequence seq = DOTween.Sequence(); while (lerp < lerpEndVal) { lerp += Time.deltaTime; double val = GameAnims.lerp(oldValue, newValue, lerp); seq.AppendInterval(Time.deltaTime); seq.AppendCallback(() => textLabel.text = "" + NumberSystem.Output(val)); } seq.AppendInterval(Time.deltaTime); seq.AppendCallback(() => { textLabel.text = "" + NumberSystem.Output(newValue); if (callback != null) { callback(); } }); }
public void OpenRewardPanel(double rewardCoins) // -> UIGetBonusCoins - GetBonusCoins() { this.rewardCoins = rewardCoins; bottomText.text = NumberSystem.Output(rewardCoins); buttonClosePanelReward.gameObject.SetActive(true); }