예제 #1
0
        internal static void Postfix(CyclopsHolographicHUD __instance)
        {
            SubRoot cyclops = __instance?.subFire?.subRoot;

            if (cyclops != null)
            {
                MCUServices.Find.AuxCyclopsManager <ShieldPulser>(cyclops)?.PulseShield();
            }
        }
예제 #2
0
        internal static void Postfix(CyclopsHolographicHUD __instance)
        {
            SubRoot cyclops = __instance?.subFire?.subRoot;

            if (cyclops != null)
            {
                var shieldPulser = MCUServices.Find.AuxCyclopsManager <ShieldPulser>(cyclops);

                if (shieldPulser != null)
                {
                    shieldPulser.PulseShield();
                }
                else
                {
                    QuickLogger.Error("Unable to find ShieldPulser AuxCyclopsManager", true);
                }
            }
        }
예제 #3
0
 internal static bool Prefix(CyclopsHolographicHUD __instance)
 {
     return(false); // Should now be handled by SetCyclopsUpgrades
 }
예제 #4
0
        private static void RegisterExternalUpgrades()
        {
            UpgradeManager.RegisterReusableHandlerCreator(() =>
            {
                QuickLogger.Debug("UpgradeHandler Registered: Depth Upgrades Collection");
                return(new CrushDepthUpgradesHandler());
            });

            UpgradeManager.RegisterReusableHandlerCreator(() =>
            {
                QuickLogger.Debug("UpgradeHandler Registered: CyclopsShieldModule");
                return(new UpgradeHandler(TechType.CyclopsShieldModule)
                {
                    OnClearUpgrades = (SubRoot cyclops) => { cyclops.shieldUpgrade = false; },
                    OnUpgradeCounted = (SubRoot cyclops, Equipment modules, string slot) => { cyclops.shieldUpgrade = true; },
                });
            });

            UpgradeManager.RegisterReusableHandlerCreator(() =>
            {
                QuickLogger.Debug("UpgradeHandler Registered: CyclopsSonarModule");
                return(new UpgradeHandler(TechType.CyclopsSonarModule)
                {
                    OnClearUpgrades = (SubRoot cyclops) => { cyclops.sonarUpgrade = false; },
                    OnUpgradeCounted = (SubRoot cyclops, Equipment modules, string slot) => { cyclops.sonarUpgrade = true; },
                });
            });

            UpgradeManager.RegisterReusableHandlerCreator(() =>
            {
                QuickLogger.Debug("UpgradeHandler Registered: CyclopsSeamothRepairModule");
                return(new UpgradeHandler(TechType.CyclopsSeamothRepairModule)
                {
                    OnClearUpgrades = (SubRoot cyclops) => { cyclops.vehicleRepairUpgrade = false; },
                    OnUpgradeCounted = (SubRoot cyclops, Equipment modules, string slot) => { cyclops.vehicleRepairUpgrade = true; },
                });
            });

            UpgradeManager.RegisterReusableHandlerCreator(() =>
            {
                QuickLogger.Debug("UpgradeHandler Registered: CyclopsDecoyModule");
                return(new UpgradeHandler(TechType.CyclopsDecoyModule)
                {
                    OnClearUpgrades = (SubRoot cyclops) => { cyclops.decoyTubeSizeIncreaseUpgrade = false; },
                    OnUpgradeCounted = (SubRoot cyclops, Equipment modules, string slot) => { cyclops.decoyTubeSizeIncreaseUpgrade = true; },
                });
            });

            UpgradeManager.RegisterReusableHandlerCreator(() =>
            {
                QuickLogger.Debug("UpgradeHandler Registered: CyclopsFireSuppressionModule");
                return(new UpgradeHandler(TechType.CyclopsFireSuppressionModule)
                {
                    OnClearUpgrades = (SubRoot cyclops) =>
                    {
                        CyclopsHolographicHUD fss = cyclops.GetComponentInChildren <CyclopsHolographicHUD>();
                        if (fss != null)
                        {
                            fss.fireSuppressionSystem.SetActive(false);
                        }
                    },
                    OnUpgradeCounted = (SubRoot cyclops, Equipment modules, string slot) =>
                    {
                        CyclopsHolographicHUD fss = cyclops.GetComponentInChildren <CyclopsHolographicHUD>();
                        if (fss != null)
                        {
                            fss.fireSuppressionSystem.SetActive(true);
                        }
                    },
                });
            });
        }
        private void AddPowerIcons(CyclopsHelmHUDManager cyclopsHelmHUD)
        {
            cyclopsHelmHUD.powerText.resizeTextForBestFit = true;

            if (totalPowerInfoIcons == 0)
            {
                QuickLogger.Debug($"CyclopsHUDManager 0 Power Info Icons required");
                return;
            }

            QuickLogger.Debug($"CyclopsHUDManager Adding Power Info Icons for '{totalPowerInfoIcons}' CyclopsChargers");
            holographicHUD = cyclopsHelmHUD.subRoot.GetComponentInChildren <CyclopsHolographicHUD>();

            Canvas pilotingCanvas = cyclopsHelmHUD.powerText.canvas;
            Canvas holoCanvas     = holographicHUD.healthBar.canvas;

            const float spacingUnit = 35;
            const float helmzoffset = 0.05f;
            const float helmyoffset = -225;
            const float helmscale   = 1.35f;

            const float healthbarxoffset = 120f;
            const float healthbarzoffset = 0.05f;
            const float healthbaryoffset = -300f;
            const float healthbarscale   = 0.65f;

            /* --- 3-1-2 --- */
            /* ---- 1-2 ---- */

            if (totalPowerInfoIcons == 1)
            {
                HelmIndicatorsOdd       = new Indicator[1];
                HelmIndicatorsEven      = new Indicator[0];
                HealthBarIndicatorsOdd  = new Indicator[1];
                HealthBarIndicatorsEven = new Indicator[0];

                HelmIndicatorsOdd[0]      = CreatePowerIndicatorIcon(pilotingCanvas, 0, helmyoffset, helmzoffset, helmscale);
                HealthBarIndicatorsOdd[0] = CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + 0, healthbaryoffset, healthbarzoffset, healthbarscale);
            }
            else
            {
                int totalIcons = totalPowerInfoIcons;

                if (totalIcons % 2 != 0)
                {
                    totalIcons--;
                }

                HelmIndicatorsOdd       = new Indicator[totalIcons + 1];
                HelmIndicatorsEven      = new Indicator[totalIcons];
                HealthBarIndicatorsOdd  = new Indicator[totalIcons + 1];
                HealthBarIndicatorsEven = new Indicator[totalIcons];

                HelmIndicatorsOdd[0]      = CreatePowerIndicatorIcon(pilotingCanvas, 0, helmyoffset, helmzoffset, helmscale);
                HealthBarIndicatorsOdd[0] = CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + 0, healthbaryoffset, healthbarzoffset, healthbarscale);

                int   index           = 0;
                float healtBarSpacing = 0f;
                float helmSpacing     = 0f;
                do
                {
                    healtBarSpacing += spacingUnit;
                    helmSpacing     += spacingUnit * 2f;

                    // Add even icons first
                    HelmIndicatorsEven[index + 0] = CreatePowerIndicatorIcon(pilotingCanvas, -helmSpacing, helmyoffset, helmzoffset, helmscale);
                    HelmIndicatorsEven[index + 1] = CreatePowerIndicatorIcon(pilotingCanvas, helmSpacing, helmyoffset, helmzoffset, helmscale);

                    HealthBarIndicatorsEven[index + 0] = CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + -healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);
                    HealthBarIndicatorsEven[index + 1] = CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);

                    healtBarSpacing += spacingUnit;
                    helmSpacing     += spacingUnit * 2f;

                    // Add odd icons next
                    HelmIndicatorsOdd[index + 1] = CreatePowerIndicatorIcon(pilotingCanvas, -helmSpacing, helmyoffset, helmzoffset, helmscale);
                    HelmIndicatorsOdd[index + 2] = CreatePowerIndicatorIcon(pilotingCanvas, helmSpacing, helmyoffset, helmzoffset, helmscale);

                    HealthBarIndicatorsOdd[index + 1] = CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + -healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);
                    HealthBarIndicatorsOdd[index + 2] = CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);

                    index += 2;
                } while (totalIcons > index);
            }

            powerIconsInitialized = true;

            QuickLogger.Debug("Linked CyclopsHUDManager to HelmHUD");
        }
        private void AddStatusIcons(CyclopsHelmHUDManager cyclopsHelmHUD)
        {
            TooLateToRegister = true;
            for (int i = 0; i < StatusIconCreators.Count; i++)
            {
                StatusIconCreator creator = StatusIconCreators[i];

                QuickLogger.Debug($"CyclopsHUDManager creating standalone status icon '{creator.StatusIconName}'");
                CyclopsStatusIcon statusIcon = creator.Creator.Invoke(Cyclops);

                if (statusIcon == null)
                {
                    QuickLogger.Warning($"CyclopsHUDManager '{creator.StatusIconName}' was null");
                }
                else
                {
                    StatusIcons.Add(statusIcon);
                    QuickLogger.Debug($"Created CyclopsStatusIcon '{creator.StatusIconName}'");
                }
            }

            int totalPowerInfoIcons = Math.Max(StatusIcons.Count, 1); // Include a minimum of 1 for the vanilla thermal charger

            cyclopsHelmHUD.powerText.resizeTextForBestFit = true;

            QuickLogger.Debug($"CyclopsHUDManager Adding '{totalPowerInfoIcons}' Status Info Icons");
            holographicHUD = cyclopsHelmHUD.subRoot.GetComponentInChildren <CyclopsHolographicHUD>();

            Canvas pilotingCanvas = cyclopsHelmHUD.powerText.canvas;
            Canvas holoCanvas     = holographicHUD.healthBar.canvas;

            const float spacingUnit = 35;
            const float helmzoffset = 0.05f;
            const float helmyoffset = -225;
            const float helmscale   = 1.35f;

            const float healthbarxoffset   = 120f;
            const float thermometerxoffset = healthbarxoffset * 1.96f;
            const float healthbarzoffset   = 0.05f;
            const float healthbaryoffset   = -300f;
            const float healthbarscale     = 0.65f;
            const float thermometerscale   = healthbarscale * 1.25f;

            /* --- 3-1-2 --- */
            /* ---- 1-2 ---- */

            if (totalPowerInfoIcons == 1)
            {
                HelmIndicatorsOdd       = new IndicatorIcon[1];
                HelmIndicatorsEven      = new IndicatorIcon[0];
                HealthBarIndicatorsOdd  = new IndicatorIcon[1];
                HealthBarIndicatorsEven = new IndicatorIcon[0];

                HelmIndicatorsOdd[0]      = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, 0, helmyoffset, helmzoffset, helmscale);
                HealthBarIndicatorsOdd[0] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + 0, healthbaryoffset, healthbarzoffset, healthbarscale);
            }
            else
            {
                int totalIcons = totalPowerInfoIcons;

                if (totalIcons % 2 != 0)
                {
                    totalIcons--;
                }

                HelmIndicatorsOdd       = new IndicatorIcon[totalIcons + 1];
                HelmIndicatorsEven      = new IndicatorIcon[totalIcons];
                HealthBarIndicatorsOdd  = new IndicatorIcon[totalIcons + 1];
                HealthBarIndicatorsEven = new IndicatorIcon[totalIcons];

                HelmIndicatorsOdd[0]      = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, 0, helmyoffset, helmzoffset, helmscale);
                HealthBarIndicatorsOdd[0] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + 0, healthbaryoffset, healthbarzoffset, healthbarscale);

                int   index           = 0;
                float healtBarSpacing = 0f;
                float helmSpacing     = 0f;
                do
                {
                    healtBarSpacing += spacingUnit;
                    helmSpacing     += spacingUnit * 2f;

                    // Add even icons first
                    HelmIndicatorsEven[index + 0] = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, -helmSpacing, helmyoffset, helmzoffset, helmscale);
                    HelmIndicatorsEven[index + 1] = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, helmSpacing, helmyoffset, helmzoffset, helmscale);

                    HealthBarIndicatorsEven[index + 0] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + -healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);
                    HealthBarIndicatorsEven[index + 1] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);

                    healtBarSpacing += spacingUnit;
                    helmSpacing     += spacingUnit * 2f;

                    // Add odd icons next
                    HelmIndicatorsOdd[index + 1] = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, -helmSpacing, helmyoffset, helmzoffset, helmscale);
                    HelmIndicatorsOdd[index + 2] = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, helmSpacing, helmyoffset, helmzoffset, helmscale);

                    HealthBarIndicatorsOdd[index + 1] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + -healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);
                    HealthBarIndicatorsOdd[index + 2] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);

                    index += 2;
                } while (totalIcons > index);
            }

            TemperatureReadout             = IconCreator.CreatePowerIndicatorIcon(holoCanvas, thermometerxoffset, -2.5f, healthbarzoffset, thermometerscale);
            TemperatureReadout.Icon.sprite = CyclopsThermometer ?? SpriteManager.Get(TechType.CyclopsThermalReactorModule);

            powerIconsInitialized = true;

            QuickLogger.Debug("Linked CyclopsHUDManager to HelmHUD");
        }
