Пример #1
0
        internal static void Display(int windowId)
        {
            Title = SMUtils.Localize("#smloc_roster_001");

            // set input locks when mouseover window...
            //_inputLocked = GuiUtils.PreventClickthrough(ShowWindow, Position, _inputLocked);

            // Reset Tooltip active flag...
            ToolTipActive = false;

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

            if (GUI.Button(rect, new GUIContent("", SMUtils.Localize("#smloc_window_tt_001")))) // "Close Window"
            {
                OnCreate       = false;
                SelectedKerbal = null;
                ToolTip        = "";
                if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
                {
                    SMAddon.OnSmRosterClicked();
                }
                else
                {
                    ShowWindow = false;
                }
            }

            if (Event.current.type == EventType.Repaint && ShowToolTips)
            {
                ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10);
            }
            try
            {
                GUILayout.BeginVertical();
                DisplayRosterFilter();

                DisplayRosterListViewer();

                if (OnCreate)
                {
                    CreateKerbalViewer();
                }
                else if (SelectedKerbal != null)
                {
                    EditKerbalViewer();
                }
                else
                {
                    GUILayout.BeginHorizontal();
                    GUI.enabled = SMSettings.EnableCrewModify;
                    GUIContent guilabel = new GUIContent(SMUtils.Localize("#smloc_roster_002"), GUI.enabled // "Create Kerbal"
            ? SMUtils.Localize("#smloc_roster_tt_001")                                                      // Realistic Control is On.  Create a Kerbal is disabled.
            : SMUtils.Localize("#smloc_roster_tt_022"));                                                    // "Opens the Kerbal creation editor."
                    if (GUILayout.Button(guilabel, GUILayout.MaxWidth(120), GUILayout.Height(20)))
                    {
                        OnCreate = true;
                    }
                    rect = GUILayoutUtility.GetLastRect();
                    if (Event.current.type == EventType.Repaint && ShowToolTips)
                    {
                        ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10);
                    }
                    GUILayout.EndHorizontal();
                    GUI.enabled = true;
                }

                GUILayout.EndVertical();
                GUI.DragWindow(new Rect(0, 0, Screen.width, 30));
                SMAddon.RepositionWindow(ref Position);
            }
            catch (Exception ex)
            {
                SMUtils.LogMessage(string.Format(" in Roster Window.  Error:  {0} \r\n\r\n{1}", ex.Message, ex.StackTrace),
                                   SMUtils.LogType.Error, true);
            }
        }