/// <summary> /// Возвращает контент популярности /// </summary> private static string GetPopularityString(ActionResultModel result) { var popularityPrefix = string.Empty; switch (result.Action) { case ActionType.NewTrack: case ActionType.Feat: popularityPrefix = "Скачиваний: "; break; case ActionType.NewClip: case ActionType.Battle: popularityPrefix = "Просмотров: "; break; case ActionType.Concert: popularityPrefix = "Посещение: "; break; case ActionType.Traning: return(string.Empty); } return($"{popularityPrefix}{NumberFormatter.FormatValue(result.Popularity)}"); }
internal void FastUpdate(CyclopsHelmHUDManager cyclopsHelmHUD) { if (!powerIconsInitialized) { AddStatusIcons(cyclopsHelmHUD); } else { UpdateStatusIcons(); } PowerRelay powerRelay = Cyclops.powerRelay; switch (settings.EnergyDisplay) { case HelmEnergyDisplay.PowerCellAmount: cyclopsHelmHUD.powerText.text = NumberFormatter.FormatValue(powerRelay.GetPower()); break; case HelmEnergyDisplay.PercentageOverPowerCells: float percentOver = (powerRelay.GetPower() + this.ChargeManager.GetTotalReservePower()) / powerRelay.GetMaxPower(); cyclopsHelmHUD.powerText.text = $"{NumberFormatter.FormatValue(percentOver * 100f)}%"; break; case HelmEnergyDisplay.CombinedAmount: cyclopsHelmHUD.powerText.text = NumberFormatter.FormatValue(powerRelay.GetPower() + this.ChargeManager.GetTotalReservePower()); break; default: // HelmEnergyDisplay.PowerCellPercentage: float percent = powerRelay.GetPower() / powerRelay.GetMaxPower(); cyclopsHelmHUD.powerText.text = $"{NumberFormatter.FormatValue(percent * 100f)}%"; break; } }
/// <summary> /// Увеличивает количество фанатов /// </summary> protected static void IncreaseFans(EventManager eventManager, int percent = 1) { var fansIncrease = PlayerManager.GetFansPercentValue() * percent; PlayerManager.GetInfo().Fans += fansIncrease; eventManager.EventReward.text = $"Вы приобрели {NumberFormatter.FormatValue(fansIncrease)} новых фанатов"; eventManager.StatsManager.UpdateStats(); }
internal string PowerIndicatorString() { if (reactorRodData.Count == 0) { return(CyNukReactorBuildable.NoPoweMessage()); } return(NumberFormatter.FormatValue(GetTotalAvailablePower())); }
/// <summary> /// Рассчитывает цену /// </summary> protected override void CalculateDurationAndPrice() { price = place.Rent; var rentPercent = place.Rent / 100 * 5; price += Organizers.isOn ? rentPercent : 0; price += Advertising.isOn ? rentPercent : 0; PriceText.text = $"Стоимость: {NumberFormatter.FormatValue(price)}"; }
/// <summary> /// Отображает окно с результатами действия /// </summary> private void ShowActionResult(ActionResultModel result) { Popularity.text = GetPopularityString(result); Top.text = GetTopString(result); Reward.gameObject.SetActive(true); _fans.text = $"{GetSign(result.FansIncrease)} {NumberFormatter.FormatValue(result.FansIncrease)}"; _money.text = $"{GetSign(result.Income)} {NumberFormatter.FormatValue(result.Income)}"; Traning.text = string.Empty; }
/// <summary> /// Рассчитывает длительность и стоимость /// </summary> protected override void CalculateDurationAndPrice() { var settingCosts = new List <SettingCost> { GetCost(Screenwritter.isOn), GetCost(Producer.isOn), GetCost(Operator.isOn), GetCost(SoundProducer.isOn) }; _duration = settingCosts.Sum(e => e.Duration); _price = PlayerManager.GetFansPercentValue() / 5 * settingCosts.Sum(e => e.PricePercent); Duration.text = $"Кол-во дней: {_duration}д"; Price.text = _price > 0 ? $"Стоимость: {NumberFormatter.FormatValue(_price)}" : string.Empty; }
/// <summary> /// Обработчик первого варианта действия /// </summary> public override void OnFirtsButtonClick(EventManager eventManager) { HideEventButtons(eventManager.FirstButton, eventManager.SecondButton, eventManager.OkButton); //AdsManager.GetInstance().ShowAd(Appodeal.NON_SKIPPABLE_VIDEO); eventManager.EventContent.text = "Вы досмотрели ролик до конца и получили заслуженную награду!"; var playerInfo = PlayerManager.GetInfo(); var income = playerInfo.Money > 500 ? playerInfo.Money / 100 * 10 : 200; playerInfo.Money += income; eventManager.EventReward.text = $"Заработано: {NumberFormatter.FormatValue(income)}"; eventManager.StatsManager.UpdateStats(); }
/// <summary> /// Уменьшает количество фанатов /// </summary> protected static void DecreaseFans(EventManager eventManager, int percent = 1) { var playerInfo = PlayerManager.GetInfo(); var fansDecrease = PlayerManager.GetFansPercentValue() * percent; if (playerInfo.Fans < fansDecrease) { fansDecrease = playerInfo.Fans; } playerInfo.Fans -= fansDecrease; eventManager.EventReward.text = $"От вас ушло {NumberFormatter.FormatValue(fansDecrease)} фанатов"; eventManager.StatsManager.UpdateStats(); }
/// <summary> /// Updates the console HUD using data from all equipment modules across all upgrade consoles. /// </summary> /// <param name="hudManager">The console HUD manager.</param> internal void SlowUpdate(CyclopsUpgradeConsoleHUDManager hudManager) { if (!consoleIconsRemoved) { hudManager.ToggleAllIconsOff(); consoleIconsRemoved = true; } if (upgradesText == null) { upgradesText = hudManager.subRoot.transform.Find("UpgradeConsoleHUD")?.Find("Canvas_Main")?.Find("Text")?.GetComponent <Text>(); } if (upgradesText != null) { upgradesText.fontSize = 70; upgradesText.text = hudManager.subRoot.GetSubName(); } int currentReservePower = this.ChargeManager.GetTotalReservePower(); float currentBatteryPower = Cyclops.powerRelay.GetPower(); int TotalPowerUnits = Mathf.CeilToInt(currentBatteryPower + currentReservePower); float normalMaxPower = Cyclops.powerRelay.GetMaxPower(); int normalMaxPowerInt = Mathf.CeilToInt(normalMaxPower); hudManager.energyCur.color = NumberFormatter.GetNumberColor(currentBatteryPower, normalMaxPower, 0f); hudManager.energyCur.text = NumberFormatter.FormatValue(TotalPowerUnits); if (hudManager.lastMaxSubPowerDisplayed != normalMaxPowerInt) { hudManager.energyMax.text = "/" + NumberFormatter.FormatValue(normalMaxPowerInt); hudManager.lastMaxSubPowerDisplayed = normalMaxPowerInt; } settings.UpdateCyclopsMaxPower(normalMaxPower); if (totalPowerInfoIcons > 0) { powerIconTextVisibility = Player.main.currentSub == Cyclops && holographicHUD != null && Mathf.Abs(Vector3.Distance(holographicHUD.transform.position, Player.main.transform.position)) <= 4f; if (lastKnownTextVisibility != powerIconTextVisibility) { UpdatePowerIcons(); lastKnownTextVisibility = powerIconTextVisibility; } } }
/// <summary> /// Updates the console HUD using data from all equipment modules across all upgrade consoles. /// </summary> /// <param name="hudManager">The console HUD manager.</param> internal void SlowUpdate(CyclopsUpgradeConsoleHUDManager hudManager) { if (!Cyclops.LOD.IsFull() || Player.main.currentSub != Cyclops || !Cyclops.live.IsAlive()) { return; // Same early exit } hudManager.healthCur.text = IntStringCache.GetStringForInt(Mathf.FloorToInt(hudManager.liveMixin.health)); int maxHealth = Mathf.CeilToInt(hudManager.liveMixin.health); if (hudManager.lastHealthMaxDisplayed != maxHealth) { hudManager.healthMax.text = "/" + IntStringCache.GetStringForInt(maxHealth); hudManager.lastHealthMaxDisplayed = maxHealth; } int currentReservePower = this.ChargeManager.GetTotalReservePower(); float currentBatteryPower = Cyclops.powerRelay.GetPower(); int TotalPowerUnits = Mathf.CeilToInt(currentBatteryPower + currentReservePower); float normalMaxPower = Cyclops.powerRelay.GetMaxPower(); int normalMaxPowerInt = Mathf.CeilToInt(normalMaxPower); hudManager.energyCur.color = NumberFormatter.GetNumberColor(currentBatteryPower, normalMaxPower, 0f); hudManager.energyCur.text = NumberFormatter.FormatValue(TotalPowerUnits); if (hudManager.lastMaxSubPowerDisplayed != normalMaxPowerInt) { hudManager.energyMax.text = "/" + NumberFormatter.FormatValue(normalMaxPowerInt); hudManager.lastMaxSubPowerDisplayed = normalMaxPowerInt; } settings.UpdateCyclopsMaxPower(normalMaxPower); if (totalPowerInfoIcons > 0) { powerIconTextVisibility = Player.main.currentSub == Cyclops && holographicHUD != null && Mathf.Abs(Vector3.Distance(holographicHUD.transform.position, Player.main.transform.position)) <= 4f; if (lastKnownTextVisibility != powerIconTextVisibility) { UpdatePowerIcons(); lastKnownTextVisibility = powerIconTextVisibility; } } }
/// <summary> /// Списание расходов за месяц /// </summary> private void ProcessExpenses() { var expenses = PlayerManager.GetFansPercentValue() * 5; if (PlayerManager.EnoughMoney(expenses)) { PlayerManager.SpendMoney(expenses); AlertManager.ShowMessage($"Ваши расходы за месяц: {NumberFormatter.FormatValue(expenses)}"); StatsManager.UpdateStats(); } else { _gameLosed = true; LoseGame.Show(); } }
/// <summary> /// Обработчик второго варианта действия /// </summary> public override void OnSecondButtonClick(EventManager eventManager) { HideEventButtons(eventManager.FirstButton, eventManager.SecondButton, eventManager.OkButton); eventManager.EventContent.text = "Рекламный ролик стал вирусным, а вы - мемом. Многие фанаты остались сильно разочарованы..."; var playerInfo = PlayerManager.GetInfo(); var fansDecrease = PlayerManager.GetFansPercentValue() * 3; var income = playerInfo.Money > 500 ? playerInfo.Money / 100 * 5 : 50; if (playerInfo.Fans < fansDecrease) { fansDecrease = playerInfo.Fans; } playerInfo.Fans -= fansDecrease; playerInfo.Money += income; eventManager.EventReward.text = $"От вас ушло {NumberFormatter.FormatValue(fansDecrease)} фанатов. Заработано: {NumberFormatter.FormatValue(income)}"; eventManager.StatsManager.UpdateStats(); }
internal void FastUpdate(CyclopsHelmHUDManager cyclopsHelmHUD, int lastPowerInt) { if (!cyclopsHelmHUD.LOD.IsFull() || Player.main.currentSub != Cyclops) { return; // Same early exit } if (totalPowerInfoIcons > 0) { if (!powerIconsInitialized) { AddPowerIcons(cyclopsHelmHUD); } else { UpdatePowerIcons(); } } if (lastPowerInt < 0f) { return; } PowerRelay powerRelay = Cyclops.powerRelay; switch (lastDisplay = settings.EnergyDisplay) { case HelmEnergyDisplay.PowerCellAmount: cyclopsHelmHUD.powerText.text = NumberFormatter.FormatValue(powerRelay.GetPower()); break; case HelmEnergyDisplay.PercentageOverPowerCells: float percentOver = (powerRelay.GetPower() + this.ChargeManager.GetTotalReservePower()) / powerRelay.GetMaxPower(); cyclopsHelmHUD.powerText.text = $"{NumberFormatter.FormatValue(percentOver * 100f)}%"; break; case HelmEnergyDisplay.CombinedAmount: cyclopsHelmHUD.powerText.text = NumberFormatter.FormatValue(powerRelay.GetPower() + this.ChargeManager.GetTotalReservePower()); break; default: // HelmEnergyDisplay.PowerCellPercentage: float percent = powerRelay.GetPower() / powerRelay.GetMaxPower(); cyclopsHelmHUD.powerText.text = $"{NumberFormatter.FormatValue(percent * 100f)}%"; break; } }
/// <summary> /// Обновляет основную статистику /// </summary> public void UpdateStats() { var playerInfo = PlayerManager.GetInfo(); PlayerName.text = playerInfo.Name; Fans.text = NumberFormatter.FormatValue(playerInfo.Fans); Money.text = NumberFormatter.FormatValue(playerInfo.Money); if (!playerInfo.TweetsUnlocked && playerInfo.Fans >= 10000) { AlertManager.ShowMessage("О вас стали говорить в соц. сетях!", 10); TweetsFeed.Open(); } if (!playerInfo.EventUnlocked && playerInfo.Fans >= 5000) { playerInfo.EventUnlocked = true; } }
/// <summary> /// Обработчик первого варианта действия /// </summary> public override void OnFirtsButtonClick(EventManager eventManager) { HideEventButtons(eventManager.FirstButton, eventManager.SecondButton, eventManager.OkButton); eventManager.EventContent.text = "Стрим почти никто не смотрел, пока другой популярный стример не призвал своих фанатов поглумиться над вами. " + "В конечном счете все превратилось в дурдом и закончилось совсем не так, как ожидалось"; var playerInfo = PlayerManager.GetInfo(); var fansDecrease = PlayerManager.GetFansPercentValue(); var income = playerInfo.Money > 500 ? playerInfo.Money / 100 * 8 : 50; if (playerInfo.Fans < fansDecrease) { fansDecrease = playerInfo.Fans; } playerInfo.Fans -= fansDecrease; playerInfo.Money += income; eventManager.EventReward.text = $"От вас ушло {NumberFormatter.FormatValue(fansDecrease)} фанатов. Заработано: {NumberFormatter.FormatValue(income)}"; eventManager.StatsManager.UpdateStats(); }
public void OnHandHover(GUIHand hand) { if (!_buildable.constructed) { return; } HandReticle main = HandReticle.main; int currentPower = Mathf.CeilToInt(GetTotalAvailablePower()); string text = currentPower > 0 ? CyNukReactorBuildable.OnHoverPoweredText(NumberFormatter.FormatValue(currentPower), this.ActiveRodCount, this.MaxActiveSlots) : CyNukReactorBuildable.OnHoverNoPowerText(); main.SetInteractText(text); main.SetIcon(HandReticle.IconType.Hand, 1f); }
/// <summary> /// Обработчик первого варианта действия /// </summary> public override void OnFirtsButtonClick(EventManager eventManager) { HideEventButtons(eventManager.FirstButton, eventManager.SecondButton, eventManager.OkButton); eventManager.EventContent.text = "Фильм получился не очень успешным, но вы смотрелись не плохо! " + "Критика фильма обошла вас стороной, можно считать это везением."; var playerInfo = PlayerManager.GetInfo(); var fansIncrease = PlayerManager.GetFansPercentValue(); var income = playerInfo.Money > 200 ? playerInfo.Money / 100 * 2 : 50; if (playerInfo.Fans < fansIncrease) { fansIncrease = playerInfo.Fans; } playerInfo.Fans += fansIncrease; playerInfo.Money += income; eventManager.EventReward.text = $"Пришло {NumberFormatter.FormatValue(fansIncrease)} новых фанатов. Заработано: {NumberFormatter.FormatValue(income)}"; eventManager.StatsManager.UpdateStats(); }
private void UpdateDisplayText(bool force = false) { if (!force) { if (Time.time < textDelay) { return; // Slow down the text update } textDelay = Time.time + TextDelayInterval; } for (int i = 0; i < reactorRodData.Count; i++) { SlotData item = reactorRodData[i]; if (item.InfoDisplay == null) { continue; } if (item.HasPower()) { if (i < this.MaxActiveSlots) { item.InfoDisplay.text = NumberFormatter.FormatValue(item.Charge); item.InfoDisplay.color = Color.white; } else { item.InfoDisplay.text = CyNukReactorBuildable.InactiveRodMsg(); item.InfoDisplay.color = Color.yellow; } } else { item.InfoDisplay.text = CyNukReactorBuildable.NoPoweMessage(); item.InfoDisplay.color = Color.red; } } }
public override void UpdateText() { float displayTemperature = Mathf.Max(chargeHandler.HeatLevel, 24f); if (chargeHandler.IsOverheated) { base.UpperText.TextString = CyclopsNuclearModule.OverheatMsg; base.UpperText.FontSize = 14; } else { base.UpperText.TextString = NumberFormatter.FormatValue(displayTemperature) + "°C"; base.UpperText.FontSize = 20; } base.UpperText.TextColor = chargeHandler.StatusTextColor(); if (battery != null) { base.LowerText.TextString = NumberFormatter.FormatValue(battery._charge); base.MiddleText.TextColor = NumberFormatter.GetNumberColor(battery._charge, CyclopsNuclearModule.NuclearEnergyPotential, 0f); } }
public override void UpdateText() { int count = upgradeHandler.Count; UpperText.TextString = $"{(upgradeHandler.MaxLimitReached ? "Max" : count.ToString())} Charger{(count != 1 ? "s" : string.Empty)}"; UpperText.FontSize = 16; if (upgradeHandler.ChargeMultiplier > 1f) { base.MiddleText.TextString = $"{charger.EnergyStatusText()}\n+{Mathf.CeilToInt((upgradeHandler.ChargeMultiplier - 1f) * 100f)}%"; } else { base.MiddleText.TextString = $"{charger.EnergyStatusText()}"; } base.MiddleText.FontSize = 16; if (battery != null) { base.LowerText.TextString = NumberFormatter.FormatValue(battery._charge); base.LowerText.TextColor = NumberFormatter.GetNumberColor(battery._charge, battery._capacity, 0f); } }
public override string StatusText() { return(this.SolarEnergyAvailable ? NumberFormatter.FormatValue(energyStatus) + "%Θ" : string.Empty); }
private void UpdatePowerIcons() { if (!powerIconsInitialized) { return; } if (Time.time < iconUpdateDelay) { return; } iconUpdateDelay = Time.time + delayInterval; HidePowerIcons(); if (settings.ShowThermometer) { float temperature = Cyclops.GetTemperature(); TemperatureReadout.Text.text = NumberFormatter.FormatValue(temperature) + "°C"; TemperatureReadout.Text.color = GetHeatColor(temperature); TemperatureReadout.SetEnabled(true); } else { TemperatureReadout.SetEnabled(false); } if (settings.HidePowerIcons) { return; } CyclopsCharger[] cyclopsChargers = this.ChargeManager.Chargers; bool isEven = true; for (int i = 0; i < cyclopsChargers.Length; i++) { if (cyclopsChargers[i].ShowStatusIcon) { isEven = !isEven; } } PowerIndicatorIcon[] helmRow = isEven ? HelmIndicatorsEven : HelmIndicatorsOdd; PowerIndicatorIcon[] healthBarRow = isEven ? HealthBarIndicatorsEven : HealthBarIndicatorsOdd; bool showIconsOnHoloDisplay = settings.ShowIconsOnHoloDisplay; bool showIconsWhilePiloting = settings.ShowIconsWhilePiloting; int iconIndex = 0; for (int c = 0; c < cyclopsChargers.Length; c++) { CyclopsCharger charger = cyclopsChargers[c]; if (!charger.ShowStatusIcon) { continue; } PowerIndicatorIcon helmIcon = helmRow[iconIndex]; PowerIndicatorIcon hpIcon = healthBarRow[iconIndex++]; hpIcon.SetEnabled(showIconsOnHoloDisplay); helmIcon.SetEnabled(showIconsWhilePiloting); hpIcon.Icon.sprite = helmIcon.Icon.sprite = charger.StatusSprite(); hpIcon.Text.enabled = powerIconTextVisibility; hpIcon.Text.text = helmIcon.Text.text = charger.StatusText(); if (charger.ProvidingPower) { hpIcon.Text.color = helmIcon.Text.color = charger.StatusTextColor(); } else { hpIcon.Text.color = helmIcon.Text.color = Color.white; } } }
public override string StatusText() { return(this.ThermalEnergyAvailable ? NumberFormatter.FormatValue(this.Temperature) + "°C" : string.Empty); }
private void UpdateStatusIcons() { if (!powerIconsInitialized) { return; } if (Time.time < iconUpdateDelay) { return; } iconUpdateDelay = Time.time + delayInterval; HidePowerIcons(); if (settings.ShowThermometer) { float temperature = Cyclops.GetTemperature(); TemperatureReadout.Text.text = NumberFormatter.FormatValue(temperature) + "°C"; TemperatureReadout.Text.color = GetHeatColor(temperature); TemperatureReadout.SetEnabled(true); } else { TemperatureReadout.SetEnabled(false); } if (settings.HidePowerIcons) { return; } bool isEven = true; for (int i = 0; i < StatusIcons.Count; i++) { if (StatusIcons[i].ShowStatusIcon) { isEven = !isEven; } } IndicatorIcon[] helmRow = isEven ? HelmIndicatorsEven : HelmIndicatorsOdd; IndicatorIcon[] healthBarRow = isEven ? HealthBarIndicatorsEven : HealthBarIndicatorsOdd; bool showIconsOnHoloDisplay = settings.ShowIconsOnHoloDisplay; bool showIconsWhilePiloting = settings.ShowIconsWhilePiloting; int iconIndex = 0; for (int c = 0; c < StatusIcons.Count; c++) { CyclopsStatusIcon statusIcon = StatusIcons[c]; if (!statusIcon.ShowStatusIcon) { continue; } IndicatorIcon helmIcon = helmRow[iconIndex]; IndicatorIcon hpIcon = healthBarRow[iconIndex++]; hpIcon.SetEnabled(showIconsOnHoloDisplay); helmIcon.SetEnabled(showIconsWhilePiloting); hpIcon.Icon.sprite = helmIcon.Icon.sprite = statusIcon.StatusSprite(); hpIcon.Text.enabled = powerIconTextVisibility; hpIcon.Text.text = helmIcon.Text.text = statusIcon.StatusText(); hpIcon.Text.color = helmIcon.Text.color = statusIcon.StatusTextColor(); } }
public override string StatusText() { return(NumberFormatter.FormatValue(this.NuclearHandler.TotalBatteryCharge)); }
public override string StatusText() { return(NumberFormatter.FormatValue(totalBioCharge) + (producingPower ? "+" : string.Empty)); }
internal string ReservePowerText() { return(NumberFormatter.FormatValue(this.AmbientEnergyUpgrade.TotalBatteryCharge)); }
internal string EnergyStatusText() { return(NumberFormatter.FormatValue(energyStatus) + this.PercentNotation); }
/// <summary> /// Отображает информацию о выбранном месте концерта /// </summary> protected override void ParseActionModel() { place = places.First(e => e.Name == PlaceSelector.captionText.text); City.text = place.City; Capacity.text = $"Вместимость: {NumberFormatter.FormatValue(place.Capacity)}"; }