private void DrawGUI(int windowID) { try { if (StateHandler.SelectedPath != null) { // A path is selected. if (pathEditor == null || !pathEditor.IsForPath(StateHandler.SelectedPath)) { // Selected path has changed. pathEditor = StateHandler.SelectedPath.MakeEditor(); } } else { // No path is selected. if (pathEditor != null) { pathEditor = null; } } float minHeight = GetGuiMinHeight(); float minWidth = GetGuiMinWidth(); if (cameraControlsOpen) { minHeight += cameraGui.GetGuiMinHeight(); minWidth = Math.Max(minWidth, cameraGui.GetGuiMinWidth()); } if (pathEditor != null) { minHeight = Math.Max(minHeight, pathEditor.GetGuiMinHeight()); minWidth += pathEditor.GetGuiMinWidth(); } resizer.MinHeight = minHeight; resizer.MinWidth = minWidth; GUILayout.BeginVertical(); // BEGIN outer container GUILayout.BeginHorizontal(); // BEGIN left/right panes GUILayout.BeginVertical(GUILayout.MaxWidth(140)); // BEGIN main controls if (GUILayout.Button("New simple path")) { StateHandler.SelectedPath = StateHandler.NewPath(); } DoPathList(); if (GUILayout.Button("Relative to")) { VesselSelectionWindow.Instance.ToggleWindow(); } bool pressed = GUILayout.Button( (cameraControlsOpen ? "\u25bd" : "\u25b9") + " Camera controls", WindowStyles.FoldButtonStyle); cameraControlsOpen = cameraControlsOpen ^ pressed; if (cameraControlsOpen) { cameraGui.DrawGUI(); } GUILayout.EndVertical(); // END main controls // Path editor lives in right-hand-frame. if (pathEditor != null) { pathEditor.DoGUI(); } GUILayout.EndHorizontal(); // END left/right panes GUILayout.BeginHorizontal(); // BEGIN lower controls if (GUILayout.Button("Save")) { StateHandler.SavePaths(); } if (GUILayout.Button("Load")) { StateHandler.LoadPaths(); } if (GUILayout.Button("Config\u2026")) { ConfigWindow.Instance.ToggleWindow(); } GUILayout.FlexibleSpace(); if (GUILayout.Button("?", WindowStyles.WindowButtonStyle)) { HelpWindow.Instance.ToggleWindow(); } DrawCloseButton(); resizer.HandleResize(); GUILayout.EndHorizontal(); // END lower controls GUILayout.EndVertical(); // END outer container GUI.DragWindow(new Rect(0, 0, 10000, 25)); } catch (Exception e) { DebugUtil.LogException(e); } }
private void DoGUI(int windowID) { try { if (State.SelectedPath != null) { // A path is selected. if (pathEditor == null || !pathEditor.IsForPath(State.SelectedPath)) { // Selected path has changed. pathEditor = State.SelectedPath.MakeEditor(); } } else { // No path is selected. if (pathEditor != null) { pathEditor = null; } } float minHeight = GetGuiMinHeight(); float minWidth = GetGuiMinWidth(); if (cameraControlsOpen) { minHeight += cameraGui.GetGuiMinHeight(); minWidth = Math.Max(minWidth, cameraGui.GetGuiMinWidth()); } if (pathEditor != null) { minHeight = Math.Max(minHeight, pathEditor.GetGuiMinHeight()); minWidth += pathEditor.GetGuiMinWidth(); } resizer.MinHeight = minHeight; resizer.MinWidth = minWidth; GUILayout.BeginVertical(); // BEGIN outer container GUILayout.BeginHorizontal(); // BEGIN left/right panes GUILayout.BeginVertical(GUILayout.MaxWidth(140)); // BEGIN main controls if (GUILayout.Button("New simple path")) { State.SelectedPath = State.NewPath(); } DoPathList(); if (GUILayout.Button("Relative to")) { vesselSelectionWindow.ShowWindow(); } bool pressed = GUILayout.Button( (cameraControlsOpen ? "\u25bd" : "\u25b9") + " Camera controls", C.FoldButtonStyle); cameraControlsOpen = cameraControlsOpen ^ pressed; if (cameraControlsOpen) { cameraGui.DoGUI(); } GUILayout.EndVertical(); // END main controls // Path editor lives in right-hand-frame. if (pathEditor != null) { pathEditor.DoGUI(); } GUILayout.EndHorizontal(); // END left/right panes GUILayout.BeginHorizontal(); // BEGIN lower controls if (GUILayout.Button("Save")) { State.SavePaths(); } if (GUILayout.Button("Load")) { State.LoadPaths(); } if (GUILayout.Button("Config\u2026")) { configWindow.ToggleWindow(); } GUILayout.FlexibleSpace(); if (GUILayout.Button("?", C.WindowButtonStyle)) { helpWindow.ToggleWindow(); } DoCloseButton(); resizer.HandleResize(); GUILayout.EndHorizontal(); // END lower controls GUILayout.EndVertical(); // END outer container GUI.DragWindow(new Rect(0, 0, 10000, 25)); } catch (Exception e) { DebugUtil.LogException(e); } }