protected virtual void OnErrorRender()
        {
            GUILayout.BeginVertical();

            GUILayoutOption maxWidth   = GUILayout.MaxWidth(this.window.width);
            GUILayoutOption lockWidth  = GUILayout.ExpandWidth(false);
            GUILayoutOption lockHeight = GUILayout.ExpandHeight(false);

            GUILayoutOption informationLabelMaxHeight = GUILayout.MaxHeight(this.window.height * 0.75f);    // Magically use 3/4ths of the window for the top information label.

            GUILayout.Label(string.Format(CultureInfo.CurrentCulture, Localized.GuiRenderErrorTextFormat, Version.FriendlyName), maxWidth, informationLabelMaxHeight, lockWidth, lockHeight);

            // Fix up the path for the current environment.
            string platformCompatibleRootPath = KSPUtil.ApplicationRootPath.Replace('/', Path.DirectorySeparatorChar);
            // Trim off the extra path components to get the actual KSP root path.
            string actualRootPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(platformCompatibleRootPath)));
            string kspDataPath    = Path.Combine(actualRootPath, "KSP_Data");
            string kspLogFile     = Path.Combine(kspDataPath, "output_log.txt");

            GUIStyle textFieldStyle = new GUIStyle();

            textFieldStyle.wordWrap         = true;
            textFieldStyle.normal.textColor = Color.white;

            GUILayoutOption informationFieldMaxHeight = GUILayout.MaxHeight(this.window.height * 0.25f);    // Magically use 1/4th of the window for the bottom information field.

            GUILayout.TextField(kspLogFile, textFieldStyle, maxWidth, informationFieldMaxHeight, lockWidth, lockHeight);

            GUILayout.EndVertical();
        }
Beispiel #2
0
        private void OnMainWindow(int windowID)
        {
            GUIStyle style = new GUIStyle(GUI.skin.toggle);

            GUILayout.BeginVertical();
            GUILayout.TextArea("Hello World!", GUILayout.ExpandHeight(true), GUILayout.MaxHeight(100));
            GUILayout.EndVertical();
            GUI.DragWindow();
        }
Beispiel #3
0
        void OnGUI()
        {
            if (!active)
            {
                return;
            }

            if (Time.realtimeSinceStartup - lastTimeTic > 0.25)
            {
                active = false;
                return;
            }

            // The settings are only available in the space center
            GUI.skin     = HighLogic.Skin;
            settingsRect = GUILayout.Window("HotKeySettings".GetHashCode(),
                                            settingsRect,
                                            SettingsWindowFcn,
                                            "EVA Fuel Settings",
                                            GUILayout.ExpandWidth(true),
                                            GUILayout.ExpandHeight(true));
        }