예제 #7
0
        private void AddPowerIcons(CyclopsHelmHUDManager cyclopsHelmHUD)
        {
            cyclopsHelmHUD.powerText.resizeTextForBestFit = true;

            QuickLogger.Debug($"CyclopsHUDManager Adding Power Info Icons for '{totalPowerInfoIcons}' CyclopsChargers");
            holographicHUD = cyclopsHelmHUD.subRoot.GetComponentInChildren <CyclopsHolographicHUD>();

            Canvas pilotingCanvas = cyclopsHelmHUD.powerText.canvas;
            Canvas holoCanvas     = holographicHUD.healthBar.canvas;

            const float spacingUnit = 35;
            const float helmzoffset = 0.05f;
            const float helmyoffset = -225;
            const float helmscale   = 1.35f;

            const float healthbarxoffset   = 120f;
            const float thermometerxoffset = healthbarxoffset * 1.96f;
            const float healthbarzoffset   = 0.05f;
            const float healthbaryoffset   = -300f;
            const float healthbarscale     = 0.65f;
            const float thermometerscale   = healthbarscale * 1.25f;

            /* --- 3-1-2 --- */
            /* ---- 1-2 ---- */

            if (totalPowerInfoIcons == 1)
            {
                HelmIndicatorsOdd       = new PowerIndicatorIcon[1];
                HelmIndicatorsEven      = new PowerIndicatorIcon[0];
                HealthBarIndicatorsOdd  = new PowerIndicatorIcon[1];
                HealthBarIndicatorsEven = new PowerIndicatorIcon[0];

                HelmIndicatorsOdd[0]      = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, 0, helmyoffset, helmzoffset, helmscale);
                HealthBarIndicatorsOdd[0] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + 0, healthbaryoffset, healthbarzoffset, healthbarscale);
            }
            else
            {
                int totalIcons = totalPowerInfoIcons;

                if (totalIcons % 2 != 0)
                {
                    totalIcons--;
                }

                HelmIndicatorsOdd       = new PowerIndicatorIcon[totalIcons + 1];
                HelmIndicatorsEven      = new PowerIndicatorIcon[totalIcons];
                HealthBarIndicatorsOdd  = new PowerIndicatorIcon[totalIcons + 1];
                HealthBarIndicatorsEven = new PowerIndicatorIcon[totalIcons];

                HelmIndicatorsOdd[0]      = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, 0, helmyoffset, helmzoffset, helmscale);
                HealthBarIndicatorsOdd[0] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + 0, healthbaryoffset, healthbarzoffset, healthbarscale);

                int   index           = 0;
                float healtBarSpacing = 0f;
                float helmSpacing     = 0f;
                do
                {
                    healtBarSpacing += spacingUnit;
                    helmSpacing     += spacingUnit * 2f;

                    // Add even icons first
                    HelmIndicatorsEven[index + 0] = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, -helmSpacing, helmyoffset, helmzoffset, helmscale);
                    HelmIndicatorsEven[index + 1] = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, helmSpacing, helmyoffset, helmzoffset, helmscale);

                    HealthBarIndicatorsEven[index + 0] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + -healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);
                    HealthBarIndicatorsEven[index + 1] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);

                    healtBarSpacing += spacingUnit;
                    helmSpacing     += spacingUnit * 2f;

                    // Add odd icons next
                    HelmIndicatorsOdd[index + 1] = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, -helmSpacing, helmyoffset, helmzoffset, helmscale);
                    HelmIndicatorsOdd[index + 2] = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, helmSpacing, helmyoffset, helmzoffset, helmscale);

                    HealthBarIndicatorsOdd[index + 1] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + -healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);
                    HealthBarIndicatorsOdd[index + 2] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);

                    index += 2;
                } while (totalIcons > index);
            }

            TemperatureReadout             = IconCreator.CreatePowerIndicatorIcon(holoCanvas, thermometerxoffset, -2.5f, healthbarzoffset, thermometerscale);
            TemperatureReadout.Icon.sprite = CyclopsThermometer ?? SpriteManager.Get(TechType.CyclopsThermalReactorModule);

            powerIconsInitialized = true;

            QuickLogger.Debug("Linked CyclopsHUDManager to HelmHUD");
        }