void drawBaseManagerWindow(int windowID) { string Base; string Base2; float Range; LaunchSite lNearest; LaunchSite lBase; LaunchSite lBase2; string smessage = ""; BoxNoBorder = new GUIStyle(GUI.skin.box); BoxNoBorder.normal.background = null; BoxNoBorder.normal.textColor = Color.white; LabelInfo = new GUIStyle(GUI.skin.label); LabelInfo.normal.background = null; LabelInfo.normal.textColor = Color.white; LabelInfo.fontSize = 13; LabelInfo.fontStyle = FontStyle.Bold; LabelInfo.padding.left = 3; LabelInfo.padding.top = 0; LabelInfo.padding.bottom = 0; DeadButton = new GUIStyle(GUI.skin.button); DeadButton.normal.background = null; DeadButton.hover.background = null; DeadButton.active.background = null; DeadButton.focused.background = null; DeadButton.normal.textColor = Color.white; DeadButton.hover.textColor = Color.white; DeadButton.active.textColor = Color.white; DeadButton.focused.textColor = Color.white; DeadButton.fontSize = 14; DeadButton.fontStyle = FontStyle.Bold; DeadButtonRed = new GUIStyle(GUI.skin.button); DeadButtonRed.normal.background = null; DeadButtonRed.hover.background = null; DeadButtonRed.active.background = null; DeadButtonRed.focused.background = null; DeadButtonRed.normal.textColor = Color.red; DeadButtonRed.hover.textColor = Color.yellow; DeadButtonRed.active.textColor = Color.red; DeadButtonRed.focused.textColor = Color.red; DeadButtonRed.fontSize = 12; DeadButtonRed.fontStyle = FontStyle.Bold; GUILayout.BeginHorizontal(); { GUI.enabled = false; GUILayout.Button("-KK-", DeadButton, GUILayout.Height(16)); GUILayout.FlexibleSpace(); GUILayout.Button("Inflight Base Boss", DeadButton, GUILayout.Height(16)); GUILayout.FlexibleSpace(); GUI.enabled = true; if (GUILayout.Button("X", DeadButtonRed, GUILayout.Height(16))) { bShowFacilities = false; KerbalKonstructs.instance.showFlightManager = false; } } GUILayout.EndHorizontal(); GUILayout.Space(1); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(5); GUILayout.Box("Flight Tools", BoxNoBorder); GUILayout.BeginHorizontal(); { GUILayout.Space(2); GUILayout.Label("ATC ", LabelInfo); if (KerbalKonstructs.instance.enableATC) { tToggle = tIconOpen; } else { tToggle = tIconClosed; } if (GUILayout.Button(tToggle, GUILayout.Height(18), GUILayout.Width(18))) { KerbalKonstructs.instance.updateCache(); if (KerbalKonstructs.instance.enableATC) { KerbalKonstructs.instance.enableATC = false; } else { KerbalKonstructs.instance.enableATC = true; } } KerbalKonstructs.instance.showATC = (KerbalKonstructs.instance.enableATC); GUILayout.FlexibleSpace(); GUILayout.Label("NGS ", LabelInfo); if (KerbalKonstructs.instance.enableNGS) { tToggle2 = tIconOpen; } else { tToggle2 = tIconClosed; } if (GUILayout.Button(tToggle2, GUILayout.Height(18), GUILayout.Width(18))) { if (KerbalKonstructs.instance.enableNGS) { KerbalKonstructs.instance.enableNGS = false; } else { KerbalKonstructs.instance.enableNGS = true; } } KerbalKonstructs.instance.showNGS = (KerbalKonstructs.instance.enableNGS); GUILayout.FlexibleSpace(); GUILayout.Label("Downlink ", LabelInfo); if (KerbalKonstructs.instance.enableDownlink) { tToggle2 = tIconOpen; } else { tToggle2 = tIconClosed; } if (GUILayout.Button(tToggle2, GUILayout.Height(18), GUILayout.Width(18))) { if (KerbalKonstructs.instance.enableDownlink) { KerbalKonstructs.instance.enableDownlink = false; } else { KerbalKonstructs.instance.enableDownlink = true; } } KerbalKonstructs.instance.showDownlink = (KerbalKonstructs.instance.enableDownlink); GUILayout.Space(2); } GUILayout.EndHorizontal(); GUILayout.Space(2); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUILayout.Box("Active Beacons", BoxNoBorder); if (MiscUtils.isCareerGame()) { GUILayout.BeginHorizontal(); { string snearestopen = ""; LaunchSiteManager.getNearestOpenBase(FlightGlobals.ActiveVessel.GetTransform().position, out Base, out Range, out lNearest); if (FlightGlobals.ActiveVessel.altitude > 75000) { GUILayout.Label("No base's beacon in range at this altitude.", LabelInfo); } else if (Base == "") { GUILayout.Label("No open base found.", LabelInfo); } else { if (Range < 10000) { snearestopen = Base + " at " + Range.ToString("#0.0") + " m"; } else { snearestopen = Base + " at " + (Range / 1000).ToString("#0.0") + " km"; } GUILayout.Space(5); GUILayout.Label("Nearest Open: ", LabelInfo); GUILayout.Label(snearestopen, LabelInfo, GUILayout.Width(150)); if (KerbalKonstructs.instance.enableNGS) { GUILayout.FlexibleSpace(); if (GUILayout.Button("NGS", GUILayout.Height(21))) { NavGuidanceSystem.setTargetSite(lNearest); smessage = "NGS set to " + Base; MiscUtils.HUDMessage(smessage, 10, 2); } } } } GUILayout.EndHorizontal(); GUILayout.Space(2); } GUILayout.BeginHorizontal(); { string sNearestbase = ""; LaunchSiteManager.getNearestBase(FlightGlobals.ActiveVessel.GetTransform().position, out Base, out Base2, out Range, out lBase, out lBase2); if (FlightGlobals.ActiveVessel.altitude > 75000) { GUILayout.Label("No base's beacon in range at this altitude.", LabelInfo); } else if (Base == "") { GUILayout.Label("No nearest base found.", LabelInfo); } else { if (Range < 10000) { sNearestbase = Base + " at " + Range.ToString("#0.0") + " m"; } else { sNearestbase = Base + " at " + (Range / 1000).ToString("#0.0") + " km"; } GUILayout.Space(5); GUILayout.Label("Nearest Base: ", LabelInfo); GUILayout.Label(sNearestbase, LabelInfo, GUILayout.Width(150)); if (KerbalKonstructs.instance.enableNGS) { GUILayout.FlexibleSpace(); if (GUILayout.Button("NGS", GUILayout.Height(21))) { NavGuidanceSystem.setTargetSite(lBase); smessage = "NGS set to " + Base; MiscUtils.HUDMessage(smessage, 10, 2); } } } } GUILayout.EndHorizontal(); GUILayout.Space(2); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUILayout.Box("Base Status", BoxNoBorder); if (MiscUtils.isCareerGame()) { bool bLanded = (FlightGlobals.ActiveVessel.Landed); if (Range < 2000) { string sClosed; float fOpenCost; LaunchSiteManager.getSiteOpenCloseState(Base, out sClosed, out fOpenCost); fOpenCost = fOpenCost / 2f; if (bLanded && sClosed == "Closed") { GUILayout.Space(2); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); if (GUILayout.Button("Open Base for " + fOpenCost + " funds", GUILayout.Height(23))) { double currentfunds = Funding.Instance.Funds; if (fOpenCost > currentfunds) { MiscUtils.HUDMessage("Insufficient funds to open this site!", 10, 0); } else { Funding.Instance.AddFunds(-fOpenCost, TransactionReasons.Cheating); LaunchSiteManager.setSiteOpenCloseState(Base, "Open"); smessage = Base + " opened"; MiscUtils.HUDMessage(smessage, 10, 2); } } } if (bLanded && sClosed == "Open") { GUI.enabled = false; GUILayout.Button("Base is Open", GUILayout.Height(23)); GUI.enabled = true; } if (bLanded && (sClosed == "OpenLocked" || sClosed == "ClosedLocked")) { GUI.enabled = false; GUILayout.Button("Base cannot be opened or closed", GUILayout.Height(23)); GUI.enabled = true; } GUILayout.Space(2); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); } else { GUILayout.Label("Bases can only be opened or closed at the base when within 2km of the base.", LabelInfo); } if (Range > 100000) { if (bLanded) { GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUILayout.Label("This feature is WIP.", LabelInfo); GUI.enabled = false; if (GUILayout.Button("Found a New Base", GUILayout.Height(23))) { foundingBase = true; } GUI.enabled = true; GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); } } else { GUILayout.Label("This feature is WIP.", LabelInfo); GUILayout.Label("New bases cannot be built within 100 km of an existing base.", LabelInfo); } } GUILayout.Space(2); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUILayout.Box("Operational Facilities", BoxNoBorder); bool bAreFacilities = false; if (FlightGlobals.ActiveVessel.Landed) { if (GUILayout.Button("Show/Hide", GUILayout.Height(23))) { if (bShowFacilities) { bShowFacilities = false; } else { foreach (StaticObject soStaticobj in KerbalKonstructs.instance.getStaticDB().getAllStatics()) { if ((string)soStaticobj.model.getSetting("DefaultFacilityType") == "None") { continue; } if (soStaticobj.pqsCity.sphere == FlightGlobals.currentMainBody.pqsController) { var dist2 = Vector3.Distance(FlightGlobals.ActiveVessel.GetTransform().position, soStaticobj.gameObject.transform.position); if (dist2 > 5000f) { continue; } } else { continue; } PersistenceUtils.loadStaticPersistence(soStaticobj); } bShowFacilities = true; } } if (bShowFacilities) { scrollPos = GUILayout.BeginScrollView(scrollPos); foreach (StaticObject obj in KerbalKonstructs.instance.getStaticDB().getAllStatics()) { bool isLocal = true; if (obj.pqsCity.sphere == FlightGlobals.currentMainBody.pqsController) { var dist = Vector3.Distance(FlightGlobals.ActiveVessel.GetTransform().position, obj.gameObject.transform.position); isLocal = dist < 5000f; } else { isLocal = false; } if ((string)obj.model.getSetting("DefaultFacilityType") == "None") { isLocal = false; } if (isLocal) { bAreFacilities = true; GUILayout.BeginHorizontal(); { bIsOpen = ((string)obj.getSetting("OpenCloseState") == "Open"); if (!bIsOpen) { iFundsOpen2 = (float)obj.model.getSetting("cost"); if (iFundsOpen2 == 0) { bIsOpen = true; } } if (GUILayout.Button((string)obj.model.getSetting("title"), GUILayout.Height(23))) { selectedObject = obj; KerbalKonstructs.instance.selectObject(obj, false, true, false); PersistenceUtils.loadStaticPersistence(obj); FacilityManager.setSelectedFacility(obj); KerbalKonstructs.instance.showFacilityManager = true; } if (bIsOpen) { GUILayout.Label(tIconOpen, GUILayout.Height(23), GUILayout.Width(23)); } if (!bIsOpen) { GUILayout.Label(tIconClosed, GUILayout.Height(23), GUILayout.Width(23)); } } GUILayout.EndHorizontal(); } } GUILayout.EndScrollView(); } else { GUILayout.Label("Click the button above to display a list of nearby operational facilities.", LabelInfo); if (KerbalKonstructs.instance.DebugMode) { GUILayout.Box("Debug Mode ActiveVessel Report"); GUILayout.Label("Name " + FlightGlobals.ActiveVessel.vesselName); GUILayout.Label("Acceleration " + FlightGlobals.ActiveVessel.acceleration.ToString()); GUILayout.Label("Angular Momentum " + FlightGlobals.ActiveVessel.angularMomentum.ToString("#0.000")); GUILayout.Label("Angular Velocity " + FlightGlobals.ActiveVessel.angularVelocity.ToString("#0.000")); //GUILayout.Label("Centrifugal Acc " + FlightGlobals.ActiveVessel.CentrifugalAcc.ToString()); GUILayout.Label("Horiz Srf Speed " + FlightGlobals.ActiveVessel.horizontalSrfSpeed.ToString("#0.00")); GUILayout.Label("Indicated Air Speed " + FlightGlobals.ActiveVessel.indicatedAirSpeed.ToString("#0.00")); GUILayout.Label("Mach " + FlightGlobals.ActiveVessel.mach.ToString("#0.00")); GUILayout.Label("Orbit Speed " + FlightGlobals.ActiveVessel.obt_speed.ToString("#0.00")); GUILayout.Label("Orbit Velocity " + FlightGlobals.ActiveVessel.obt_velocity.ToString()); GUILayout.Label("Perturbation " + FlightGlobals.ActiveVessel.perturbation.ToString()); GUILayout.Label("rb_velocity " + FlightGlobals.ActiveVessel.rb_velocity.ToString("#0.000")); GUILayout.Label("Specific Acc " + FlightGlobals.ActiveVessel.specificAcceleration.ToString("#0.00")); GUILayout.Label("speed " + FlightGlobals.ActiveVessel.speed.ToString("#0.00")); GUILayout.Label("srf_velocity " + FlightGlobals.ActiveVessel.srf_velocity.ToString()); GUILayout.Label("srfspeed " + FlightGlobals.ActiveVessel.srfSpeed.ToString("#0.00")); } } } else { GUILayout.Label("Nearby facilities can only be shown when landed.", LabelInfo); bShowFacilities = false; } if (bAreFacilities == false) { //GUILayout.Label("There are no nearby operational facilities.", LabelInfo); } GUILayout.FlexibleSpace(); GUILayout.Space(2); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUILayout.Box("Other Features", BoxNoBorder); if (GUILayout.Button("Start Air Racing!", GUILayout.Height(23))) { KerbalKonstructs.instance.showRacingApp = true; AirRacing.runningRace = true; KerbalKonstructs.instance.showNGS = false; KerbalKonstructs.instance.showFlightManager = false; } if (GUILayout.Button("Basic Orbital Data", GUILayout.Height(23))) { KerbalKonstructs.instance.showRacingApp = true; AirRacing.runningRace = false; AirRacing.basicorbitalhud = true; KerbalKonstructs.instance.showNGS = false; KerbalKonstructs.instance.showFlightManager = false; } GUILayout.Space(5); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUI.DragWindow(new Rect(0, 0, 10000, 10000)); }
void drawBaseManagerWindow(int windowID) { if (!isInitialized) { InitializeLayout(); } GUILayout.BeginHorizontal(); { GUI.enabled = false; GUILayout.Button("-KK-", DeadButton, GUILayout.Height(16)); GUILayout.FlexibleSpace(); GUILayout.Button("Inflight Base Boss", DeadButton, GUILayout.Height(16)); GUILayout.FlexibleSpace(); GUI.enabled = true; if (GUILayout.Button("X", DeadButtonRed, GUILayout.Height(16))) { bShowFacilities = false; this.Close(); return; } } GUILayout.EndHorizontal(); GUILayout.Space(1); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(5); GUILayout.Box("Flight Tools", BoxNoBorder); GUILayout.BeginHorizontal(); { GUILayout.Space(2); GUILayout.Label("Landing Guide ", LabelInfo); if (GUILayout.Button(LandingGuideUI.instance.IsOpen()? tIconOpen : tIconClosed, GUILayout.Height(18), GUILayout.Width(56))) { KerbalKonstructs.instance.updateCache(); LandingGuideUI.instance.Toggle(); } GUILayout.FlexibleSpace(); GUILayout.Label("NGS ", LabelInfo); if (NavGuidanceSystem.instance.IsOpen()) { tToggle2 = tIconOpen; } else { tToggle2 = tIconClosed; } if (GUILayout.Button(tToggle2, GUILayout.Height(18), GUILayout.Width(18))) { NavGuidanceSystem.instance.Toggle(); } GUILayout.Space(2); } GUILayout.EndHorizontal(); GUILayout.Space(2); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUILayout.Box("Active Beacons", BoxNoBorder); if (MiscUtils.isCareerGame()) { GUILayout.BeginHorizontal(); { string snearestopen = ""; LaunchSiteManager.GetNearestOpenBase(FlightGlobals.ActiveVessel.GetTransform().position, out Base, out Range, out lNearest); if (FlightGlobals.ActiveVessel.altitude > 75000) { GUILayout.Label("No base's beacon in range at this altitude.", LabelInfo); } else if (Base == "") { GUILayout.Label("No open base found.", LabelInfo); } else { if (Range < 10000) { snearestopen = Base + " at " + Range.ToString("#0.0") + " m"; } else { snearestopen = Base + " at " + (Range / 1000).ToString("#0.0") + " km"; } GUILayout.Space(5); GUILayout.Label("Nearest Open: ", LabelInfo); GUILayout.Label(snearestopen, LabelInfo, GUILayout.Width(150)); if (NavGuidanceSystem.instance.IsOpen()) { GUILayout.FlexibleSpace(); if (GUILayout.Button("NGS", GUILayout.Height(21))) { NavGuidanceSystem.setTargetSite(lNearest); smessage = "NGS set to " + Base; MiscUtils.HUDMessage(smessage, 10, 2); } } } } GUILayout.EndHorizontal(); GUILayout.Space(2); } GUILayout.BeginHorizontal(); { string sNearestbase = ""; LaunchSiteManager.getNearestBase(FlightGlobals.ActiveVessel.GetTransform().position, out Base, out Base2, out Range, out lBase, out lBase2); if (FlightGlobals.ActiveVessel.altitude > 75000) { GUILayout.Label("No base's beacon in range at this altitude.", LabelInfo); } else if (Base == "") { GUILayout.Label("No nearest base found.", LabelInfo); } else { if (Range < 10000) { sNearestbase = Base + " at " + Range.ToString("#0.0") + " m"; } else { sNearestbase = Base + " at " + (Range / 1000).ToString("#0.0") + " km"; } GUILayout.Space(5); GUILayout.Label("Nearest Base: ", LabelInfo); GUILayout.Label(sNearestbase, LabelInfo, GUILayout.Width(150)); if (NavGuidanceSystem.instance.IsOpen()) { GUILayout.FlexibleSpace(); if (GUILayout.Button("NGS", GUILayout.Height(21))) { NavGuidanceSystem.setTargetSite(lBase); smessage = "NGS set to " + Base; MiscUtils.HUDMessage(smessage, 10, 2); } } } } GUILayout.EndHorizontal(); GUILayout.Space(2); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUILayout.Box("Base Status", BoxNoBorder); if (MiscUtils.isCareerGame()) { bool bLanded = (FlightGlobals.ActiveVessel.Landed); if (Range < 2000) { LaunchSiteManager.getSiteOpenCloseState(Base, out sClosed, out fOpenCost); fOpenCost = fOpenCost / 2f; if (bLanded && sClosed == "Closed") { GUILayout.Space(2); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); if (GUILayout.Button("Open Base for " + fOpenCost + " funds", GUILayout.Height(23))) { double currentfunds = Funding.Instance.Funds; if (fOpenCost > currentfunds) { MiscUtils.HUDMessage("Insufficient funds to open this site!", 10, 0); } else { Funding.Instance.AddFunds(-fOpenCost, TransactionReasons.Cheating); LaunchSiteManager.setSiteOpenCloseState(Base, "Open"); smessage = Base + " opened"; MiscUtils.HUDMessage(smessage, 10, 2); } } } if (bLanded && sClosed == "Open") { GUI.enabled = false; GUILayout.Button("Base is Open", GUILayout.Height(23)); GUI.enabled = true; } if (bLanded && (sClosed == "OpenLocked" || sClosed == "ClosedLocked")) { GUI.enabled = false; GUILayout.Button("Base cannot be opened or closed", GUILayout.Height(23)); GUI.enabled = true; } GUILayout.Space(2); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); } else { GUILayout.Label("Bases can only be opened or closed at the base when within 2km of the base.", LabelInfo); } //if (Range > 100000) //{ // if (bLanded) // { // GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); // GUILayout.Space(2); // GUILayout.Label("This feature is WIP.", LabelInfo); // GUI.enabled = false; // if (GUILayout.Button("Found a New Base", GUILayout.Height(23))) // { // foundingBase = true; // } // GUI.enabled = true; // GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); // GUILayout.Space(2); // } //} //else //{ // GUILayout.Label("This feature is WIP.", LabelInfo); //} } GUILayout.Space(2); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUILayout.Box("Operational Facilities", BoxNoBorder); bool bAreFacilities = false; if (FlightGlobals.ActiveVessel.Landed) { if (GUILayout.Button("Show/Hide", GUILayout.Height(23))) { if (bShowFacilities) { bShowFacilities = false; } else { CacheFacilities(); bShowFacilities = true; } } if (bShowFacilities && allFacilities.Count > 0) { scrollPos = GUILayout.BeginScrollView(scrollPos); for (int i = 0; i < allFacilities.Count; i++) { bAreFacilities = true; GUILayout.BeginHorizontal(); { bIsOpen = allFacilities[i].myFacilities[0].isOpen; if (!bIsOpen) { iFundsOpen2 = allFacilities[i].myFacilities[0].OpenCost; if (iFundsOpen2 == 0) { bIsOpen = true; } } if (GUILayout.Button(allFacilities[i].model.title, GUILayout.Height(23))) { selectedObject = allFacilities[i]; KerbalKonstructs.instance.selectObject(allFacilities[i], false, true, false); FacilityManager.selectedInstance = allFacilities[i]; FacilityManager.instance.Open(); } if (bIsOpen) { GUILayout.Label(tIconOpen, GUILayout.Height(23), GUILayout.Width(23)); } if (!bIsOpen) { GUILayout.Label(tIconClosed, GUILayout.Height(23), GUILayout.Width(23)); } } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } else { GUILayout.Label("Click the button above to display a list of nearby operational facilities.", LabelInfo); if (KerbalKonstructs.instance.DebugMode) { GUILayout.Box("Debug Mode ActiveVessel Report"); GUILayout.Label("Name " + FlightGlobals.ActiveVessel.vesselName); GUILayout.Label("Acceleration " + FlightGlobals.ActiveVessel.acceleration.ToString()); GUILayout.Label("Angular Momentum " + FlightGlobals.ActiveVessel.angularMomentum.ToString("#0.000")); GUILayout.Label("Angular Velocity " + FlightGlobals.ActiveVessel.angularVelocity.ToString("#0.000")); //GUILayout.Label("Centrifugal Acc " + FlightGlobals.ActiveVessel.CentrifugalAcc.ToString()); GUILayout.Label("Horiz Srf Speed " + FlightGlobals.ActiveVessel.horizontalSrfSpeed.ToString("#0.00")); GUILayout.Label("Indicated Air Speed " + FlightGlobals.ActiveVessel.indicatedAirSpeed.ToString("#0.00")); GUILayout.Label("Mach " + FlightGlobals.ActiveVessel.mach.ToString("#0.00")); GUILayout.Label("Orbit Speed " + FlightGlobals.ActiveVessel.obt_speed.ToString("#0.00")); GUILayout.Label("Orbit Velocity " + FlightGlobals.ActiveVessel.obt_velocity.ToString()); GUILayout.Label("Perturbation " + FlightGlobals.ActiveVessel.perturbation.ToString()); GUILayout.Label("rb_velocity " + FlightGlobals.ActiveVessel.rb_velocity.ToString("#0.000")); GUILayout.Label("Specific Acc " + FlightGlobals.ActiveVessel.specificAcceleration.ToString("#0.00")); GUILayout.Label("speed " + FlightGlobals.ActiveVessel.speed.ToString("#0.00")); GUILayout.Label("srf_velocity " + FlightGlobals.ActiveVessel.srf_velocity.ToString()); GUILayout.Label("srfspeed " + FlightGlobals.ActiveVessel.srfSpeed.ToString("#0.00")); } } } else { GUILayout.Label("Nearby facilities can only be shown when landed.", LabelInfo); bShowFacilities = false; } if (bAreFacilities == false) { //GUILayout.Label("There are no nearby operational facilities.", LabelInfo); } GUILayout.FlexibleSpace(); GUILayout.Space(2); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUILayout.Box("Other Features", BoxNoBorder); if (GUILayout.Button("Start Air Racing!", GUILayout.Height(23))) { AirRacing.instance.Open(); AirRacing.runningRace = true; NavGuidanceSystem.instance.Close(); FacilityManager.instance.Close(); } if (GUILayout.Button("Basic Orbital Data", GUILayout.Height(23))) { AirRacing.instance.Open(); AirRacing.runningRace = false; AirRacing.basicorbitalhud = true; NavGuidanceSystem.instance.Close(); FacilityManager.instance.Close(); } GUILayout.Space(5); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUI.DragWindow(new Rect(0, 0, 10000, 10000)); }
public void drawGroundComms(StaticObject obj, LaunchSite lSite = null) { string Base = ""; string Base2 = ""; float Range = 0f; LaunchSite lBase = null; LaunchSite lBase2 = null; Vector3 pos = Vector3.zero; if (lSite != null) { GameObject golSite = lSite.GameObject; pos = MapView.MapCamera.GetComponent <Camera>().WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(golSite.transform.position)); LaunchSiteManager.getNearestBase(golSite.transform.position, out Base, out Base2, out Range, out lBase, out lBase2); } if (obj != null) { pos = MapView.MapCamera.GetComponent <Camera>().WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(obj.gameObject.transform.position)); LaunchSiteManager.getNearestBase(obj.gameObject.transform.position, out Base, out Base2, out Range, out lBase, out lBase2); } Vector3 vNeighbourPos = Vector3.zero; Vector3 vNeighbourPos2 = Vector3.zero; Vector3 vBasePos = Vector3.zero; Vector3 vBasePos2 = Vector3.zero; GameObject goNeighbour = null; GameObject goNeighbour2 = null; if (Base != "") { if (Base == "KSC") { goNeighbour = SpaceCenterManager.KSC.gameObject; } else { goNeighbour = LaunchSiteManager.getSiteGameObject(Base); } } if (Base2 != "") { if (Base2 == "KSC") { goNeighbour2 = SpaceCenterManager.KSC.gameObject; } else { goNeighbour2 = LaunchSiteManager.getSiteGameObject(Base2); } } if (goNeighbour != null) { vNeighbourPos = goNeighbour.transform.position; vBasePos = MapView.MapCamera.GetComponent <Camera>().WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vNeighbourPos)); } if (goNeighbour2 != null) { vNeighbourPos2 = goNeighbour2.transform.position; vBasePos2 = MapView.MapCamera.GetComponent <Camera>().WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vNeighbourPos2)); } if (goNeighbour != null && vNeighbourPos != Vector3.zero && vBasePos != Vector3.zero) { NavUtils.CreateLineMaterial(1); GL.Begin(GL.LINES); NavUtils.lineMaterial1.SetPass(0); GL.Color(new Color(1f, 1f, 1f, 0.7f)); GL.Vertex3(pos.x - Screen.width / 2, pos.y - Screen.height / 2, pos.z); GL.Vertex3(vBasePos.x - Screen.width / 2, vBasePos.y - Screen.height / 2, vBasePos.z); GL.End(); } if (goNeighbour2 != null && vNeighbourPos2 != Vector3.zero && vBasePos2 != Vector3.zero) { NavUtils.CreateLineMaterial(2); GL.Begin(GL.LINES); NavUtils.lineMaterial2.SetPass(0); GL.Color(new Color(1f, 1f, 1f, 0.7f)); GL.Vertex3(pos.x - Screen.width / 2, pos.y - Screen.height / 2, pos.z); GL.Vertex3(vBasePos2.x - Screen.width / 2, vBasePos2.y - Screen.height / 2, vBasePos2.z); GL.End(); } }
void UpdateUI() { landingGuide.SetIsOnWithoutNotify(LandingGuideUI.instance.IsOpen()); navGuidance.SetIsOnWithoutNotify(NavGuidanceSystem.instance.IsOpen()); var Range = float.PositiveInfinity; //FIXME atmo scaling? other worlds? ... if (FlightGlobals.ActiveVessel.altitude > 75000) { center = null; noBasesBeacon.SetActive(true); noNearestBase.SetActive(false); nearestBaseGroup.SetActive(false); } else { center = StaticDatabase.GetClosestLaunchCenter();; if (center == null) { noBasesBeacon.SetActive(false); noNearestBase.SetActive(true); nearestBaseGroup.SetActive(false); } else { noBasesBeacon.SetActive(false); noNearestBase.SetActive(false); nearestBaseGroup.SetActive(true); Vector3 vPosition = FlightGlobals.ActiveVessel.GetTransform().position; ngsSite = LaunchSiteManager.getNearestBase(center, vPosition); Range = Vector3.Distance(center.gameObject.transform.position, vPosition); string info; if (Range < 10000) { info = center.Group + " at " + Range.ToString("#0.0") + " m"; } else { info = center.Group + " at " + (Range / 1000).ToString("#0.0") + " km"; } nearestBase.Info(info); bool ngs = NavGuidanceSystem.instance.IsOpen(); ngsFiller.SetActive(!ngs); setNGSTarget.SetActive(ngs); } } if (!MiscUtils.isCareerGame()) { careerGroup.SetActive(false); } else { careerGroup.SetActive(true); if (!FlightGlobals.ActiveVessel.Landed || Range > 5000) { //FIXME a bouncy landing will be laggy if (launchsiteItems.Count > 0) { launchsiteItems.Clear(); UIKit.UpdateListContent(launchsiteItems); } basesCanBeOpened.SetActive(true); openSite.SetActive(false); siteIsOpen.SetActive(false); siteCannoteBeOpened.SetActive(false); } else { basesCanBeOpened.SetActive(false); if (launchsiteItems.Count != center.launchsites.Count) { BuildLaunchsites(); } UpdateLaunchsite(); } //if (Range > 100000) //{ // if (bLanded) // { // GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); // GUILayout.Space(2); // GUILayout.Label("This feature is WIP.", LabelInfo); // GUI.enabled = false; // if (GUILayout.Button("Found a New Base", GUILayout.Height(23))) // { // foundingBase = true; // } // GUI.enabled = true; // GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); // GUILayout.Space(2); // } //} //else //{ // GUILayout.Label("This feature is WIP.", LabelInfo); //} } UpdateFaclilitiesGroup(); }