Beispiel #1
0
        public void SetValues(string metricName, float ratio, float moles, AcuStatus molStatus)
        {
            var percentString = $"{ratio, 10:P}";
            var molString     = GUI_Acu.ColorStringByStatus($"{moles, 8:N}", molStatus);

            label.SetValueServer($"| {metricName, -18} | {percentString, -13} | {molString, -34} |");
            label.SetValueServer($"| {metricName, -18} | {percentString, -13} | {molString, -34} |");
        }
        public void UpdateText()
        {
            string disabledColor = GUI_Acu.GetHtmlColorByStatus(AcuStatus.Off);

            var onStr = vent.IsTurnedOn
                                        ? $"{m}[ On ]{um} Off  "
                                        : $"  On {m}[ Off ]{um}";
            var modeStr = vent.OperatingMode == AirVent.Mode.Out
                                        ? $"{m}[ Pressurizing ]{um}   Siphoning  "
                                        : $"  Pressurizing   {m}[ Siphoning ]{um}";
            var internalStr = vent.InternalEnabled
                                        ? $"{m}[   Internal   ]{um}"
                                        : "    Internal    ";
            var externalStr = vent.ExternalEnabled
                                        ? $"{m}[ External  ]{um}"
                                        : "  External   ";
            var internalTargetStr = vent.InternalTarget.ToString("0.###");
            var externalTargetStr = vent.ExternalTarget.ToString("0.###");
            var internalResetStr  = vent.InternalEnabled == false || vent.InternalTarget.Approx(0)
                                        ? $"<color=#{disabledColor}>< Reset ></color>"
                                        : "< Reset >";
            var externalResetStr = vent.ExternalEnabled == false || vent.ExternalTarget.Approx(101.325f)
                                        ? $"<color=#{disabledColor}>< Reset ></color>"
                                        : "< Reset >";

            var internalTargetLine = $"Internal Target: {internalTargetStr, 9} kPa        {internalResetStr}";

            if (vent.InternalEnabled == false)
            {
                internalTargetLine = $"<color=#{disabledColor}>{internalTargetLine}</color>";
            }
            var externalTargetLine = $"External Target: {externalTargetStr, 9} kPa        {externalResetStr}";

            if (vent.ExternalEnabled == false)
            {
                externalTargetLine = $"<color=#{disabledColor}>{externalTargetLine}</color>";
            }

            // "Vent - " as per NameValidator tool.
            string ventName = vent.gameObject.name;

            ventName = ventName.StartsWith("Vent - ") ? ventName.Substring("Vent - ".Length) : ventName;

            string str =
                "---------------------------------------------------\n" +
                $"| {ventName, -35} {onStr}|\n" +
                "|                                                 |\n" +
                $"| Mode:       {modeStr}      |\n" +
                $"| Regulator:  {internalStr} {externalStr}      |\n" +
                "|                                                 |\n" +
                $"| {externalTargetLine} |\n" +
                $"| {internalTargetLine} |\n" +
                "---------------------------------------------------\n";

            label.SetValueServer(str);
        }
        private void UpdateLabels()
        {
            string pressureText    = "? kPa";
            string temperatureText = "? °C";
            string compositionText = "Unknown";

            if (Acu.AtmosphericAverage.SampleSize > 0)
            {
                pressureText    = $"{Acu.AtmosphericAverage.Pressure, 0:N3} kPa";
                temperatureText = $"{TemperatureUtils.FromKelvin(Acu.AtmosphericAverage.Temperature, TemeratureUnits.C), 0:N1} °C";
                compositionText = Acu.CompositionStatus.ToString();
            }

            pressureLabel.SetValueServer(
                $"Pressure:    {GUI_Acu.ColorStringByStatus(pressureText, Acu.PressureStatus)}");
            temperatureLabel.SetValueServer(
                $"Temperature: {GUI_Acu.ColorStringByStatus(temperatureText, Acu.TemperatureStatus)}");
            compositionLabel.SetValueServer(
                $"Composition: {GUI_Acu.ColorStringByStatus(compositionText, Acu.CompositionStatus)}");
        }
 public void SetValues(GUI_Acu acuUi, Scrubber scrubber)
 {
     this.acuUi    = acuUi;
     this.scrubber = scrubber;
     UpdateText();
 }
 public void SetValues(GUI_Acu acuUi, AirVent vent)
 {
     this.acuUi = acuUi;
     this.vent  = vent;
     UpdateText();
 }