Beispiel #4
0
        /*
         * Main window
         */
        private void HandleMainWindow(int windowID)
        {
            GUIStyle _settingsToggleGroupStyle = new GUIStyle(GUI.skin.toggle);

            _settingsToggleGroupStyle.margin.left += 40;

            //save Window Position
            _config.MainWindowXPosition = (int)_editorMainWindow.xMin;
            _config.MainWindowYPosition = (int)_editorMainWindow.yMin;

            GUILayout.BeginVertical();
            GUILayout.EndVertical();
            GUILayout.BeginVertical();

            if (GUILayout.Button(Constants.guiSettingsGUIContent, GUILayout.MaxWidth(160)))
            {
                _mainWindowsSettingsMode = !_mainWindowsSettingsMode;
            }
            //Settings
            if (_mainWindowsSettingsMode)
            {
                _editorMainWindow.height         = Constants.guiMainWindowHSettingsExpanded;
                _settingsScrollPosition          = GUILayout.BeginScrollView(_settingsScrollPosition);
                _config.includeAllNodes          = GUILayout.Toggle(_config.includeAllNodes, Constants.guiAllNodesGUIContent);
                Welder.includeAllNodes           = _config.includeAllNodes;
                _config.dontProcessMasslessParts = GUILayout.Toggle(_config.dontProcessMasslessParts, Constants.guiDontProcessMasslessPartsGUIContent);
                Welder.dontProcessMasslessParts  = _config.dontProcessMasslessParts;
                _config.dataBaseAutoReload       = GUILayout.Toggle(_config.dataBaseAutoReload, Constants.guiDbAutoReloadGUIContent);
                _config.useNamedCfgFile          = GUILayout.Toggle(_config.useNamedCfgFile, Constants.guiUseNamedCfgFileGUIContent);
                _config.advancedDebug            = GUILayout.Toggle(_config.advancedDebug, Constants.guiAdvancedDebugGUIContent);
                _config.clearEditor        = GUILayout.Toggle(_config.clearEditor, Constants.guiClearEditorGUIContent);
                _config.fileSimplification = GUILayout.Toggle(_config.fileSimplification, Constants.guiFileSimplificationGUIContent);
                Welder.fileSimplification  = _config.fileSimplification;
                GUILayout.Space(10.0f);
                GUILayout.Label(" Vector Precision: " + _config.precisionDigits);
                _config.precisionDigits = (int)GUILayout.HorizontalSlider(_config.precisionDigits, 1, 6);
                Welder.precisionDigits  = _config.precisionDigits;
                GUILayout.Space(10.0f);
                GUILayout.Label("Strength params calculation method");
//				_config.StrengthCalcMethod = (StrengthParamsCalcMethod)GUILayout.SelectionGrid((int)_config.StrengthCalcMethod, Constants.StrengthParamsCalcMethodsGUIContent, 1, GUILayout.MaxWidth(140));
                foreach (StrengthParamsCalcMethod method in Enum.GetValues(typeof(StrengthParamsCalcMethod)))
                {
                    if (GUILayout.Toggle((_config.StrengthCalcMethod == method), Constants.StrengthParamsCalcMethodsGUIContent[(int)method], _settingsToggleGroupStyle))
                    {
                        _config.StrengthCalcMethod = method;
                        Welder.StrengthCalcMethod  = method;
                    }
                }
                GUILayout.Space(10.0f);
                GUILayout.Label("MaxTemp calculation method");
//				_config.MaxTempCalcMethod = (MaxTempCalcMethod)GUILayout.SelectionGrid((int)_config.MaxTempCalcMethod, Constants.MaxTempCalcMethodsGUIContent, 1, GUILayout.MaxWidth(140));
                foreach (MaxTempCalcMethod method in Enum.GetValues(typeof(MaxTempCalcMethod)))
                {
                    if (GUILayout.Toggle((_config.MaxTempCalcMethod == method), Constants.MaxTempCalcMethodsGUIContent[(int)method], _settingsToggleGroupStyle))
                    {
                        _config.MaxTempCalcMethod = method;
                        Welder.MaxTempCalcMethod  = method;
                    }
                }
                GUILayout.EndScrollView();

//				GUILayout.Space(10.0f);
                if (GUILayout.Button(Constants.guiSaveSettingsButtonGUIContent, GUILayout.MaxWidth(160)))
                {
                    FileManager.saveConfig(_config);
                    _config = FileManager.loadConfig();
                }
            }
            else
            {
                _editorMainWindow.height = Constants.guiMainWindowH;
                GUILayout.Space(20.0f);
            }

            //SelectPArtbranch button
            if (GUILayout.RepeatButton(Constants.guiSelectPartGUIContent, GUILayout.MaxWidth(160)))
            {
                this.state = DisplayState.partSelection;
            }

            //Weld button
            if (GUILayout.Button(Constants.guiWeldItButtonGUIContent, GUILayout.MaxWidth(160)))
            {
                FileManager.saveConfig(_config);

                if (EditorLockManager.isEditorLocked())
                {
                    if (_selectedPartbranch == null)
                    {
                        _selectedPartbranch = EditorLogic.RootPart;
                    }
                    repositionPreWeldment(_selectedPartbranch);
                    weldPart(_selectedPartbranch);
                }
            }
            if (GUILayout.Button(Constants.guiCloseGUIContent, GUILayout.MaxWidth(160)))
            {
                closeMainwindow();
            }
            //Hints area
            GUILayout.TextArea(GUI.tooltip, GUILayout.ExpandHeight(true), GUILayout.MaxHeight(100));
            GUIStyle VersionLabelGUIStyle = new GUIStyle(GUI.skin.label);

            VersionLabelGUIStyle.fontSize = 12;
            GUILayout.Label(Constants.logVersion, VersionLabelGUIStyle);
            GUILayout.EndVertical();

            GUI.DragWindow();
        }         //private void OnMainWindow()
Beispiel #5
0
 public void OnGUI()
 {
     if (Settings.guiIsActive && !isHideUI)
     {
         GUI.skin = HighLogic.Skin;
         // on showConfigs changed: resize window, save config
         if (Settings.showConfigs != showConfigs)
         {
             Settings.guiwindowPosition.height = 50;
             Settings.showConfigs = showConfigs;
             Settings.SaveToXml();
         }
         // on vessel type changed: resize window
         if (vesselType != Gpws.ActiveVesselType)
         {
             Settings.guiwindowPosition.height = 50;
         }
         // draw
         Settings.guiwindowPosition = GUILayout.Window("GPWSSetting".GetHashCode(), Settings.guiwindowPosition,
                                                       WindowFunc, "GPWS Setting", GUILayout.ExpandHeight(true));
     }
 }
        private void OnGUI()
        {
            if (WindowVisable)
            {
                //Set the GUI Skin
                //GUI.skin = HighLogic.Skin;
                CLSStyles.SetupGuiStyles();

                _windowPosition = GUILayout.Window(947695, _windowPosition, OnWindow, _clsLocTitle, _windowStyle, GUILayout.MinHeight(80), GUILayout.MinWidth(400), GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true), GUILayout.Width(400), GUILayout.Height(80));
                if (!_optionsVisible)
                {
                    return;
                }
                if (_windowOptionsPosition == new Rect(0, 0, 0, 0))
                {
                    _windowOptionsPosition = new Rect(_windowPosition.x + _windowPosition.width + 10, _windowPosition.y, 260, 120);
                }
                _windowOptionsPosition = GUILayout.Window(947696, _windowOptionsPosition, DisplayOptionWindow, _clsLocOptions, _windowStyle, GUILayout.MinHeight(120), GUILayout.ExpandWidth(true));
            }
            else
            {
                if (WindowSelectedSpace <= -1)
                {
                    return;
                }
                _vessel.Spaces[WindowSelectedSpace].Highlight(false);
                WindowSelectedSpace = -1;
            }
        }