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(); }
private void windowGUI(int ID) { GUILayout.BeginVertical(); SmokeScreenConfig.Instance.globalCollideDisable = GUILayout.Toggle(SmokeScreenConfig.Instance.globalCollideDisable, "Globally disable Collide"); SmokeScreenConfig.Instance.globalPhysicalDisable = GUILayout.Toggle(SmokeScreenConfig.Instance.globalPhysicalDisable, "Globally disable Physical"); SmokeScreenConfig.Instance.forceEmitOnUpdate = GUILayout.Toggle(SmokeScreenConfig.Instance.forceEmitOnUpdate, "Globally force emitOnUpdate"); SmokeScreenConfig.Instance.forceDecluster = GUILayout.Toggle(SmokeScreenConfig.Instance.forceDecluster, "Globally force decluster"); SmokeScreenConfig.Instance.shareManualInput = GUILayout.Toggle(SmokeScreenConfig.Instance.shareManualInput, "Share manual input values across effects"); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label("maximumActiveParticles", GUILayout.ExpandWidth(true)); int.TryParse( GUILayout.TextField( SmokeScreenConfig.Instance.maximumActiveParticles.ToString(), GUILayout.ExpandWidth(true), GUILayout.Width(100)), out SmokeScreenConfig.Instance.maximumActiveParticles); GUILayout.EndHorizontal(); // 'SmokeScreenConfig.activeParticles' isn't accurate anymore int activeParticles = 0; ModelMultiShurikenPersistFX.List.ForEach(x => activeParticles += x.CurrentlyActiveParticles); GUILayout.Label($"Active particles: {activeParticles}"); GUILayout.Space(10); GUILayout.Label("Open ModelMultiShurikenPersistFX UI :"); foreach (var mmFX in ModelMultiShurikenPersistFX.List) { if (mmFX.hostPart != null) { // Changed to string interpolation, and added current particle count alongside max particle count per plume mmFX.showUI = GUILayout.Toggle( mmFX.showUI, $"{mmFX.hostPart.name}: {mmFX.effectName}, {mmFX.instanceName}: {mmFX.CurrentlyActiveParticles} ({mmFX.MaxActiveParticles} max)" ); } } GUILayout.EndVertical(); GUI.DragWindow(); }
private void DrawBlacklistGUI(int windowID) { GUILayout.BeginVertical(); scrollPos = GUILayout.BeginScrollView(scrollPos, HighLogic.Skin.textArea, GUILayout.Height(Screen.height / 4)); foreach (string s in Settings.Instance.BlackList.ignore) { GUILayout.BeginHorizontal(); GUILayout.Label(s); if (GUILayout.Button("Remove", GUILayout.ExpandWidth(false))) { Settings.Instance.BlackList.Remove(s); break; } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(); tempListItem = GUILayout.TextField(tempListItem); if (GUILayout.Button("Add", GUILayout.ExpandWidth(false))) { Settings.Instance.BlackList.Add(tempListItem); tempListItem = ""; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Save")) { Settings.Instance.BlackList.Save(); showBlacklist = false; } if (GUILayout.Button("Cancel")) { Settings.Instance.BlackList.Load(); showBlacklist = false; } GUILayout.EndHorizontal(); GUILayout.EndVertical(); if (!Input.GetMouseButtonDown(1) && !Input.GetMouseButtonDown(2)) { GUI.DragWindow(); } }
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)); }
void OnWindowGUI(int id) { GUI.skin = HighLogic.Skin; Historian historian = Historian.Instance; // column one using (GUILayout.AreaScope columnOne = new GUILayout.AreaScope(new Rect(15, 20, 380, 550))) { using (GUILayout.VerticalScope col = new GUILayout.VerticalScope()) { GUILayout.Space(20); historian.Suppressed = GUILayout.Toggle(historian.Suppressed, Localizer.GetStringByTag("#Historian_Suppressed")); historian.AlwaysActive = GUILayout.Toggle(historian.AlwaysActive, Localizer.GetStringByTag("#Historian_AlwaysActive")); historian.AutoHideUI = GUILayout.Toggle(historian.AutoHideUI, Localizer.GetStringByTag("#Historian_AutoHideUI")); Configuration.Instance.AutoHideUI = historian.AutoHideUI; Configuration.Instance.PersistentConfigurationWindow = GUILayout.Toggle(Configuration.Instance.PersistentConfigurationWindow, Localizer.GetStringByTag("#Historian_AlwaysShowConfigWindow")); Configuration.Instance.EnableLauncherButton = GUILayout.Toggle(Configuration.Instance.EnableLauncherButton, Localizer.GetStringByTag("#Historian_UseAppLauncher")); Configuration.Instance.EnableToolbarButton = GUILayout.Toggle(Configuration.Instance.EnableToolbarButton, Localizer.GetStringByTag("#Historian_UseToolbar")); GUILayout.Space(10); using (GUILayout.HorizontalScope layout = new GUILayout.HorizontalScope()) { int rightClickOptionsCount = 4; //GUILayout.Space(40); GUILayout.Label(Localizer.GetStringByTag("#Historian_RightClickAction")); GUILayout.Space(10); if (GUILayout.Button(previousButtonTexture, GUILayout.Width(20), GUILayout.Height(GUI.skin.label.lineHeight))) { Configuration.Instance.RightClickAction = (RightClickAction)Mathf.Clamp((int)Configuration.Instance.RightClickAction - 1, 0, rightClickOptionsCount - 1); } else if (GUILayout.Button(nextButtonTexture, GUILayout.Width(20), GUILayout.Height(GUI.skin.label.lineHeight))) { Configuration.Instance.RightClickAction = (RightClickAction)Mathf.Clamp((int)Configuration.Instance.RightClickAction + 1, 0, rightClickOptionsCount - 1); } GUILayout.Space(5); GUILayout.Label(Configuration.Instance.RightClickAction.ToString(), GUI.skin.textArea, GUILayout.ExpandWidth(true)); } ManageButtons(); GUILayout.Space(10); using (GUILayout.HorizontalScope layout = new GUILayout.HorizontalScope()) { GUILayout.Label(Localizer.GetStringByTag("#Historian_Layout")); GUILayout.Space(10); string[] layouts = historian.GetLayoutNames(); if (GUILayout.Button(previousButtonTexture, GUILayout.Width(20), GUILayout.Height(GUI.skin.label.lineHeight))) { historian.CurrentLayoutIndex = Mathf.Clamp(historian.CurrentLayoutIndex - 1, 0, layouts.Length - 1); } else if (GUILayout.Button(nextButtonTexture, GUILayout.Width(20), GUILayout.Height(GUI.skin.label.lineHeight))) { historian.CurrentLayoutIndex = Mathf.Clamp(historian.CurrentLayoutIndex + 1, 0, layouts.Length - 1); } GUILayout.Space(5); GUILayout.Label(historian.GetCurrentLayoutName(), GUI.skin.textArea, GUILayout.ExpandWidth(true)); } GUILayout.Space(10); using (GUILayout.HorizontalScope customHead = new GUILayout.HorizontalScope()) { GUILayout.Label(Localizer.GetStringByTag("#Historian_CustomText")); GUILayout.FlexibleSpace(); Configuration.Instance.PersistentCustomText = GUILayout.Toggle(Configuration.Instance.PersistentCustomText, Localizer.GetStringByTag("#Historian_Persistent"), GUILayout.Width(120)); } Configuration.Instance.CustomText = GUILayout.TextArea(Configuration.Instance.CustomText, GUI.skin.textArea, GUILayout.Height(60)); GUILayout.Space(10); using (GUILayout.HorizontalScope spaceCentre = new GUILayout.HorizontalScope()) { GUILayout.Label(Localizer.GetStringByTag("#Historian_DefaultSpaceCenterLabel")); GUILayout.FlexibleSpace(); Configuration.Instance.DefaultSpaceCenterName = GUILayout.TextField(Configuration.Instance.DefaultSpaceCenterName, GUI.skin.textArea, GUILayout.Width(150)); } GUILayout.Space(10); GUILayout.Label($"{Localizer.GetStringByTag("#Historian_LastActionTime")}: {Configuration.Instance.TimeToRememberLastAction} ms"); Configuration.Instance.TimeToRememberLastAction = (int)GUILayout.HorizontalSlider(Configuration.Instance.TimeToRememberLastAction, 250, 10000, GUILayout.ExpandWidth(true)); } } // column two using (GUILayout.AreaScope columnTwo = new GUILayout.AreaScope(new Rect(410, 20, 220, 500))) { using (GUILayout.VerticalScope col = new GUILayout.VerticalScope()) { GUILayout.Space(20); GUILayout.Label(Localizer.GetStringByTag("#Historian_DayNames")); for (int i = 0; i < Configuration.Instance.KerbinDayNames.Length; i++) { using (GUILayout.HorizontalScope item = new GUILayout.HorizontalScope()) { GUILayout.Label($"{i + 1}:"); GUILayout.FlexibleSpace(); Configuration.Instance.KerbinDayNames[i] = GUILayout.TextField(Configuration.Instance.KerbinDayNames[i], GUI.skin.textArea, GUILayout.Width(190f)); } } GUILayout.Space(50); GUILayout.Label(Localizer.GetStringByTag("#Historian_DefaultEmptyCrewSlot")); GUILayout.Space(10); using (GUILayout.HorizontalScope noCrewLabel = new GUILayout.HorizontalScope()) { GUILayout.Label(Localizer.GetStringByTag("#Historian_CrewedLabel")); GUILayout.FlexibleSpace(); Configuration.Instance.DefaultNoCrewLabel = GUILayout.TextField(Configuration.Instance.DefaultNoCrewLabel, GUI.skin.textArea, GUILayout.Width(120)); } using (GUILayout.HorizontalScope noCrewLabel = new GUILayout.HorizontalScope()) { GUILayout.Label(Localizer.GetStringByTag("#Historian_UncrewedLabel")); GUILayout.FlexibleSpace(); Configuration.Instance.DefaultUnmannedLabel = GUILayout.TextField(Configuration.Instance.DefaultUnmannedLabel, GUI.skin.textArea, GUILayout.Width(120)); } } } // column three using (GUILayout.AreaScope columnThree = new GUILayout.AreaScope(new Rect(660, 20, 220, 480))) { using (GUILayout.VerticalScope col = new GUILayout.VerticalScope()) { GUILayout.Space(20); GUILayout.Label(Localizer.GetStringByTag("#Historian_MonthNames")); for (int i = 0; i < Configuration.Instance.KerbinMonthNames.Length; i++) { using (GUILayout.HorizontalScope item = new GUILayout.HorizontalScope()) { GUILayout.Label($"{i + 1}:"); GUILayout.FlexibleSpace(); Configuration.Instance.KerbinMonthNames[i] = GUILayout.TextField(Configuration.Instance.KerbinMonthNames[i], GUI.skin.textArea, GUILayout.Width(190f)); } } } } // bottom bar using (GUILayout.AreaScope buttonBar = new GUILayout.AreaScope(new Rect(5, 525, 890, 30))) { using (GUILayout.HorizontalScope layout = new GUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); if (GUILayout.Button(Localizer.GetStringByTag("#autoLOC_900539"), GUILayout.Width(100.0f))) // #autoLOC_900539 = Load { historian.Reload(); } if (GUILayout.Button(Localizer.GetStringByTag("#autoLOC_174778"), GUILayout.Width(100.0f))) // #autoLOC_174778 = Save { Configuration.Instance.Layout = historian.GetCurrentLayoutName(); historian.SetConfiguration(Configuration.Instance); if (!Configuration.Instance.PersistentConfigurationWindow) { Toggle(); } if (!String.IsNullOrEmpty(Configuration.Instance.CustomText)) { Configuration.Instance.TokenizedCustomText = Parser.GetTokens(Configuration.Instance.CustomText); } } GUILayout.Space(20); // GUILayout.FlexibleSpace(); } } GUI.DragWindow(); }
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; } }