예제 #1
0
        private void Display(int windowId)
        {
            try
            {
                Rect rect = new Rect(position.width - 29, 4, 25, 25);
                if (GUI.Button(rect, new GUIContent("X", "Close Window")))
                {
                    showWindow = false;
                }

                GUILayout.BeginVertical();
                GUI.enabled = true;

                GUILayout.Space(10);
                foreach (SkyLabExperimentData node in SkyLabConfig.Experiments)
                {
                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button("Study " + node.Name, GUILayout.Height(30)))
                    {
                        activeLab.DoScienceThing(node);
                        showWindow = false;
                    }
                    GUILayout.Space(5);
                    GUILayout.EndHorizontal();
                }

                GUILayout.EndVertical();
                GUI.DragWindow(new Rect(0, 0, Screen.width, 30));
                LtAddon.RepositionWindow(ref position);
            }
            catch (Exception ex)
            {
                Util.LogMessage($"WindowSkyLab.Display. Error: {ex.Message} \r\n\r\n{ex.StackTrace}", Util.LogType.Error);
            }
        }
예제 #2
0
        internal static void Display(int windowId)
        {
            try
            {
                // Reset Tooltip active flag
                toolTipActive = false;

                Rect rect = new Rect(position.width - 29, 4, 25, 25);
                if (GUI.Button(rect, new GUIContent("X", "Close Window.\r\nSettings will not be saved.")))
                {
                    toolTip = "";
                    if (HighLogic.LoadedScene == GameScenes.SPACECENTER || HighLogic.LoadedSceneIsFlight)
                    {
                        LtAddon.OnToolbarButtonToggle();
                    }
                    else
                    {
                        showWindow = false;
                    }
                }
                if (Event.current.type == EventType.Repaint && showToolTips)
                {
                    toolTip = LtToolTips.SetActiveToolTip(rect, GUI.tooltip, ref toolTipActive, 10);
                }

                GUILayout.BeginVertical();

                DisplaySettings();

                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Save", GUILayout.Height(30)))
                {
                    LtSettings.SaveSettings();
                    if (HighLogic.LoadedScene == GameScenes.SPACECENTER || HighLogic.LoadedSceneIsFlight)
                    {
                        LtAddon.OnToolbarButtonToggle();
                    }
                    else
                    {
                        showWindow = false;
                    }
                }

                if (GUILayout.Button("Cancel", GUILayout.Height(30)))
                {
                    if (HighLogic.LoadedScene == GameScenes.SPACECENTER || HighLogic.LoadedSceneIsFlight)
                    {
                        LtAddon.OnToolbarButtonToggle();
                    }
                    else
                    {
                        showWindow = false;
                    }
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Reset to default", GUILayout.Height(30)))
                {
                    LtSettings.ResetSettings();
                    if (HighLogic.LoadedScene == GameScenes.SPACECENTER || HighLogic.LoadedSceneIsFlight)
                    {
                        LtAddon.OnToolbarButtonToggle();
                    }
                    else
                    {
                        showWindow = false;
                    }
                }
                GUILayout.EndHorizontal();

                GUILayout.EndVertical();
                GUI.DragWindow(new Rect(0, 0, Screen.width, 30));
                LtAddon.RepositionWindow(ref position);
            }
            catch (Exception ex)
            {
                Util.LogMessage($"WindowSettings.Display. Error: {ex.Message} \r\n\r\n{ex.StackTrace}", Util.LogType.Error);
            }
        }