} = TechType.SeamothElectricalDefense; // This will require the Seamoth's Perimeter Defense to unlock public override GameObject GetGameObject() { var prefab = CraftData.GetPrefabForTechType(this.BaseType); CyclopsUpgradeConsoleHUDManager cyclopsUpgradeConsole = UnityEngine.Object.Instantiate(original: prefab).GetComponent <SeamothElectricalDefense>(); return(UnityEngine.Object.Instantiate(prefab)); }
public static bool Prefix(ref CyclopsUpgradeConsoleHUDManager __instance) { CyclopsHUDManager hudMgr = CyclopsManager.GetHUDManager(__instance.subRoot); if (hudMgr == null) { return(true); } hudMgr.UpdateConsoleHUD(__instance); return(false); }
public static void Postfix(ref CyclopsUpgradeConsoleHUDManager __instance) { var cyclopsManager = CyclopsManager.GetAllManagers(__instance.subRoot); if (cyclopsManager == null) { return; } cyclopsManager.UpgradeManager.SyncUpgradeConsoles(); cyclopsManager.PowerManager.UpdateConsoleHUD(__instance); }
/// <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; } } }
public static void Postfix(ref CyclopsUpgradeConsoleHUDManager __instance) { UpgradeConsole upgradeConsole = __instance.subRoot.upgradeConsole; if (upgradeConsole == null) { return; // safety check } Equipment modules = upgradeConsole.modules; // This method was put here because it's hit much less often than UpdateThermalReactorCharge UpgradeConsoleCache.SyncUpgradeConsoles(__instance.subRoot, __instance.subRoot.GetAllComponentsInChildren <AuxUpgradeConsole>()); PowerManager.UpdateConsoleHUD(__instance, modules, UpgradeConsoleCache.AuxUpgradeConsoles); }
public static bool Prefix(ref CyclopsUpgradeConsoleHUDManager __instance) { PdaOverlayManager.UpdateIconOverlays(); CyclopsHUDManager hudMgr = CyclopsManager.GetManager(__instance.subRoot)?.HUD; if (hudMgr == null) { return(true); } hudMgr.SlowUpdate(__instance); return(false); }
/// <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> /// Updates the console HUD using data from all equipment modules across all upgrade consoles. /// </summary> /// <param name="hudManager">The console HUD manager.</param> /// <param name="coreModules">The core modules.</param> /// <param name="auxUpgradeConsoles">The aux upgrade consoles.</param> internal static void UpdateConsoleHUD(CyclopsUpgradeConsoleHUDManager hudManager, Equipment coreModules, IList <AuxUpgradeConsole> auxUpgradeConsoles) { int currentReservePower = GetTotalReservePower(coreModules, auxUpgradeConsoles); float currentBatteryPower = hudManager.subRoot.powerRelay.GetPower(); if (currentReservePower > 0f) { hudManager.energyCur.color = Color.cyan; // Distinct color for when reserve power is available } else { hudManager.energyCur.color = Color.white; // Normal color } int totalPower = Mathf.CeilToInt(currentBatteryPower + currentReservePower); hudManager.energyCur.text = IntStringCache.GetStringForInt(totalPower); NuclearModuleConfig.SetCyclopsMaxPower(hudManager.subRoot.powerRelay.GetMaxPower()); }
/// <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 UpdateConsoleHUD(CyclopsUpgradeConsoleHUDManager hudManager) { int currentReservePower = GetTotalReservePower(); float currentBatteryPower = this.Cyclops.powerRelay.GetPower(); if (currentReservePower > 0) { hudManager.energyCur.color = Color.cyan; // Distinct color for when reserve power is available } else { hudManager.energyCur.color = Color.white; // Normal color } int TotalPowerUnits = Mathf.CeilToInt(currentBatteryPower + currentReservePower); hudManager.energyCur.text = IntStringCache.GetStringForInt(TotalPowerUnits); NuclearModuleConfig.SetCyclopsMaxPower(this.Cyclops.powerRelay.GetMaxPower()); }
public static void UpdatePowerDisplays(CyclopsUpgradeConsoleHUDManager consoleHUDManager) { PdaOverlayManager.UpdateIconOverlays(); CyclopsManager.GetManager(ref consoleHUDManager.subRoot)?.HUD?.SlowUpdate(consoleHUDManager); }