コード例 #1
0
        internal static void Display(int windowId)
        {
            Title = SmUtils.SmTags["#smloc_settings_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);

            // "Close Window.\r\nSettings will not be immediately saved,\r\n but will be remembered while in game.")))
            if (GUI.Button(rect, new GUIContent("", SmUtils.SmTags["#smloc_settings_tt_001"])))
            {
                ToolTip = "";
                if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
                {
                    SMAddon.OnSmSettingsClicked();
                }
                else
                {
                    SMSettings.MemStoreTempSettings();
                    ShowWindow = false;
                }
            }
            if (Event.current.type == EventType.Repaint && ShowToolTips)
            {
                ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10);
            }

            GUILayout.BeginVertical();

            DisplayTabButtons();

            _displayViewerPosition = GUILayout.BeginScrollView(_displayViewerPosition, SMStyle.ScrollStyle,
                                                               GUILayout.Height(300), GUILayout.Width(380));
            GUILayout.BeginVertical();

            DisplaySelectedTab(_displayViewerPosition);

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

            DisplayActionButtons();

            GUILayout.EndVertical();

            GUI.DragWindow(new Rect(0, 0, Screen.width, 30));
            SMAddon.RepositionWindow(ref Position);
        }
コード例 #2
0
        internal static void Display(int windowId)
        {
            Title = SMUtils.Localize("#smloc_control_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"
            {
                ShowWindow = false;
                ToolTip    = "";
            }
            if (Event.current.type == EventType.Repaint && ShowToolTips)
            {
                ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10);
            }

            // This is a scroll panel (we are using it to make button lists...)
            GUILayout.BeginVertical();
            DisplayWindowTabs();

            // This is a scroll panel (we are using it to make button lists...)
            _displayViewerPosition = GUILayout.BeginScrollView(_displayViewerPosition, SMStyle.ScrollStyle,
                                                               GUILayout.Height(200), GUILayout.Width(380));
            DisplaySelectedTab(_displayViewerPosition);
            GUILayout.EndScrollView();

            DisplayTabActions();
            GUILayout.EndVertical();

            GUI.DragWindow(new Rect(0, 0, Screen.width, 30));
            SMAddon.RepositionWindow(ref Position);
        }
コード例 #3
0
        internal static void Display(int windowId)
        {
            Title = string.Format("{0} {1} - {2}", SMUtils.Localize("#smloc_manifest_002"), SMSettings.CurVersion, SMAddon.SmVessel.Vessel.vesselName);

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

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

            //GUIContent label = new GUIContent("", "Close Window");
            GUIContent label = new GUIContent("", SMUtils.Localize("#smloc_window_tt_001"));

            if (SMConditions.IsTransferInProgress())
            {
                //label = new GUIContent("", "Action in progress.  Cannot close window");
                label       = new GUIContent("", SMUtils.Localize("#smloc_window_tt_002"));
                GUI.enabled = false;
            }
            Rect rect = new Rect(Position.width - 20, 4, 16, 16);

            if (GUI.Button(rect, label))
            {
                SMAddon.OnSmButtonClicked();
                ToolTip = "";
                SMHighlighter.Update_Highlighter();
            }
            if (Event.current.type == EventType.Repaint && ShowToolTips)
            {
                ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10);
            }
            GUI.enabled = true;
            try
            {
                GUILayout.BeginVertical();
                _smScrollViewerPosition = GUILayout.BeginScrollView(_smScrollViewerPosition, SMStyle.ScrollStyle,
                                                                    GUILayout.Height(100), GUILayout.Width(300));
                GUILayout.BeginVertical();

                // Prelaunch (landed) Gui
                if (SMConditions.IsInPreflight())
                {
                    PreLaunchGui();
                }

                // Now the Resource Buttons
                ResourceButtonsList();

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

                //string resLabel = "No Resource Selected";
                string resLabel = SMUtils.Localize("#smloc_manifest_003");
                if (SMAddon.SmVessel.SelectedResources.Count == 1)
                {
                    resLabel = SMAddon.SmVessel.SelectedResources[0];
                }
                else if (SMAddon.SmVessel.SelectedResources.Count == 2)
                {
                    //resLabel = "Multiple Resources selected";
                    resLabel = SMUtils.Localize("#smloc_manifest_004");
                }
                GUILayout.Label(string.Format("{0}", resLabel), GUILayout.Width(300), GUILayout.Height(20));

                // Resource Details List Viewer
                ResourceDetailsViewer();

                // Window toggle Button List
                WindowToggleButtons();

                GUILayout.EndVertical();
                GUI.DragWindow(new Rect(0, 0, Screen.width, 30));
                SMAddon.RepositionWindow(ref Position);
            }
            catch (Exception ex)
            {
                if (!SMAddon.FrameErrTripped)
                {
                    SMUtils.LogMessage(
                        string.Format(" in WindowManifest.Display.  Error:  {0} \r\n\r\n{1}", ex.Message, ex.StackTrace),
                        SMUtils.LogType.Error, true);
                    SMAddon.FrameErrTripped = true;
                }
            }
        }
コード例 #4
0
ファイル: WindowRoster.cs プロジェクト: h0yer/ShipManifest
        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);
            }
        }
コード例 #5
0
        internal static void Display(int windowId)
        {
            Title = $"{SmUtils.SmTags["#smloc_debug_000"]}:  {SMSettings.CurVersion}";

            // 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.SmTags["#smloc_window_tt_001"]))) // "Close Window"
            {
                ShowWindow = false;
                SMSettings.MemStoreTempSettings();
                ToolTip = "";
            }
            if (Event.current.type == EventType.Repaint && ShowToolTips)
            {
                ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10);
            }

            GUILayout.BeginVertical();
            SmUtils.DebugScrollPosition = GUILayout.BeginScrollView(SmUtils.DebugScrollPosition, SMStyle.ScrollStyle,
                                                                    GUILayout.Height(300), GUILayout.Width(500));
            GUILayout.BeginVertical();

            List <string> .Enumerator errors = SmUtils.LogItemList.GetEnumerator();
            while (errors.MoveNext())
            {
                if (errors.Current == null)
                {
                    continue;
                }
                GUILayout.TextArea(errors.Current, GUILayout.Width(460));
            }
            errors.Dispose();

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

            GUILayout.BeginHorizontal();
            if (GUILayout.Button(SmUtils.SmTags["#smloc_debug_001"], GUILayout.Height(20))) //"Clear log"
            {
                SmUtils.LogItemList.Clear();
                SmUtils.LogItemList.Add($"Info:  Log Cleared at {DateTime.UtcNow.ToString(CultureInfo.InvariantCulture)} UTC.");
            }
            if (GUILayout.Button(SmUtils.SmTags["#smloc_debug_002"], GUILayout.Height(20))) // "Save Log"
            {
                // Create log file and save.
                Savelog();
            }
            if (GUILayout.Button(SmUtils.SmTags["#smloc_debug_003"], GUILayout.Height(20))) // "Close"
            {
                // Create log file and save.
                ShowWindow = false;
                SMSettings.MemStoreTempSettings();
            }
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
            GUI.DragWindow(new Rect(0, 0, Screen.width, 30));
            SMAddon.RepositionWindow(ref Position);
        }