/// <summary> /// Draws main UI /// </summary> /// <param name="guiId">GUI identifier.</param> public void DrawGUI(int guiId) { double currentTime = Planetarium.GetUniversalTime(); GUILayout.BeginVertical(); mainWindowScrollPosition = GUILayout.BeginScrollView(mainWindowScrollPosition); for (int i = 0; i < activeRovers.Count; i++) { var rover = activeRovers [i]; switch (rover.status) { case "current": GUI.contentColor = Color.white; break; case "roving": GUI.contentColor = Palette.green; break; case "idle": GUI.contentColor = Palette.yellow; break; case "awaiting sunlight": GUI.contentColor = Palette.red; break; } GUILayout.BeginHorizontal(); if (Layout.Button(rover.vessel.vesselName, GUILayout.Width(200))) { if (HighLogic.LoadedScene == GameScenes.TRACKSTATION) { PlanetariumCamera.fetch.SetTarget(rover.vessel.mapObject); } if (HighLogic.LoadedSceneIsFlight) { MapView.EnterMapView(); PlanetariumCamera.fetch.SetTarget(rover.vessel.mapObject); } } if (Layout.Button("Switch to", GUILayout.Width(100))) { if (rover.vessel.loaded) { FlightGlobals.SetActiveVessel(rover.vessel); } else { GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.OVERWRITE); FlightDriver.StartAndFocusVessel("persistent", FlightGlobals.Vessels.IndexOf(rover.vessel)); } } Layout.Label(rover.vessel.mainBody.bodyDisplayName.Replace("^N", ""), GUILayout.Width(75)); Layout.Label(rover.status + (rover.status == "roving" ? rover.status2 : ""), GUILayout.Width(125)); if (rover.status == "roving" || rover.status == "awaiting sunlight") { Layout.Label( "v̅ = " + rover.AverageSpeed.ToString("N") + ", yet to travel " + rover.yetToTravel.ToString("N0") + " meters" ); } if (rover.status == "idle") { TimeSpan t = TimeSpan.FromSeconds(currentTime - rover.LastTime); string idlePeriod = string.Format( "{0:D2}h:{1:D2}m:{2:D2}s", t.Hours, t.Minutes, t.Seconds ); Layout.Label(idlePeriod); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); GUI.contentColor = Color.white; autoDewarp = Layout.Toggle(autoDewarp, "Automagic Dewarp"); // useKSPSkin = Layout.Toggle (useKSPSkin, "Use KSP Skin"); GUILayout.BeginHorizontal(); if (Layout.Button("Close", GUILayout.Height(25))) { if (appLauncherButton != null) { appLauncherButton.SetFalse(); } else { onToggle(); } } if (Layout.Button("Switch Toolbar", GUILayout.Height(25), GUILayout.Width(150))) { useToolbar = !useToolbar; DestroyLauncher(); CreateLauncher(); } if (HighLogic.LoadedSceneIsFlight) { if (Layout.Button("BV Control Panel", GUILayout.Height(25), GUILayout.Width(200))) { if ((currentModule != null) && !currentModule.isShutdown) { currentModule.SystemCheck(); rcVisible = true; if (appLauncherButton != null) { appLauncherButton.SetFalse(); } else { onToggle(); } } } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUI.DragWindow(); }
/// <summary> /// Draws UI for module control /// </summary> /// <param name="rcGuiId">Rc GUI identifier.</param> public void DrawRcGUI(int rcGuiId) { if (currentModule == null) { rcVisible = false; return; } double currentTime = Planetarium.GetUniversalTime(); GUILayout.BeginVertical(); TimeSpan t = TimeSpan.FromSeconds(currentTime - currentModule.lastTime); Layout.Label( string.Format( "Idle for {0:D2}h:{1:D2}m:{2:D2}s", t.Hours, t.Minutes, t.Seconds ) ); Layout.LabelAndText("Target latitude", currentModule.targetLatitude.ToString()); Layout.LabelAndText("Target longitude", currentModule.targetLatitude.ToString()); Layout.LabelAndText("Distance to target", currentModule.distanceToTarget.ToString("N0")); Layout.LabelAndText("Distance travelled", currentModule.distanceTravelled.ToString("N0")); Layout.LabelAndText("Average speed", currentModule.averageSpeed.ToString("F")); Layout.LabelAndText("Solar power", currentModule.solarPower.ToString("F")); Layout.LabelAndText("Other power", currentModule.otherPower.ToString("F")); Layout.LabelAndText("Power required", currentModule.powerRequired.ToString("F")); Layout.LabelAndText("Solar powered", currentModule.solarPowered.ToString()); Layout.LabelAndText("Is manned", currentModule.isManned.ToString()); // Layout.TextField ("lat"); // Layout.TextField ("lon"); if (Layout.Button("Pick target on map", Palette.yellow)) { currentModule.PickTarget(); } if (Layout.Button("Set to active target", Palette.yellow)) { currentModule.SetToActive(); } if (Layout.Button("Set to active waypoint", Palette.yellow)) { currentModule.SetToWaypoint(); } if (!currentModule.isActive) { if (Layout.Button("Poehali!!!", Palette.green)) { currentModule.Activate(); } } else { if (Layout.Button("Deactivate", Palette.red)) { currentModule.Deactivate(); } } if (Layout.Button("System Check", Palette.yellow)) { currentModule.SystemCheck(); } if (Layout.Button("Close", Palette.red)) { rcVisible = false; } // if (Layout.Button ("LZString test")) { // currentModule.TestLZString (); // } GUILayout.EndVertical(); GUI.DragWindow(); }