diff --git a/KSP_MOCR/Classes/MocrScreen.cs b/KSP_MOCR/Classes/MocrScreen.cs index 46e773b..1c74ba6 100644 --- a/KSP_MOCR/Classes/MocrScreen.cs +++ b/KSP_MOCR/Classes/MocrScreen.cs @@ -59,19 +59,19 @@ public static MocrScreen Create(int id, Screen form) { case 0: scr = new ConnectionScreen(form); - name = ""; + name = "HELP"; break; case 1: scr = new AscentScreen(form); - name = ""; + name = "OVERVIEW"; break; case 2: scr = new BoosterScreen(form); - name = ""; + name = "BOOSTER"; break; case 3: scr = new ResourcesScreen(form); - name = ""; + name = "CONSUMABLES"; break; case 4: scr = new OrbitView(form); @@ -79,32 +79,36 @@ public static MocrScreen Create(int id, Screen form) break; case 5: scr = new SingleOrbit(form); - name = ""; + name = "ORBITAL DATA"; break; case 6: scr = new Electrical(form); name = "ELECTRICAL SYSTEMS"; break; + case 7: + scr = new Temperature(form); + name = "TEMPERATURE / ABLATORS / RADIATORS"; + break; case 8: scr = new MapScreen(form); - name = ""; + name = "MAP"; break; case 9: Console.WriteLine("MAKING TEST"); scr = new TestScreen(form); - name = ""; + name = "TEST"; break; case 11: scr = new StreamsScreen(form); - name = ""; + name = "CURRENT STREAMS FROM KRPC"; break; case 12: scr = new DataStorageScreen(form); - name = ""; + name = "CURRENT DATA IN DATA-STORAGE (PySSSMQ)"; break; case 40: scr = new FDO(form); - name = ""; + name = "FIDO"; break; case 50: scr = new Terrain(form); @@ -170,10 +174,10 @@ public static MocrScreen Create(int id, Screen form) scr = new CrtTest2(form, 5); name = "CRT TEST SCREEN #2"; break; - case 100: + /*case 100: scr = new Pilot1(form); name = ""; - break; + break;*/ case 101: scr = new FDAIScreen(form); name = "FDAI"; diff --git a/KSP_MOCR/Classes/helper.cs b/KSP_MOCR/Classes/helper.cs index 78ff54f..a370170 100644 --- a/KSP_MOCR/Classes/helper.cs +++ b/KSP_MOCR/Classes/helper.cs @@ -752,7 +752,7 @@ static public String toFixed(double? d, int p, bool showPlus) else { double d2 = d.Value; - String b = Math.Round(d2).ToString(format); + String b = Math.Floor(d2).ToString(format); r = Math.Round(d2, p).ToString(format); // Check that d isn't whole number, if so; add '.' diff --git a/KSP_MOCR/Form1.cs b/KSP_MOCR/Form1.cs index 913e3e4..aee4638 100644 --- a/KSP_MOCR/Form1.cs +++ b/KSP_MOCR/Form1.cs @@ -16,8 +16,6 @@ using System.IO; using System.Net; using System.Threading; -using IronPython.Hosting; -using Microsoft.Scripting.Hosting; using System.Diagnostics; using Microsoft.Win32; @@ -32,7 +30,6 @@ public partial class Form1 : Form public PySSSMQ_client pySSSMQ = new PySSSMQ_client(); public PySSSMQ_Handler pySSSMQ_handler; - public ScriptSource pySSSMQ_server; public DataStorage dataStorage; diff --git a/KSP_MOCR/KSP_MOCR.csproj b/KSP_MOCR/KSP_MOCR.csproj index fb3473e..a0cea36 100644 --- a/KSP_MOCR/KSP_MOCR.csproj +++ b/KSP_MOCR/KSP_MOCR.csproj @@ -137,6 +137,7 @@ + diff --git a/KSP_MOCR/Screens/ConnectionScreen.cs b/KSP_MOCR/Screens/ConnectionScreen.cs index c4c39d0..ecea8ac 100644 --- a/KSP_MOCR/Screens/ConnectionScreen.cs +++ b/KSP_MOCR/Screens/ConnectionScreen.cs @@ -19,7 +19,7 @@ public ConnectionScreen(Screen form) this.screenStreams = form.streamCollection; this.width = 60; - this.height = 30; + this.height = 35; } public override void updateLocalElements(object sender, EventArgs e) @@ -59,7 +59,7 @@ public override void makeElements() for (int i = 0; i < 1; i++) screenInputs.Add(null); // Initialize Inputs screenInputs[0] = Helper.CreateInput(-2, -2, 1, 2); // Every page must have an input to capture keypresses on Unix - screenLabels[4] = Helper.CreateLabel(0, 0, 60, 30); // Help text + screenLabels[4] = Helper.CreateLabel(0, 0, 60, 35); // Help text screenLabels[4].Text = "╥─── HELP ───\n" + "║\n" + "║ To switch between the different screens,\n" @@ -69,12 +69,12 @@ public override void makeElements() + "║ 0 - HELP\n" + "║ 1 - ASCENT\n" + "║ 2 - BOOSTER\n" - + "║ 3 - RESOURCES\n" + + "║ 3 - CONSUMABLES\n" + "║ 4 - ORBIT VIEW\n" + "║ 5 - ORBIT DATA\n" + "║ 6 - ELECTRICAL SYSTEMS\n" + + "║ 7 - TEMPERATURE / ABLATORS / RADIATORS\n" + "║ 8 - MAP VIEW\n" - + "║ 9 - FONT/ALIGNMENT TEST\n" + "║ 12 - DATA STORAGE (PySSSMQ)\n" + "║ 50 - TERRAIN GRAPH\n" + "║ 51 - ALTITUDE / INERTIAL VELOCITY - GRAPH\n" @@ -83,12 +83,15 @@ public override void makeElements() + "║ 54 - ALTITUDE / RANGE - GRAPH\n" + "║ 55 - ALTITUDE / VERTICAL SPEED (H / HDOT) - GRAPH\n" + "║ 56 - FLIGHT PATH ANGLE / INERTIAL VELOCITY - GRAPH\n" - + "║ 100 - PILOT\n" + + "║ 101 - FDAI\n" + + "║ 102 - DSKY\n" + "║\n" + "║ 201-215 - STATUS REPORT (Requires PySSSMQ connection)\n" + "║ 220 - STATUS PANEL (Requires PySSSMQ connection)\n" + "║\n" - + "║\n"; + + "║\n" + + "║ 9 - FONT/ALIGNMENT TEST\n" + + "║ 99 - CRT FONT/ALIGNMENT TEST\n"; screenLabels[5] = Helper.CreateLabel(0, 0, 60, 2, "──────────────────── CONNECTION DETAILS ────────────────────"); // Connection Header} diff --git a/KSP_MOCR/Screens/Resources.cs b/KSP_MOCR/Screens/Resources.cs index 724d4e2..4e8a892 100644 --- a/KSP_MOCR/Screens/Resources.cs +++ b/KSP_MOCR/Screens/Resources.cs @@ -1,100 +1,112 @@ using System; using System.Collections.Generic; using KRPC.Client.Services.KRPC; - +using KRPC.Client.Services.SpaceCenter; + namespace KSP_MOCR { class ResourcesScreen : MocrScreen { + Parts parts; + List> partStrings = new List>(); + public ResourcesScreen(Screen form) { this.form = form; - this.chartData = form.form.chartData; - - screenStreams = new StreamCollection(form.connection); - this.updateRate = 1000; - - this.width = 120; - this.height = 30; + screenStreams = form.streamCollection; + + this.charSize = false; + this.width = 656; + this.height = 494; + this.updateRate = 1000; } public override void updateLocalElements(object sender, EventArgs e) { - - // Re-usable data variable for graph data - //List> data = new List>(); + screenLabels[2].Text = "LT: " + Helper.timeString(DateTime.Now.TimeOfDay.TotalSeconds); if (form.form.connected && form.form.krpc.CurrentGameScene == GameScene.Flight) { double MET = screenStreams.GetData(DataType.vessel_MET); - float maxTotFuel = screenStreams.GetData(DataType.resource_total_max_liquidFuel); - float curTotFuel = screenStreams.GetData(DataType.resource_total_amount_liquidFuel); - float maxStgFuel = screenStreams.GetData(DataType.resource_stage_max_liquidFuel); - float curStgFuel = screenStreams.GetData(DataType.resource_stage_amount_liquidFuel); - - float maxTotOx = screenStreams.GetData(DataType.resource_total_max_oxidizer); - float curTotOx = screenStreams.GetData(DataType.resource_total_amount_oxidizer); - float maxStgOx = screenStreams.GetData(DataType.resource_stage_max_oxidizer); - float curStgOx = screenStreams.GetData(DataType.resource_stage_amount_oxidizer); - - float maxTotMono = screenStreams.GetData(DataType.resource_total_max_monoPropellant); - float curTotMono = screenStreams.GetData(DataType.resource_total_amount_monoPropellant); - float maxStgMono = screenStreams.GetData(DataType.resource_stage_max_monoPropellant); - float curStgMono = screenStreams.GetData(DataType.resource_stage_amount_monoPropellant); - - float maxTotElec = screenStreams.GetData(DataType.resource_total_max_electricCharge); - float curTotElec = screenStreams.GetData(DataType.resource_total_amount_electricCharge); - float maxStgElec = screenStreams.GetData(DataType.resource_stage_max_electricCharge); - float curStgElec = screenStreams.GetData(DataType.resource_stage_amount_electricCharge); - - screenLabels[1].Text = " LT: " + Helper.timeString(DateTime.Now.TimeOfDay.TotalSeconds); - screenLabels[2].Text = "MET: " + Helper.timeString(MET, 3); - - String mTF = Helper.prtlen(Math.Round(maxTotFuel).ToString(), 7); - String cTF = Helper.prtlen(Math.Round(curTotFuel).ToString(), 7); - String pTF = Helper.prtlen(Math.Floor((curTotFuel / maxTotFuel) * 100).ToString(), 4) + "% "; - String mSF = Helper.prtlen(Math.Round(maxStgFuel).ToString(), 7); - String cSF = Helper.prtlen(Math.Round(curStgFuel).ToString(), 7); - String pSF = Helper.prtlen(Math.Floor((curStgFuel / maxStgFuel) * 100).ToString(), 4) + "% "; - String rF = "0"; - - String mTO = Helper.prtlen(Math.Round(maxTotFuel).ToString(), 7); - String cTO = Helper.prtlen(Math.Round(curTotFuel).ToString(), 7); - String pTO = Helper.prtlen(Math.Floor((curTotFuel / maxTotFuel) * 100).ToString(), 4) + "% "; - String mSO = Helper.prtlen(Math.Round(maxStgFuel).ToString(), 7); - String cSO = Helper.prtlen(Math.Round(curStgFuel).ToString(), 7); - String pSO = Helper.prtlen(Math.Floor((curStgFuel / maxStgFuel) * 100).ToString(), 4) + "% "; - String rO = "0"; - String mTM = Helper.prtlen(Helper.toFixed(maxTotMono,2), 7); - String cTM = Helper.prtlen(Helper.toFixed(curTotMono,2), 7); - String pTM = Helper.prtlen(Math.Floor((curTotMono / maxTotMono) * 100).ToString(), 4) + "% "; - String mSM = Helper.prtlen(Helper.toFixed(maxStgMono,2), 7); - String cSM = Helper.prtlen(Helper.toFixed(curStgMono,2), 7); - String pSM = Helper.prtlen(Math.Floor((curStgMono / maxStgMono) * 100).ToString(), 4) + "% "; - String rM = "0"; - - String mTE = Helper.prtlen(Helper.toFixed(maxTotElec, 2), 7); - String cTE = Helper.prtlen(Helper.toFixed(curTotElec, 2), 7); - String pTE = Helper.prtlen(Math.Floor((curTotElec / maxTotElec) * 100).ToString(), 4) + "% "; - String mSE = Helper.prtlen(Helper.toFixed(maxStgElec, 2), 7); - String cSE = Helper.prtlen(Helper.toFixed(curStgElec, 2), 7); - String pSE = Helper.prtlen(Math.Floor((curStgElec / maxStgElec) * 100).ToString(), 4) + "% "; - String rE = "0"; - - - - screenLabels[6].Text = " FUEL ║" + mSF + "│" + cSF + "│" + pSF + "║" + mTF + "│" + cTF + "│" + pTF + "║" + rF; - screenLabels[7].Text = " OXIDIZER ║" + mSO + "│" + cSO + "│" + pSO + "║" + mTO + "│" + cTO + "│" + pTO + "║" + rO; - screenLabels[9].Text = " MONOPROP ║" + mSM + "│" + cSM + "│" + pSM + "║" + mTM + "│" + cTM + "│" + pTM + "║" + rM; - screenLabels[11].Text = "ELECTRICITY ║" + mSE + "│" + cSE + "│" + pSE + "║" + mTE + "│" + cTE + "│" + pTE + "║" + rE; - - /* - data = new List>(); - data.Add(chartData["altitudeSpeed"]); - screenCharts[0].setData(data, false); - */ + screenLabels[3].Text = "MET: " + Helper.timeString(MET, 3); + + parts = screenStreams.GetData(DataType.vessel_parts); + + partStrings.Clear(); + + double totFuel = 0; + double totLox = 0; + double totMono = 0; + + if (parts != null) + { + IList partList = parts.All; + foreach (Part p in partList) + { + Resources r = p.Resources; + + if (r.HasResource("MonoPropellant") || r.HasResource("LiquidFuel") || r.HasResource("Oxidizer")) + { + float fuelA = r.Amount("LiquidFuel"); + float loxA = r.Amount("Oxidizer"); + float monoA = r.Amount("MonoPropellant"); + + totFuel += fuelA; + totLox += loxA; + totMono += monoA; + + float fuelM = r.Max("LiquidFuel"); + float loxM = r.Max("Oxidizer"); + float monoM = r.Max("MonoPropellant"); + + string name = Helper.prtlen(p.Title, 40).ToUpper(); + int stage = p.DecoupleStage; + string stageStr = Helper.prtlen(stage.ToString(), 3, Helper.Align.RIGHT); + string fuel = Helper.prtlen(Helper.toFixed(fuelA, 1), 8, Helper.Align.RIGHT); + string lox = Helper.prtlen(Helper.toFixed(loxA, 1), 8, Helper.Align.RIGHT); + string mono = Helper.prtlen(Helper.toFixed(monoA, 2), 7, Helper.Align.RIGHT); + + float fuelP = (fuelA / fuelM) * 100f; + if (fuelM == 0) fuelP = 0; + float loxP = (loxA / loxM) * 100f; + if (loxM == 0) loxP = 0; + float monoP = (monoA / monoM) * 100f; + if (monoM == 0) monoP = 0; + + string fuelS = Helper.prtlen(Helper.toFixed(fuelP, 2), 7, Helper.Align.RIGHT) + "%"; + string loxS = Helper.prtlen(Helper.toFixed(loxP, 2), 7, Helper.Align.RIGHT) + "%"; + string monoS = Helper.prtlen(Helper.toFixed(monoP, 2), 7, Helper.Align.RIGHT) + "%"; + + partStrings.Add(new Tuple(stage, stageStr + " " + name + fuel + fuelS + lox + loxS + mono + monoS)); + } + } + } + + // SORT THE LIST + partStrings.Sort((x, y) => y.Item1.CompareTo(x.Item1)); + + for (int i = 5; i < 31; i++) + { + if (partStrings.Count > i - 5) + { + screenLabels[i].Text = partStrings[i - 5].Item2; + } + else + { + screenLabels[i].Text = ""; + } + } + + // PRINT TOTALS (123456.0 123456.0 12345.00) + string totF = Helper.prtlen(Helper.toFixed(totFuel, 1), 11, Helper.Align.RIGHT); + string totL = Helper.prtlen(Helper.toFixed(totLox, 1), 11, Helper.Align.RIGHT); + string totM = Helper.prtlen(Helper.toFixed(totMono, 2), 11, Helper.Align.RIGHT); + screenLabels[52].Text = totF + totL + totM; + + screenLabels[55].Text = "CURRENT STAGE: " + screenStreams.GetData(DataType.control_currentStage).ToString(); + } } @@ -104,25 +116,26 @@ public override void makeElements() for (int i = 0; i < 100; i++) screenLabels.Add(null); // Initialize Labels for (int i = 0; i < 1; i++) screenInputs.Add(null); // Initialize Inputs - screenInputs[0] = Helper.CreateInput(-2, -2, 1, 2); // Every page must have an input to capture keypresses on Unix - - - screenLabels[0] = Helper.CreateLabel(39, 0, 42, 1, "========== SPACECRAFT RESOURCES =========="); - screenLabels[1] = Helper.CreateLabel(16, 1, 13); // Local Time - screenLabels[2] = Helper.CreateLabel(0, 1, 14); // MET Time - - screenLabels[3] = Helper.CreateLabel(0, 3, 70, 1, " STAGE TOTAL "); - screenLabels[4] = Helper.CreateLabel(0, 4, 70, 1, " ║ MAX CUR % ║ MAX CUR % ║ RATE"); - screenLabels[5] = Helper.CreateLabel(0, 5, 70, 1, " ║ │ │ ║ │ │ ║ "); - screenLabels[6] = Helper.CreateLabel(0, 6, 70, 1, " FUEL ║XXXXXXX│XXXXXXX│ 100% ║XXXXXXX│XXXXXXX│ 100% ║±XXX.XX"); - screenLabels[7] = Helper.CreateLabel(0, 7, 70, 1, " OXIDIZER ║XXXXXXX│XXXXXXX│ 100% ║XXXXXXX│XXXXXXX│ 100% ║±XXX.XX"); - screenLabels[8] = Helper.CreateLabel(0, 8, 70, 1, " ║ │ │ ║ │ │ ║ "); - screenLabels[9] = Helper.CreateLabel(0, 9, 70, 1, " MONOPROP ║XXXX.XX│XXXX.XX│ 100% ║XXXX.XX│XXXX.XX│ 100% ║±XXX.XX"); - screenLabels[10] = Helper.CreateLabel(0, 10, 70, 1, " ║ │ │ ║ │ │ ║ "); - screenLabels[11] = Helper.CreateLabel(0, 11, 70, 1, "ELECTRICITY ║XXXX.XX│XXXX.XX│ 100% ║XXXX.XX│XXXX.XX│ 100% ║±XXX.XX"); - - // Altitude vs. Orbital Speed - //screenCharts[0] = Helper.CreatePlot(0, 1, 120, 30, 0, 3000, 0, -1); + screenInputs[0] = Helper.CreateInput(-2, -2, 1, 2); // Every page must have an input to capture keypresses on Unix + + + screenLabels[0] = Helper.CreateCRTLabel(0, 0, 5, 1, "SCR 3"); + screenLabels[1] = Helper.CreateCRTLabel(27, 0, 30, 1, "CONSUMABLES", 4); + screenLabels[2] = Helper.CreateCRTLabel(0, 1.5, 12, 1, "LT: XX:XX:XX"); + screenLabels[3] = Helper.CreateCRTLabel(29, 1.5, 14, 1, "MET: XXX:XX:XX"); + + screenLabels[4] = Helper.CreateCRTLabel(0, 3, 72, 1, " STG ──────────── PART ─────────────── FUEL ─────── LOX ─────── MONO ──"); + + for(int i = 5; i < 37; i++) + { + screenLabels[i] = Helper.CreateCRTLabel(0, i + 0.5f, 96, 1, "", 2); + } + + screenLabels[50] = Helper.CreateCRTLabel(0, 30, 72, 1, "─────────────────────────────────────── FUEL ────── LOX ──── MONO ─────"); + screenLabels[51] = Helper.CreateCRTLabel(25, 32, 8, 1, "TOTALS:"); + screenLabels[52] = Helper.CreateCRTLabel(34, 32, 38, 1, ""); + + screenLabels[55] = Helper.CreateCRTLabel(0, 32, 25, 1, ""); } public override void resize() { } diff --git a/KSP_MOCR/Screens/Temperature.cs b/KSP_MOCR/Screens/Temperature.cs new file mode 100644 index 0000000..110aa96 --- /dev/null +++ b/KSP_MOCR/Screens/Temperature.cs @@ -0,0 +1,234 @@ +using KRPC.Client.Services.KRPC; +using KRPC.Client.Services.SpaceCenter; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KSP_MOCR +{ + class Temperature : MocrScreen + { + Parts parts; + List hotParts = new List(); + List ablators = new List(); + List radiators = new List(); + + public Temperature(Screen form) + { + this.form = form; + this.screenStreams = form.streamCollection; + + this.charSize = false; + this.width = 656; + this.height = 494; + this.updateRate = 1000; + } + + public override void makeElements() + { + for (int i = 0; i < 125; i++) screenLabels.Add(null); // Initialize Labels + + for (int i = 0; i < 1; i++) screenInputs.Add(null); // Initialize Inputs + screenInputs[0] = Helper.CreateInput(-2, -2, 1, 2); // Every page must have an input to capture keypresses on Unix + + screenLabels[0] = Helper.CreateCRTLabel(0, 0, 5, 1, "SCR 7"); + screenLabels[1] = Helper.CreateCRTLabel(15, 0, 34, 1, "TEMPERATURE / ABLATORS / RADIATORS", 4); + screenLabels[2] = Helper.CreateCRTLabel(0, 1.5, 12, 1, "LT: XX:XX:XX"); + screenLabels[3] = Helper.CreateCRTLabel(29, 1.5, 14, 1, "MET: XXX:XX:XX"); + + screenLabels[4] = Helper.CreateCRTLabel(0, 3, 72, 1, "──────────── HOT PARTS ────────────┬────────── ABLATOR PARTS ──────────"); + screenLabels[6] = Helper.CreateCRTLabel(36, 18, 72, 1, "────────── RADIATOR PARTS ─────────"); + + // CENTER DIVISOR + for(int i = 4; i < 34; i++) + { + screenLabels[80 + i] = Helper.CreateCRTLabel(35, i, 1, 1, "│"); + } + + // HOT PARTS LABLES + for (int i = 0; i < 29; i++) + { + screenLabels[10 + i] = Helper.CreateCRTLabel(0, 4 + i, 35, 1, ""); + } + + // ABLATOR PARTS LABLES + for (int i = 0; i < 14; i++) + { + screenLabels[40 + i] = Helper.CreateCRTLabel(36, 4 + i, 35, 1, ""); + } + + // RADIATOR PARTS LABLES + for (int i = 0; i < 14; i++) + { + screenLabels[60 + i] = Helper.CreateCRTLabel(36, 19 + i, 35, 1, ""); + } + } + + public override void updateLocalElements(object sender, EventArgs e) + { + screenLabels[2].Text = "LT: " + Helper.timeString(DateTime.Now.TimeOfDay.TotalSeconds); + + if (form.form.connected && form.form.krpc.CurrentGameScene == GameScene.Flight) + { + double MET = screenStreams.GetData(DataType.vessel_MET); + + screenLabels[3].Text = "MET: " + Helper.timeString(MET, 3); + + parts = screenStreams.GetData(DataType.vessel_parts); + + hotParts.Clear(); + ablators.Clear(); + radiators.Clear(); + + + + if (parts != null) + { + IList partList = parts.All; + foreach (Part p in partList) + { + addHotPart(p); + + Radiator rad = p.Radiator; + if(rad != null) + { + radiators.Add(p); + } + + Resources r = p.Resources; + if(r.HasResource("Ablator")) + { + ablators.Add(p); + } + } + } + + printHotParts(); + printAblators(); + printRadiators(); + } + } + + public override void resize() + { + } + + private void addHotPart(Part part) + { + // Find place to insert + int index = 0; + foreach(Part p in hotParts) + { + double temp = part.Temperature; + double skinTemp = part.SkinTemperature; + if (skinTemp > temp) temp = skinTemp; + + double Ptemp = p.Temperature; + double PskinTemp = p.SkinTemperature; + if (PskinTemp > Ptemp) Ptemp = PskinTemp; + + if (Ptemp < temp) + { + break; + } + index++; + } + hotParts.Insert(index, part); + } + + private void printHotParts() + { + for(int i = 0; i < 29; i++) + { + if (hotParts.Count > i) + { + Part part = hotParts[i]; + string name = Helper.prtlen(part.Title, 26).ToUpper(); + + double temp = part.Temperature; + double maxTemp = part.MaxTemperature; + double skinTemp = part.SkinTemperature; + double maxSkinTemp = part.MaxSkinTemperature; + if (skinTemp > temp) + { + temp = skinTemp; + maxTemp = maxSkinTemp; + } + + string tempS = Helper.prtlen(Helper.toFixed(temp, 1), 7, Helper.Align.RIGHT); + string star = " "; + if (temp > maxTemp * 0.5f) star = "*"; + screenLabels[10 + i].Text = name + tempS + star; + } + else + { + screenLabels[10 + i].Text = ""; + } + } + } + + private void printAblators() + { + for (int i = 0; i < 7; i++) + { + if (ablators.Count > i) + { + Part part = ablators[i]; + string name = Helper.prtlen(part.Title, 35, Helper.Align.CENTER).ToUpper(); + string temp = Helper.prtlen(Helper.toFixed(part.Temperature, 1), 6, Helper.Align.RIGHT); + string star = " "; + + Resources r = part.Resources; + float a = r.Amount("Ablator"); + string abl = Helper.prtlen(Helper.toFixed(a, 1), 6, Helper.Align.RIGHT); + + if (part.Temperature > part.MaxTemperature * 0.9f) star = "*"; + screenLabels[40 + (i * 2)].Text = name; + screenLabels[41 + (i * 2)].Text = " TEMP: " + temp + star + " ABL: " + abl; + } + else + { + screenLabels[40 + (i * 2)].Text = ""; + screenLabels[41 + (i * 2)].Text = ""; + } + } + } + + private void printRadiators() + { + for (int i = 0; i < 7; i++) + { + if (radiators.Count > i) + { + Part part = radiators[i]; + Radiator rad = part.Radiator; + string name = Helper.prtlen(part.Title, 35, Helper.Align.CENTER).ToUpper(); + string pos = Helper.prtlen(rad.State.ToString(), 12, Helper.Align.LEFT); // EXTENDED/RETRACTED/EXTENDING/RETRACTING/BROKEN + string state = ""; + + IList modules = part.Modules; + foreach (Module m in modules) + { + if (m.Name == "ModuleActiveRadiator") + { + IDictionary fields = m.Fields; + state = fields["Cooling"]; + } + } + + state = Helper.prtlen(state, 8, Helper.Align.RIGHT); + + screenLabels[60 + (i * 2)].Text = name; + screenLabels[61 + (i * 2)].Text = pos + state; + } + else + { + screenLabels[60 + (i * 2)].Text = ""; + screenLabels[61 + (i * 2)].Text = ""; + } + } + } + } +}