public static void drawStatusLabel(SupplyLink l) { if (l.active) { GUILayout.Label( l.linkVessel.vessel.name + ":" + l.location.name + " -> " + l.to.name + " (Active: T-" + UIStyle.formatTimespan(l.timeComplete - Planetarium.GetUniversalTime(), true) + ")", UIStyle.activeLabelStyle ); } else { GUILayout.Label(l.linkVessel.vessel.name + ":" + l.location.name + " -> " + l.to.name); } }
public override bool drawSelectorButton() { if (action.active) { return(GUILayout.Button( "Supply Link: " + action.linkVessel.vessel.name + "\n" + action.location.name + " -> " + action.to.name + "\nT-" + UIStyle.formatTimespan(action.timeComplete - Planetarium.GetUniversalTime(), true) + " to completion", UIStyle.activeStyle )); } else { return(GUILayout.Button( "Supply Link: " + action.linkVessel.vessel.name + "\n" + action.location.name + "\n-> " + action.to.name, (this.linkOverallStatus ? UIStyle.passableStyle : UIStyle.impassableLabelStyle) )); } }
public override bool drawStatusWindow() { /* Supply Link detail view */ selectScrollPt = GUILayout.BeginScrollView(selectScrollPt); /* Basic data. */ GUILayout.BeginVertical(); GUILayout.Label("Vessel: " + action.linkVessel.vessel.name); GUILayout.Label("From: " + action.location.name, linkPositionStatus ? UIStyle.passableLabelStyle : UIStyle.impassableLabelStyle); GUILayout.Label("To: " + action.to.name); if (action.active) { GUILayout.Label("Currently Active: T-" + UIStyle.formatTimespan(action.timeComplete - Planetarium.GetUniversalTime(), true), UIStyle.activeLabelStyle); } GUILayout.EndVertical(); /* Requirements. */ GUILayout.BeginVertical(); GUILayout.Label("Requirements:"); GUILayout.Label("Maximum Mass: " + Convert.ToString(Math.Round(action.maxMass, 3)) + " tons", linkMassStatus ? UIStyle.passableLabelStyle : UIStyle.impassableLabelStyle); GUILayout.Label("Time Required: " + UIStyle.formatTimespan(action.timeRequired)); foreach (int rsc in linkResourceStatus.Keys) { GUILayout.Label(PartResourceLibrary.Instance.GetDefinition(rsc).name + ": " + action.resourcesRequired[rsc], linkResourceStatus[rsc] ? UIStyle.passableLabelStyle : UIStyle.impassableLabelStyle); } GUILayout.EndVertical(); GUILayout.EndScrollView(); return(GUILayout.Button("Back")); }
private bool drawActionFireButton(SupplyChainAction act) { if (act.active) { GUILayout.Label( "Action In Progress...\n" + "T-" + UIStyle.formatTimespan(act.timeComplete - Planetarium.GetUniversalTime(), true) + " to completion", UIStyle.activeStyle); return(false); } else { if (act.canExecute()) { return(GUILayout.Button("Execute Action", UIStyle.passableStyle)); } else { GUILayout.Label("Execute Action", UIStyle.impassableStyle); return(false); } } }
public override bool drawEditorWindow() { viewScrollPoint = GUILayout.BeginScrollView(viewScrollPoint); GUILayout.BeginVertical(); GUILayout.Label("Supply Link:"); GUILayout.Label("Vessel: " + action.linkVessel.vessel.name); GUILayout.Label("From: " + action.location.name); GUILayout.Label("To: " + action.to.name); GUILayout.EndVertical(); /* Requirements. */ GUILayout.BeginVertical(); GUILayout.Label("Requirements:"); GUILayout.Label("Maximum Mass: " + Convert.ToString(Math.Round(action.maxMass, 3)) + " tons"); GUILayout.Label("Time Required: " + UIStyle.formatTimespan(action.timeRequired)); foreach (int rsc in action.resourcesRequired.Keys) { GUILayout.Label(PartResourceLibrary.Instance.GetDefinition(rsc).name + ": " + action.resourcesRequired[rsc]); } if (GUILayout.Button("Back")) { return(true); } GUILayout.EndVertical(); GUILayout.EndScrollView(); return(false); }
public override bool drawStatusWindow() { /* Basic data. */ GUILayout.BeginVertical(); GUILayout.Label("Origin Vessel: " + action.linkVessel.vessel.name); GUILayout.Label( "Target Vessel:" + ((action.targetVessel != null && action.targetVessel.vessel != null) ? action.targetVessel.vessel.name : "[Unknown]")); if (action.active) { GUILayout.Label("Currently Active: T-" + UIStyle.formatTimespan(action.timeComplete - Planetarium.GetUniversalTime(), true), UIStyle.activeLabelStyle); } GUILayout.EndVertical(); GUILayout.Space(UIStyle.separatorSpacing); /* Resource transfers: */ GUILayout.BeginVertical(); if (action.targetVessel != null && action.targetVessel.vessel != null) { if (action.toTarget.Count == 0) { GUILayout.Label("No resources transferred to target vessel."); } else { GUILayout.Label("Resources Transferred to Target Vessel: ", UIStyle.headingLabelStyle); foreach (ResourceTransferAction.ResourceTransfer xfer in action.toTarget) { displayResourceTransferType(xfer); } } } GUILayout.EndVertical(); GUILayout.Space(UIStyle.separatorSpacing); GUILayout.BeginVertical(); if (action.toOrigin.Count == 0) { GUILayout.Label("No resources transferred to origin vessel."); } else { GUILayout.Label("Resources Transferred to Origin Vessel: ", UIStyle.headingLabelStyle); foreach (ResourceTransferAction.ResourceTransfer xfer in action.toOrigin) { displayResourceTransferType(xfer); } } GUILayout.EndVertical(); return(GUILayout.Button("Back")); }
public void showVesselTrackingInfo() { trackingInfoScroll = GUILayout.BeginScrollView(trackingInfoScroll); GUILayout.BeginVertical(); if (selectedVesselData != null) { if (selectedVesselData.vessel != null) { /* Vessel Info: */ GUILayout.Label(selectedVesselData.vessel.name + ":", UIStyle.headingLabelStyle); GUILayout.Space(UIStyle.separatorSpacing); /* Basic info */ GUILayout.Label("Basic Information:", UIStyle.headingLabelStyle); if (selectedVesselData.vessel.loaded) { GUILayout.Label("Mass: " + Math.Round(selectedVesselData.vessel.totalMass, 5).ToString() + " tons"); GUILayout.Label("Crew: " + selectedVesselData.vessel.GetCrewCount().ToString()); if (selectedVesselData.currentLocation != null) { GUILayout.Label("Current Location: " + selectedVesselData.currentLocation.name); } else { GUILayout.Label("Current Location: " + selectedVesselData.vessel.GetOrbit().referenceBody.name + " (not at supply point)"); } } else { GUILayout.Label( "Mass: " + selectedVesselData.vessel.protoVessel.protoPartSnapshots.Sum((ProtoPartSnapshot ps) => { return(ps.mass); }).ToString() ); GUILayout.Label( "Crew: " + selectedVesselData.vessel.protoVessel.protoPartSnapshots.Sum((ProtoPartSnapshot ps) => { return(ps.protoModuleCrew.Count); }).ToString() ); if (selectedVesselData.currentLocation != null) { GUILayout.Label("Current Location: " + selectedVesselData.currentLocation.name); } else { GUILayout.Label( "Current Location: " + FlightGlobals.Bodies[selectedVesselData.vessel.protoVessel.orbitSnapShot.ReferenceBodyIndex].name + " (not at supply point)" ); } } /* Vessel Resources */ Dictionary <int, double> currentResourceCounts; Dictionary <int, double> maxResourceCounts; GUILayout.Space(UIStyle.separatorSpacing); GUILayout.Label("Vessel Resources:", UIStyle.headingLabelStyle); selectedVesselData.getAllResourceCounts(out currentResourceCounts, out maxResourceCounts); foreach (int rscID in maxResourceCounts.Keys) { GUILayout.Label( PartResourceLibrary.Instance.GetDefinition(rscID).name + ": " + currentResourceCounts[rscID].ToString() + " / " + maxResourceCounts[rscID].ToString() ); } GUILayout.Space(UIStyle.separatorSpacing); /* Vessel Capabilities: */ GUILayout.Label("Vessel Capabilities:", UIStyle.headingLabelStyle); if (selectedVesselData.orbitalDockingEnabled) { GUILayout.Label("Orbital Resource Transfer Enabled", UIStyle.passableLabelStyle); } else { GUILayout.Label("Orbital Resource Transfer Disabled", UIStyle.impassableLabelStyle); } GUILayout.Space(UIStyle.separatorSpacing); /* Vessel Supply Links */ GUILayout.Label("Vessel Supply Links:", UIStyle.headingLabelStyle); foreach (SupplyLink l in selectedVesselData.links) { SupplyLinkStatus.drawStatusLabel(l); } } else { GUILayout.Label("Unknown vessel selected."); } if (GUILayout.Button("Back")) { selectedVesselData = null; } } else { foreach (VesselData vd in SupplyChainController.instance.trackedVessels) { if (vd.vessel != null) { if (GUILayout.Button( vd.vessel.name + " (MET T+" + UIStyle.formatTimespan(Math.Round(vd.vessel.missionTime), true).ToString() + ")" )) { selectedVesselData = vd; trackingInfoScroll = new Vector2(); } } } } GUILayout.EndVertical(); GUILayout.EndScrollView(); }