private void UpdateTimeText(int hours) { ILocalizationRepository localization = Services.ResourceService.Localization; if (hours == 1) { timeText.text = localization.GetString("fmt_hour_1"); } else { timeText.text = string.Format(localization.GetString("fmt_hour_several"), hours); } }
private string UpdateTimeText(int hours) { ILocalizationRepository localization = Services.ResourceService.Localization; if (hours == 1) { //nextLevelProfitInterval.text = localization.GetString("fmt_hour_1"); return(localization.GetString("fmt_hour_1")); } else { //nextLevelProfitInterval.text = string.Format(localization.GetString("fmt_hour_several"), hours); return(string.Format(localization.GetString("fmt_hour_several"), hours)); } }
private void UpdateReportsCountText(int managerId) { ISecretaryService secretaryService = Services.SecretaryService; ILocalizationRepository localization = Services.ResourceService.Localization; int reportCount = secretaryService.GetReportCount(managerId); if (reportCount == 0) { reportCountText.text = localization.GetString("lbl_no_reports"); } else { reportCountText.text = string.Format(localization.GetString("fmt_reports_count"), reportCount.ToString().Colored(ConsoleTextColor.red)); } }
private void UpdateManagerEfficiency() { ILocalizationRepository localization = Services.ResourceService.Localization; if (manager != null) { if (manager.IsMaxEfficiency(Services)) { managerEfficiencyText.text = string.Format(localization.GetString("fmt_mgr_eff"), manager.EfficiencyPercent(Services)); } else { managerEfficiencyText.text = string.Format(localization.GetString("fmt_mgr_eff_drop"), manager.EfficiencyPercent(Services).ToString().Colored(ConsoleTextColor.red)); } } }
private void UpdateNextLevelControls() { IBankService bankService = Services.GetService <IBankService>(); ILocalizationRepository localization = Services.ResourceService.Localization; int currentLevel = bankService.CurrentBankLevel; if (bankService.IsMaxLevel(currentLevel)) { nextLevelControlsParent.Deactivate(); maxLevelText.Activate(); } else { nextLevelControlsParent.Activate(); maxLevelText.Deactivate(); openBankNextLevelLabel.text = string.Format(localization.GetString("lbl_next_level_bank_desc"), bankService.NextLevel); BankLevelData bankLevelData = Services.ResourceService.BankLevelRepository.GetBankLevelData(bankService.NextLevel); ProfitInterval profitInterval = AdjustProfitInterval(bankLevelData.Profit, (int)bankLevelData.ProfitInterval); string profitString = profitInterval.Profit.ToString().Size(72).Colored("#fde090"); string intervalString = UpdateTimeText(profitInterval.Interval).Size(72).Colored("#00fdf7"); nextLevelProfit.text = profitString + " " + intervalString; /* * if (bankLevelData.Profit.IsWhole()) { * string profitString = ((int)bankLevelData.Profit).ToString().Size(80).Colored("#fde090"); * int hours = TimeSpan.FromSeconds(bankLevelData.ProfitInterval).Hours; * string intervalString = UpdateTimeText(hours).Size(72).Colored("#00fdf7"); * nextLevelProfit.text = profitString + " " + intervalString; * } else { * string profitString = ((int)(bankLevelData.Profit * 2)).ToString().Size(80).Colored("#fde090"); * int hours = TimeSpan.FromSeconds(bankLevelData.ProfitInterval * 2).Hours; * string intervalString = UpdateTimeText(hours).Size(72).Colored("#00fdf7"); * nextLevelProfit.text = profitString + " " + intervalString; * }*/ openNextLevelPriceText.text = bankLevelData.LevelPriceCoins.ToString(); openNextLevelButton.SetListener(() => { if (IsAllowBuyNextLevel(bankLevelData)) { StartCoroutine(OpenEffectImpl()); Services.GetService <ISoundService>().PlayOneShot(SoundName.buyCoins); } else { ViewService.Show(ViewType.CoinRequiredView, new ViewData { UserData = bankLevelData.LevelPriceCoins, ViewDepth = GetComponentInParent <BankView>().ViewDepth + 1 }); Sounds.PlayOneShot(SoundName.click); } }); openNextLevelButton.interactable = (!bankService.IsMaxLevel(bankService.CurrentBankLevel)); } }
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(); }
public override void OnEnable() { base.OnEnable(); ILocalizationRepository localization = Services.ResourceService.Localization; flyToMarsText.text = localization.GetString("lbl_fly_to_moon"); changePlanetButton.SetListener(() => { Services.ViewService.Show(ViewType.PlanetsView); Services.GetService <ISoundService>().PlayOneShot(SoundName.click); }); }
public void Setup(int managerId) { IMechanicService mechanicService = Services.GetService <IMechanicService>(); ILocalizationRepository localization = Services.ResourceService.Localization; manager = Services.GetService <IManagerService>().GetManager(managerId); tempMechanicView.Setup(Services.GenerationService.GetGetenerator(managerId)); UpdateBrokenedAndIncomeTexts(); buyMechanicButton.SetListener(() => { BosError error = BosError.Ok; if (mechanicService.IsAllowBuyMechanic(manager.Id, out error)) { BosError status = mechanicService.BuyMechanic(manager.Id); if (status == BosError.Ok) { Services.GetService <ISoundService>().PlayOneShot(SoundName.buyCoins); } else { Services.GetService <ISoundService>().PlayOneShot(SoundName.slotFail); } } else if (error == BosError.NoEnoughCoins) { ViewService.Show(ViewType.CoinRequiredView, new ViewData { UserData = mechanicService.GetNextMechanicPrice(manager.Id), ViewDepth = ViewService.NextViewDepth }); Sounds.PlayOneShot(SoundName.click); } else { Debug.LogError("some error"); } }); UpdateBuyButtonState(); UpdateMechanicPriceText(); UpdateMechanicCountText(); speedUpRepairx2Text.text = string.Format( localization.GetString("fmt_speed_up_x2"), "x".Colored("#FDEE21").Size(24), "2".Colored("#F9F7BC").Size(36)); CreateConstMechanicAnimObject(); }
public void Setup(ProductData productData) { this.Data = productData; this.cachedProductData = productData; IResourceService resourceService = Services.ResourceService; ILocalizationRepository localization = resourceService.Localization; nameText.text = localization.GetString(productData.name_id); pointsText.text = "profile_status".GetLocalizedString(); var points = BosUtils.GetCurrencyStringSimple(new CurrencyNumber(productData.status_points)); pointsCountText.text = $"+{points}"; if (Services.PlayerService.IsProductPurchased(productData.id)) { checkObject.Activate(); buyButton.Deactivate(); } else { checkObject.Deactivate(); buyButton.Activate(); var price = productData.price; //Services.GenerationService.CalculateProfit20Minute(productData.transport_Id, productData.transport_count, productData.planet_Id); priceText.text = BosUtils.GetCurrencyStringSimple(Bos.Data.Currency.CreatePlayerCash(price)); } buyButton.SetListener(() => { if (Services.PlayerService.PurchaseProduct(productData) == TransactionState.Success) { Services.GetService <ISoundService>().PlayOneShot(SoundName.buyUpgrade); //playe buy effect CreateParticles(); ScaleEffect(); } }); updateTimer.Setup(0.3f, (deltaTime) => { UpdateButtonState(productData); }, invokeImmediatly: true); }