private void DrawGUI(int windowID)
        {
            try
            {
                GUILayout.BeginVertical(); // BEGIN outer container

                Transform relTrn = StateHandler.camControl.RelativeTrn;

                if (GUILayout.Toggle(relTrn == null, "Active vessel"))
                {
                    relTrn = null;
                }
                GUILayout.BeginScrollView(vesselListScroll); // BEGIN vessel list scroller
                GUILayout.BeginVertical();                   // BEGIN vessel list
                foreach (Vessel vessel in FlightGlobals.Vessels)
                {
                    bool isVesselSelected = object.ReferenceEquals(relTrn, vessel.transform);
                    if (vessel.loaded && GUILayout.Toggle(isVesselSelected, vessel.name))
                    {
                        relTrn = vessel.transform;
                    }
                }
                GUILayout.EndVertical();   // END vessel list
                GUILayout.EndScrollView(); // END vessel list scroller

                StateHandler.camControl.RelativeTrn = relTrn;

                GUILayout.BeginHorizontal(); // BEGIN lower controls
                GUILayout.FlexibleSpace();

                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);
            }
        }
Example #2
0
        private void DrawGUI(int windowID)
        {
            try
            {
                GUILayout.BeginVertical(); // BEGIN outer container

                // BEGIN vertical scroll.
                scroll = GUILayout.BeginScrollView(scroll);

                foreach (var kb in StateHandler.keyBindings.Bindings())
                {
                    DoBinding(kb);
                }

                KerbCamLauncherButton.Instance.ShowButton = StateHandler.stockToolbar = GUILayout.Toggle(StateHandler.stockToolbar, "Use Stock toolbar");

                StateHandler.developerMode = GUILayout.Toggle(StateHandler.developerMode, "Developer mode - enables experimental features.");

                GUILayout.EndScrollView();
                // END vertical scroll.

                GUILayout.BeginHorizontal(); // BEGIN lower controls
                if (GUILayout.Button("Save"))
                {
                    StateHandler.SaveConfig();
                }
                if (GUILayout.Button("Load"))
                {
                    StateHandler.LoadConfig();
                }
                GUILayout.FlexibleSpace();
                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);
            }
        }
Example #3
0
        private void DrawGUI(int windowID)
        {
            try
            {
                GUILayout.BeginVertical(); // BEGIN outer container

                GUILayout.Label(string.Format(
                                    "KerbCam [v{0}]", KerbCamGlobals.assembly.GetName().Version.ToString()));

                // BEGIN text scroller.
                helpScroll = GUILayout.BeginScrollView(helpScroll);
                GUILayout.TextArea(helpText);
                GUILayout.EndScrollView(); // END text scroller.

                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();

                /*
                 * if (GUILayout.Button("Kerbcam on Spaceport", WindowStyles.LinkButtonStyle))
                 * {
                 *  Application.OpenURL("http://kerbalspaceport.com/kerbcam/");
                 * }*/
                if (GUILayout.Button("Report issue", WindowStyles.LinkButtonStyle))
                {
                    Application.OpenURL("https://github.com/cartman09/kerbcam/issues");
                }

                DrawCloseButton();

                resizer.HandleResize();
                GUILayout.EndHorizontal();

                GUILayout.EndVertical(); // END outer container

                GUI.DragWindow(new Rect(0, 0, 10000, 25));
            }
            catch (Exception e)
            {
                DebugUtil.LogException(e);
            }
        }
Example #4
0
        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);
            }
        }