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(); } }
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; } } }