Exemplo n.º 1
0
 public static void OnLoad()
 {
     PUtil.InitLibrary();
     POptions.RegisterOptions(typeof(ThermalTooltipsOptions));
     PLocalization.Register();
     TooltipInstance = null;
 }
Exemplo n.º 2
0
 public static void OnLoad()
 {
     bicCompat        = null;
     buildingInstance = new BuildThermalTooltip();
     PUtil.InitLibrary();
     POptions.RegisterOptions(typeof(ThermalTooltipsOptions));
     PLocalization.Register();
     TooltipInstance = null;
     PUtil.RegisterPatchClass(typeof(ThermalTooltipsPatches));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Sums up heat energy and reports the total heat energy.
        /// </summary>
        /// <param name="values">The info cards to add up.</param>
        /// <returns>A string describing their total heat energy.</returns>
        private static string SumHeatEnergy(string _, List <float> values)
        {
            float sum = 0;

            foreach (var value in values)
            {
                sum += value;
            }
            return(string.Format(TTS.HEAT_ENERGY, ExtendedThermalTooltip.DoScientific(sum),
                                 STRINGS.UI.UNITSUFFIXES.HEAT.KDTU.text.Trim()) + TTS.SUM);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Sums up thermal masses and reports the total thermal mass.
        /// </summary>
        /// <param name="values">The info cards to add up.</param>
        /// <returns>A string describing their total thermal mass.</returns>
        private static string SumThermalMass(string _, List <float> values)
        {
            float sum = 0;

            foreach (var value in values)
            {
                sum += value;
            }
            return(string.Format(ThermalTooltipsStrings.THERMAL_MASS, ExtendedThermalTooltip.
                                 DoScientific(sum), STRINGS.UI.UNITSUFFIXES.HEAT.KDTU.text.Trim(), GameUtil.
                                 GetTemperatureUnitSuffix()?.Trim()) + ThermalTooltipsStrings.SUM);
        }
Exemplo n.º 5
0
 public override void OnLoad(Harmony harmony)
 {
     bicCompat = null;
     base.OnLoad(harmony);
     buildingInstance = new BuildThermalTooltip();
     PUtil.InitLibrary();
     new POptions().RegisterOptions(this, typeof(ThermalTooltipsOptions));
     LocString.CreateLocStringKeys(typeof(ThermalTooltipsStrings.UI));
     new PLocalization().Register();
     TooltipInstance = null;
     new PPatchManager(harmony).RegisterPatchClass(typeof(ThermalTooltipsPatches));
     new PVersionCheck().Register(this, new SteamVersionChecker());
 }
Exemplo n.º 6
0
        internal static void SetupTooltips()
        {
            var options = POptions.ReadSettings <ThermalTooltipsOptions>() ??
                          new ThermalTooltipsOptions();

            // Check for DisplayAllTemps
            if (PPatchTools.GetTypeSafe("DisplayAllTemps.State", "DisplayAllTemps") !=
                null)
            {
                // Let Display All Temps take over display (ironically setting AllUnits
                // to FALSE) since it patches GetFormattedTemperature
                PUtil.LogDebug("DisplayAllTemps compatibility activated");
                options.AllUnits = false;
            }
            TooltipInstance = new ExtendedThermalTooltip(options, bicCompat);
            PUtil.LogDebug("Created ExtendedThermalTooltip");
        }
Exemplo n.º 7
0
            /// <summary>
            /// Applied after OnPrefabInit runs.
            /// </summary>
            internal static void Postfix()
            {
                var options = POptions.ReadSettings <ThermalTooltipsOptions>();

                // Check for DisplayAllTemps
                try {
                    if (Type.GetType("DisplayAllTemps.State, DisplayAllTemps", false) != null)
                    {
                        // Let Display All Temps take over display (ironically setting AllUnits
                        // to FALSE) since it patches GetFormattedTemperature
                        PUtil.LogDebug("DisplayAllTemps compatibility activated");
                        options.AllUnits = false;
                    }
                } catch { }
                TooltipInstance = new ExtendedThermalTooltip(options);
                PUtil.LogDebug("Created ExtendedThermalTooltip");
            }
Exemplo n.º 8
0
 internal static void CleanupTooltips()
 {
     PUtil.LogDebug("Destroying ExtendedThermalTooltip");
     buildingInstance?.ClearDef();
     TooltipInstance = null;
 }