コード例 #1
0
        public override string GetInfo()
        {
            double baseRate = 0d;

            for (int i = 0; i < inputs.Count; i++)
            {
                if (inputs[i].ResourceName == FuelName)
                {
                    baseRate = inputs[i].Ratio;
                }
            }
            if (HeatGeneration.Evaluate(100f) == 0)
            {
                return
                    (Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatFissionEngine_PartInfo_Basic",
                                      ThrottleIncreaseRate.ToString("F0"),
                                      FindTimeRemaining(this.part.Resources.Get(PartResourceLibrary.Instance.GetDefinition(FuelName).id).amount, baseRate),
                                      NominalTemperature.ToString("F0"),
                                      CriticalTemperature.ToString("F0"),
                                      MaximumTemperature.ToString("F0")));
            }
            if (GeneratesElectricity)
            {
                return
                    (Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatFissionEngine_PartInfo",
                                      ElectricalGeneration.Evaluate(100f).ToString("F0"),
                                      FindTimeRemaining(this.part.Resources.Get(PartResourceLibrary.Instance.GetDefinition(FuelName).id).amount, baseRate),
                                      (HeatGeneration.Evaluate(100f) - ElectricalGeneration.Evaluate(100f)).ToString("F0"),
                                      NominalTemperature.ToString("F0"),
                                      NominalTemperature.ToString("F0"),
                                      CriticalTemperature.ToString("F0"),
                                      MaximumTemperature.ToString("F0"),
                                      ThrottleIncreaseRate.ToString("F0"),
                                      MinimumThrottle.ToString("F0")));
            }
            else
            {
                return
                    (Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatFissionEngine_PartInfo_NoPower",
                                      FindTimeRemaining(this.part.Resources.Get(PartResourceLibrary.Instance.GetDefinition(FuelName).id).amount, baseRate),
                                      HeatGeneration.Evaluate(100f).ToString("F0"),
                                      NominalTemperature.ToString("F0"),
                                      NominalTemperature.ToString("F0"),
                                      CriticalTemperature.ToString("F0"),
                                      MaximumTemperature.ToString("F0"),
                                      ThrottleIncreaseRate.ToString("F0"),
                                      MinimumThrottle.ToString("F0")));
            }
        }
コード例 #2
0
        static void Main()
        {
            CurrentTemperature = BrainPad.TemperatureSensor.ReadTemperatureInFahrenheit();
            MinimumTemperature = CurrentTemperature;
            MaximumTemperature = CurrentTemperature;

            while (true)
            {
                CurrentTemperature = BrainPad.TemperatureSensor.ReadTemperatureInFahrenheit();
                if (CurrentTemperature > MaximumTemperature)
                {
                    MaximumTemperature = CurrentTemperature;
                }
                if (CurrentTemperature < MinimumTemperature)
                {
                    MinimumTemperature = CurrentTemperature;
                }

                BrainPad.Display.Clear();

                BrainPad.Display.DrawSmallText(39, 0, "Current");
                BrainPad.Display.DrawText(37, 12, (CurrentTemperature.ToString("F1")));

                BrainPad.Display.DrawSmallText(2, 34, "Minimum");
                BrainPad.Display.DrawText(0, 46, (MinimumTemperature.ToString("F1")));

                BrainPad.Display.DrawSmallText(72, 34, "Maximum");
                BrainPad.Display.DrawText(70, 46, (MaximumTemperature.ToString("F1")));

                if ((MaximumTemperature - MinimumTemperature) > 0)
                {
                    TemperaturePosition = (CurrentTemperature - MinimumTemperature) / (MaximumTemperature - MinimumTemperature) * 127;
                    BrainPad.Display.DrawLine(0, 63, (int)TemperaturePosition, 63);
                    BrainPad.Display.DrawPoint(0, 62);
                    BrainPad.Display.DrawPoint(127, 62);

                    BrainPad.LightBulb.TurnColor(TemperaturePosition / 32, 0, (127 - TemperaturePosition) / 16);
                }

                BrainPad.Display.RefreshScreen();
                BrainPad.Wait.Milliseconds(250);
            }
        }