private void UpdateState() { Construct(); //print($"megaboost state => {boostService.State}"); switch (boostService.State) { case BoostState.FirstCharger: { progressFill.fillAmount = boostService.FirstChargerProgress; timerText.text = BosUtils.FormatTimeWithColon(boostService.FirstChargerTimer); } break; case BoostState.Active: { //progressFill.fillAmount = boostService.AtiveProgress; timerText.text = BosUtils.FormatTimeWithColon(boostService.ActiveTimer); } break; case BoostState.Locked: { progressFill.fillAmount = boostService.LockedProgress; timerText.text = BosUtils.FormatTimeWithColon(boostService.CooldownTimer); } break; } }
private void UpdateViews() { IBankService bankService = Services.GetService <IBankService>(); ILocalizationRepository localization = Services.ResourceService.Localization; int coinsAccumulatedCount = bankService.CoinsAccumulatedCount; if (coinsAccumulatedCount > 0) { TimeSpan timeSpan = TimeSpan.FromSeconds(bankService.TimerFromLastCollect); int hours = timeSpan.Hours; if (hours == 0) { hours = 1; } timerFromLastCollectText.text = string.Format(localization.GetString("fmt_bank_time_from_last_collect"), hours); timeToFollowingCoinText.text = string.Empty; //takeButton.interactable = true; takeButton.SetInteractableWithShader(true && isNoCollectionProcess); Color takeButtonTextColor; if (ColorUtility.TryParseHtmlString("#fbef21", out takeButtonTextColor)) { takeButtonText.color = takeButtonTextColor; } } else { timerFromLastCollectText.text = string.Empty; timeToFollowingCoinText.text = string.Format(localization.GetString("fmt_bank_next_coin"), BosUtils.FormatTimeWithColon(bankService.TimeToNextCoin).ToString().Colored("#fbef21")); //takeButton.interactable = false; takeButton.SetInteractableWithShader(false); Color takeButtonTextColor; if (ColorUtility.TryParseHtmlString("#b3b3b3", out takeButtonTextColor)) { takeButtonText.color = takeButtonTextColor; } } accumulatedCoinCount.text = bankService.CoinsAccumulatedCount.ToString(); }
private void UpdateButtonInteractability() { int currentTime = Services.TimeService.UnixTimeInt; int allowTime = Services.InvestorService.AllowSellTime; var states = Services.InvestorService.SellState; bool isSellStateOk = ViewService.Utils.IsInvestorSellStateOk(states); sellButton.interactable = isSellStateOk; sellAdButton.interactable = isSellStateOk; if (IsCooldown(states)) { allowSellTimerParent.Activate(); cooldownTimerText.text = BosUtils.FormatTimeWithColon(Mathf.Abs(allowTime - currentTime)); } else { allowSellTimerParent.Deactivate(); } }
public override void Start() { base.Start(); toggle.onValueChanged.RemoveAllListeners(); bool isOnValue = Services.TimeChangeService.IsEnabled; toggle.isOn = isOnValue; UpdateToggleText(toggle.isOn); toggle?.SetListener(isOn => { Services.TimeChangeService.SetEnabled(isOn); Services.SoundService.PlayOneShot(SoundName.click); UpdateToggleText(isOn); }); realUpdateTimer.Setup(1, dt => realtimeText.text = BosUtils.FormatTimeWithColon(Services.TimeChangeService.RealTime), true); #if !BOSDEBUG gameObject.Deactivate(); #endif }
private void UpdateOpeningFilling() { progressFillImage.fillAmount = (float)Planet.OpeningProgress; progressText.text = BosUtils.FormatTimeWithColon(Planet.OpeningRemaningTime); }