Ejemplo n.º 1
0
        internal static void Display(int windowId)
        {
            // Reset Tooltip active flag...
            ToolTipActive = false;
            ShowToolTips  = Settings.ManifestToolTips;

            GUIContent label = new GUIContent("", "Close Window");

            if (SMAddon.crewXfer || SMAddon.XferOn)
            {
                label       = new GUIContent("", "Action in progress.  Cannot close window");
                GUI.enabled = false;
            }
            Rect rect = new Rect(296, 4, 16, 16);

            if (GUI.Button(rect, label))
            {
                SMAddon.OnSMButtonToggle();
                ToolTip = "";
            }
            if (Event.current.type == EventType.Repaint && ShowToolTips == true)
            {
                ToolTip = Utilities.SetActiveTooltip(rect, Settings.ManifestPosition, GUI.tooltip, ref ToolTipActive, 0, 0);
            }
            GUI.enabled = true;
            try
            {
                GUILayout.BeginVertical();
                SMScrollViewerPosition = GUILayout.BeginScrollView(SMScrollViewerPosition, GUILayout.Height(100), GUILayout.Width(300));
                GUILayout.BeginVertical();

                if (SMAddon.smController.IsPreLaunch)
                {
                    PreLaunchGUI();
                }

                // Now the Resource Buttons
                ResourceButtonList();

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

                GUILayout.Label(SMAddon.smController.SelectedResource != null ? string.Format("{0}", SMAddon.smController.SelectedResource) : "No Resource Selected", GUILayout.Width(300), GUILayout.Height(20));

                // Resource Details List Viewer
                ResourceDetailsViewer();

                GUILayout.BeginHorizontal();

                var settingsStyle = Settings.ShowSettings ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle;
                if (GUILayout.Button("Settings", settingsStyle, GUILayout.Height(20)))
                {
                    try
                    {
                        Settings.ShowSettings = !Settings.ShowSettings;
                        if (Settings.ShowSettings)
                        {
                            // Store settings in case we cancel later...
                            Settings.StoreTempSettings();
                        }
                    }
                    catch (Exception ex)
                    {
                        Utilities.LogMessage(string.Format(" opening Settings Window.  Error:  {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), "Error", true);
                    }
                }

                var rosterStyle = Settings.ShowRoster ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle;
                if (GUILayout.Button("Roster", rosterStyle, GUILayout.Height(20)))
                {
                    try
                    {
                        Settings.ShowRoster = !Settings.ShowRoster;
                        if (!Settings.ShowRoster)
                        {
                            WindowRoster.SelectedKerbal = null;
                            WindowRoster.ToolTip        = "";
                        }
                    }
                    catch (Exception ex)
                    {
                        Utilities.LogMessage(string.Format(" opening Roster Window.  Error:  {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), "Error", true);
                    }
                }

                var controlStyle = Settings.ShowControl ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle;
                if (GUILayout.Button("Control", controlStyle, GUILayout.Height(20)))
                {
                    try
                    {
                        Settings.ShowControl = !Settings.ShowControl;
                    }
                    catch (Exception ex)
                    {
                        Utilities.LogMessage(string.Format(" opening Control Window.  Error:  {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), "Error", true);
                    }
                }
                GUILayout.EndHorizontal();
                GUILayout.EndVertical();
                GUI.DragWindow(new Rect(0, 0, Screen.width, 30));
            }
            catch (Exception ex)
            {
                Utilities.LogMessage(string.Format(" in Ship Manifest Window.  Error:  {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), "Error", true);
            }
        }