Beispiel #1
0
        internal static void Display(int windowId)
        {
            // Reset Tooltip active flag...
            Rect rect = new Rect();

            ToolTipActive = false;

            rect = new Rect(371, 4, 16, 16);
            if (GUI.Button(rect, new GUIContent("", "Close Window")))
            {
                ToolTip = "";
                WindowSettings.ShowWindow = false;
            }
            if (Event.current.type == EventType.Repaint && ShowToolTips == true)
            {
                ToolTip = Utilities.SetActiveTooltip(rect, Position, GUI.tooltip, ref ToolTipActive, 0, 0);
            }

            // Store settings in case we cancel later...
            RMSettings.StoreTempSettings();

            GUILayout.BeginVertical();
            ScrollViewerPosition = GUILayout.BeginScrollView(ScrollViewerPosition, GUILayout.Height(280), GUILayout.Width(375));
            GUILayout.BeginVertical();

            DisplayOptions();

            DisplayHighlighting();

            DisplayToolTips();

            DisplayConfiguration();

            GUILayout.EndVertical();
            GUILayout.EndScrollView();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Save"))
            {
                RMSettings.SaveSettings();
                WindowSettings.ShowWindow = false;
            }
            if (GUILayout.Button("Cancel"))
            {
                // We've canclled, so restore original settings.
                RMSettings.RestoreTempSettings();
                WindowSettings.ShowWindow = false;
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();

            GUI.DragWindow(new Rect(0, 0, Screen.width, 30));
        }
Beispiel #2
0
        internal static void Display(int windowId)
        {
            // Reset Tooltip active flag...
            ToolTipActive = false;

            Rect rect = new Rect(Position.width - 20, 4, 16, 16);

            if (GUI.Button(rect, new GUIContent("", "Close Window")))
            {
                OnCreate       = false;
                SelectedKerbal = null;
                ToolTip        = "";
                if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
                {
                    RMAddon.OnRMRosterToggle();
                }
                else
                {
                    ShowWindow = false;
                }
            }
            if (Event.current.type == EventType.Repaint && ShowToolTips == true)
            {
                ToolTip = Utilities.SetActiveTooltip(rect, Position, GUI.tooltip, ref ToolTipActive, 0, 0);
            }
            try
            {
                GUIStyle style        = GUI.skin.button;
                var      defaultColor = style.normal.textColor;
                GUILayout.BeginVertical();
                DisplayRosterFilter();

                DisplayRosterListViewer();

                if (OnCreate)
                {
                    CreateKerbalViewer();
                }
                else if (SelectedKerbal != null)
                {
                    GUILayout.Label("Kerbal Manager", RMStyle.LabelStyleBoldCenter, GUILayout.Width(680));
                    DisplayTabButtons();
                    DisplaySelectedTab();
                }
                else
                {
                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button("Create Kerbal"))
                    {
                        OnCreate = true;
                    }
                    var settingsStyle = WindowSettings.ShowWindow ? RMStyle.ButtonToggledStyle : RMStyle.ButtonStyle;
                    if (GUILayout.Button("Settings", settingsStyle))
                    {
                        try
                        {
                            WindowSettings.ShowWindow = !WindowSettings.ShowWindow;
                            if (WindowSettings.ShowWindow)
                            {
                                // Store settings in case we cancel later...
                                RMSettings.StoreTempSettings();
                            }
                        }
                        catch (Exception ex)
                        {
                            Utilities.LogMessage(string.Format(" opening Settings Window.  Error:  {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), "Error", true);
                        }
                    }

                    if (RMSettings.RenameWithProfession)
                    {
                        string toolTip = "This action resets all renamed Kerbals to their KSP default professions.\r\nIt removes any non printing chars used to maintain a specific profession.\r\nUse this when you wish to revert a game save to be compatabile with KerbalStats\r\n or some other mod that creates custom professions.";
                        if (GUILayout.Button(new GUIContent("Reset Professions", toolTip)))
                        {
                            ResetKerbalProfessions();
                        }
                    }
                    rect = GUILayoutUtility.GetLastRect();
                    if (Event.current.type == EventType.Repaint && ShowToolTips == true)
                    {
                        ToolTip = Utilities.SetActiveTooltip(rect, Position, GUI.tooltip, ref ToolTipActive, 30, 30 - ScrollViewerPosition.y);
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();
                GUI.DragWindow(new Rect(0, 0, Screen.width, 30));
            }
            catch (Exception ex)
            {
                Utilities.LogMessage(string.Format(" in Roster Window.  Error:  {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), "Error", true);
            }
        }