/* * Overwrite Message */ private void HandleOverwriteDisplay(int windowID) { string welding_pathname = this.welding_pathname; // Caching the pathname GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label(Constants.guiDialOverwrite); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(welding_pathname); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(Constants.guiOK)) { WriteCfg(welding_pathname); this.state = DisplayState.savedWindow; } if (GUILayout.Button(Constants.guiCancel)) { this.state = DisplayState.infoWindow; } GUILayout.EndVertical(); GUI.DragWindow(); } //private void OnErrorDisplay()
private void DrawTitle(String text) { GUILayout.BeginHorizontal(); GUILayout.Label(text, HighLogic.Skin.label); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); }
public void drawGUI() { if (HideFMRSUI) { return; } if (!skin_init) { init_skin(); } GUI.skin = HighLogic.Skin; if (main_ui_active) { windowPos = GUILayout.Window(baseWindowID + 1, windowPos, MainGUI, "FMRS " /* + mod_vers */, GUILayout.MinWidth(100)); windowPos.x = Mathf.Clamp(windowPos.x, 0, Screen.width - windowPos.width); windowPos.y = Mathf.Clamp(windowPos.y, 0, Screen.height - windowPos.height); #if BETA && !DEBUG //************************** beta_windowPos.x = windowPos.x; beta_windowPos.y = windowPos.y + windowPos.height; beta_windowPos = ClickThruBlocker.GUILayoutWindow(baseWindowID = 3, beta_windowPos, BetaGUI, "FMRS Beta"); #endif //************************** } #if DEBUG //************************** if (main_ui_active) { debug_windowPos.x = windowPos.x; debug_windowPos.y = windowPos.y + windowPos.height; debug_windowPos = GUILayout.Window(baseWindowID + 2, debug_windowPos, DebugGUI, "FMRS Debug Info"); } #endif //************************** }
private void OnGUI() { if (!GUIEnabled) { return; } if (!initted) { InitGUIStuff(); } if (windowStyle == null) { GUI.color = Color.grey; windowStyle = new GUIStyle(HighLogic.Skin.window); windowStyle.active.background = windowStyle.normal.background; Texture2D tex = windowStyle.normal.background; Color32[] pixels = tex.GetPixels32(); for (int i = 0; i < pixels.Length; ++i) { pixels[i].a = 255; } tex.SetPixels32(pixels); tex.Apply(); windowStyle.active.background = windowStyle.focused.background = windowStyle.normal.background = tex; } WindowRect = GUILayout.Window(4946386, WindowRect, DoWindow, "Toolbar Controller", windowStyle); }
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; } }
internal void draw() { if (showWindow) { windowRect = GUILayout.Window(windowId, windowRect, drawWindow, ""); } }
void SettingsWindowFcn(int windowID) { GUILayout.BeginHorizontal(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Enter desired hotkey: "); GUILayout.Label(hotkey.ToString(), GUI.skin.textField); if (_lastKeyPressed != KeyCode.None) { hotkey = _lastKeyPressed; _lastKeyPressed = KeyCode.None; } // look at EEX GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("OK", GUILayout.Width(60))) { active = false; completed = true; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUI.DragWindow(); }
private static int DisplaySpaceButtons(int selectedSpace, string[] spaceNames) { // Selected Space options GUIContent[] options = new GUIContent[spaceNames.Length]; GUIStyle[] styles = new GUIStyle[spaceNames.Length]; int newSelectedSpace = selectedSpace; // Populate button characteristics for (int x = 0; x < spaceNames.Length; x++) { options[x] = new GUIContent(spaceNames[x]); styles[x] = new GUIStyle(newSelectedSpace == x ? CLSStyles.ButtonToggledStyle : CLSStyles.ButtonStyle); } // Build Option Buttons GUILayout.BeginVertical(); for (int x = 0; x < spaceNames.Length; x++) { if (GUILayout.Button(options[x], styles[x], GUILayout.Height(20))) { if (newSelectedSpace != x) { newSelectedSpace = x; } else { newSelectedSpace = -1; // revert to none selected. } } } GUILayout.EndVertical(); return(newSelectedSpace); }
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 DrawSettingsGUI(int windowID) { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Settings are now in the stock settings"); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("(old settings, if any, were NOT migrated)"); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Close", GUILayout.Width(60))) { showWindow = false; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUI.DragWindow(); }
public void OnGUI() { if (windowStyle == null) { GUI.color = Color.grey; windowStyle = new GUIStyle(HighLogic.Skin.window); windowStyle.active.background = windowStyle.normal.background; Texture2D tex = windowStyle.normal.background; Color32[] pixels = tex.GetPixels32(); for (int i = 0; i < pixels.Length; ++i) { pixels[i].a = 255; } tex.SetPixels32(pixels); tex.Apply(); windowStyle.active.background = windowStyle.focused.background = windowStyle.normal.background = tex; } if (!showHelp) { return; } introWindow = GUILayout.Window(introWindowId, introWindow, IntroWindow, "Toolbar Controller Intro", windowStyle); if (automoved < 2) { introWindow.x = (Screen.width - introWindow.width) / 2; introWindow.y = (Screen.height - introWindow.height) / 2; automoved++; } }
private void OnGUI() { if (showUI) { winPos = GUILayout.Window(winID, winPos, windowGUI, "SmokeScreen", GUILayout.MinWidth(300)); } }
/* * Saved Message */ private void HandleSavedDisplay(int windowID) { bool MMPathLoaderIsReady = DatabaseHandler.isModuleManagerInstalled ? (bool)DatabaseHandler.DynaInvokeMMPatchLoaderMethod("IsReady") : false; GUILayout.BeginVertical(); if (DatabaseHandler.isReloading) { ScreenMessages.PostScreenMessage(string.Concat(Constants.guiDBReloading1, "\n", Constants.guiDBReloading2), Time.deltaTime, ScreenMessageStyle.UPPER_CENTER); GUILayout.Label(Constants.guiDBReloading1); GUILayout.Label(Constants.guiDBReloading2); if (!MMPathLoaderIsReady) { GUILayout.Label(String.Format("ModuleManager progress: {0:P0}", (float)DatabaseHandler.DynaInvokeMMPatchLoaderMethod("ProgressFraction"))); // GUILayout.Label(String.Format("{0}", (string)DatabaseHandler.DynaInvokeMMPatchLoaderMethod("ProgressTitle"))); } } else { GUILayout.Label(Constants.guiDialSaved); GUILayout.FlexibleSpace(); if (GUILayout.Button(Constants.guiOK)) { this.state = DisplayState.none; ClearEditor(); } } GUILayout.EndVertical(); GUI.DragWindow(); } //private void OnErrorDisplay()
public void OnGUI() { if (GUILayout.Button("Vanguard Technologies Asset Database Printer - save asset list to kspdir/assetlist.log")) { ConfigNode topNode = new ConfigNode("ASSETS"); AssetBase assetBase = (AssetBase)UnityEngine.Object.FindObjectOfType(typeof(AssetBase)); ConfigNode guiSkinNode = new ConfigNode("GUISKINS"); foreach (GUISkin s in assetBase.guiSkins) { guiSkinNode.AddValue("objectName", s.name); } ConfigNode prefabNode = new ConfigNode("PREFABS"); if (assetBase != null) { foreach (GameObject o in assetBase.prefabs) { prefabNode.AddValue("objectName", o.name); } } ConfigNode textureNode = new ConfigNode("TEXTURES"); if (assetBase != null) { foreach (Texture2D t in assetBase.textures) { textureNode.AddValue("objectName", t.name); } } ConfigNode unityResource = new ConfigNode("UNITYRESOURCES"); int nameless = 0, unass = 0, newGameObject = 0; foreach (UnityEngine.Object o in UnityEngine.Resources.FindObjectsOfTypeAll(typeof(UnityEngine.Object))) { switch (o.name) { case "": nameless++; break; case "Unass": unass++; break; case "New Game Object": newGameObject++; break; default: unityResource.AddValue("objectName", o.name); break; } } unityResource.AddValue("nameless", nameless); unityResource.AddValue("Unass", unass); unityResource.AddValue("NewGameObject", newGameObject); topNode.AddNode(guiSkinNode); topNode.AddNode(prefabNode); topNode.AddNode(textureNode); topNode.AddNode(unityResource); topNode.Save(KSPUtil.ApplicationRootPath + "/assetlist.log"); } }
/*************************************************************************************************************************/ public void DebugGUI(int windowID) { GUILayout.BeginVertical(); GUILayout.Space(10); //GUI.Toggle(new Rect(5, 3, 25, 25), plugin_active, " "); GUILayout.BeginHorizontal(); if (GUILayout.Button("print savefile", button_small, GUILayout.Width(132))) { write_save_values_to_file(); } if (GUILayout.Button("read savefile", button_small, GUILayout.Width(132))) { load_save_file(); } GUILayout.EndHorizontal(); GUILayout.Space(5); if (GUILayout.Button("mark bug", button_small, GUILayout.Width(115))) { Log.info("##################### BUG MARKER #####################"); } GUILayout.Space(5); debug_message[0] = _SAVE_Switched_To_Savefile; debug_message[1] = loaded_vessels.Count.ToString(); //debug_message[2] = ""; //debug_message[3] = ""; //debug_message[4] = ""; //debug_message[5] = ""; //debug_message[6] = ""; //debug_message[7] = ""; //debug_message[8] = ""; //debug_message[9] = ""; //debug_message[10] = ""; //debug_message[11] = ""; //debug_message[12] = ""; //debug_message[13] = ""; //debug_message[14] = ""; //debug_message[15] = ""; //debug_message[16] = ""; //debug_message[17] = ""; //debug_message[18] = ""; //debug_message[19] = ""; foreach (string temp_string in debug_message) { if (temp_string != "") { GUILayout.Box(temp_string, text_main, GUILayout.Width(266)); } } GUILayout.EndVertical(); GUI.DragWindow(new Rect(0, 0, 10000, 20)); }
protected void Show() { if (this.IsDeactivated()) { return; } Log.dbg("Window.Show"); this.windowRect = GUILayout.Window(this.window_id, this.windowRect, this.Draw, this.tittle, this.style.window); }
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(); }
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(); }
public static void EndMouseOverVertical(out bool mouseOver) { mouseOver = false; GUILayout.EndVertical(); if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition)) { mouseOver = true; } }
internal virtual void draw() { if (GUIStyle == null) { GUIStyle = GUI.skin.window; } Rect = GUILayout.Window(id, AutoClampToScreen ? Rect.clampToScreen() : Rect, windowId => drawContentsInternal(), Title, GUIStyle, GUILayoutOptions); editorLock.draw(Modal || Rect.Contains(Utils.getMousePosition())); }
///////////////////////////////////// public void OnGUI() { try { if (this.Visible()) { this.bounds = GUILayout.Window(this.GetInstanceID(), this.bounds, this.Window, AS.TITLE, HighLogic.Skin.window); } } catch (Exception e) { Log.err("exception: {0}", e.Message); } }
public void OnGUI() { GUI.skin = HighLogic.Skin; GUI.skin.toggle.margin = new RectOffset(0, 0, 0, 0); if (showGUI) { GUILayout.BeginArea(windowRect); windowRect = GUILayout.Window(837190, windowRect, MotionDetectorWindow, "Motion Detector"); GUILayout.EndArea(); } }
/*************************************************************************************************************************/ public void BetaGUI(int windowID) { GUILayout.BeginVertical(); if (GUILayout.Button("mark bug", button_small, GUILayout.Width(115))) { Log.info("##################### BUG MARKER #####################"); } GUILayout.EndVertical(); GUI.DragWindow(new Rect(0, 0, 10000, 20)); }
public static bool MouseOverButton(GUIContent content, out bool mouseOver, GUIStyle style) { bool result = GUILayout.Button(content, style); mouseOver = false; if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition)) { mouseOver = true; } return(result); }
protected override void OnDraw(int windowId, Rect clientArea) { foreach (string v in this.challenge.GetNames()) { GUILayout.BeginHorizontal(); GUILayout.Label(v, this.style.datumName); GUILayout.Label(this.challenge.GetFormattedValue(v), this.style.datumValue); GUILayout.Label(this.challenge.GetUnit(v), this.style.datumUnit); GUILayout.EndHorizontal(); } GUILayout.Space(14); GUILayout.Label(this.challenge.Score.ToString("G5"), this.style.score); }
private void LoadAndDisplay(string f) { if (!loaded) { Load(f); loaded = true; } int imgcnt = 0; string l = ""; foreach (string line in lines) { if (line.Length >= 7 && line.Substring(0, 7) == "<IMAGE=") { if (l.Length > 0) { GUILayout.BeginHorizontal(); GUILayout.Label(l); GUILayout.EndHorizontal(); l = ""; } if (imgcnt <= images.Count) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Box(images[imgcnt], GUILayout.Width(images[imgcnt].width + 10), GUILayout.Height(images[imgcnt].height + 10)); GUILayout.FlexibleSpace(); imgcnt++; GUILayout.EndHorizontal(); } } else { if (l == "") { l = line; } else { l += "\n" + line; } } } if (l.Length > 0) { GUILayout.BeginHorizontal(); GUILayout.Label(l); GUILayout.EndHorizontal(); l = ""; } }
/// <summary> /// Public Eventcall at the GuiDraw /// </summary> private void HandleGUI() { if (!_guiVisible) { //TODO: Play a "uh-uh" (nops) sound. Log.dbgGui(this, "GUI is set to invisible!"); return; } GUI.skin = _guiskin; switch (this.state) { case DisplayState.none: EditorLockManager.unlockEditor(Constants.settingPreventClickThroughLock); EditorLockManager.unlockEditor(Constants.settingWeldingLock); break; case DisplayState.weldError: _editorErrorDial = GUILayout.Window((int)this.state, _editorErrorDial, OnErrorDisplay, Constants.weldManufacturer); break; case DisplayState.weldWarning: _editorWarningDial = GUILayout.Window((int)this.state, _editorWarningDial, OnWarningDisplay, Constants.weldManufacturer); break; case DisplayState.infoWindow: _editorInfoWindow = GUI.Window((int)this.state, _editorInfoWindow, OnInfoWindow, Constants.weldManufacturer); PreventClickThrough(_editorInfoWindow); break; case DisplayState.savedWindow: _editorSavedDial = GUILayout.Window((int)this.state, _editorSavedDial, OnSavedDisplay, Constants.weldManufacturer); break; case DisplayState.overwriteDial: _editorOverwriteDial = GUILayout.Window((int)this.state, _editorOverwriteDial, OnOverwriteDisplay, Constants.weldManufacturer); break; case DisplayState.mainWindow: _editorMainWindow = GUI.Window((int)this.state, _editorMainWindow, OnMainWindow, Constants.weldManufacturer); PreventClickThrough(_editorMainWindow); break; case DisplayState.partSelection: ScreenMessages.PostScreenMessage(Constants.guiScreenMessagePartSelection, Time.deltaTime, ScreenMessageStyle.UPPER_CENTER); break; } } //private void OnDraw()
public void OnGUI() { if (showSettingsWindow) { GUILayout.BeginArea(morseSettingsRect); morseSettingsRect = GUILayout.Window(991237, morseSettingsRect, MorseSettingsWindow, Localizer.Format("#autoLOC_CL_0077")); GUILayout.EndArea(); } if (showAlphabetWindow) { GUILayout.BeginArea(morseAlphabetRect); morseAlphabetRect = GUILayout.Window(596064, morseAlphabetRect, MorseAlphabetWindow, Localizer.Format("#autoLOC_CL_0078")); GUILayout.EndArea(); } }
private void drawSetting() { Settings.ChangeVesselType = GUILayout.Toggle(Settings.ChangeVesselType, "change vessel type", buttonStyle, GUILayout.Width(200), GUILayout.Height(20)); // volume GUILayout.Label(String.Format("Volume: {0}%", Math.Round(Settings.Volume * 100.0f))); Settings.Volume = (float)Math.Round(GUILayout.HorizontalSlider(Settings.Volume, 0.0f, 1.0f), 2); // Use Captions Settings.UseCaption = GUILayout.Toggle(Settings.UseCaption, "Screen Captions", toggleStyle); switch (Gpws.ActiveVesselType) { case SimpleTypes.VesselType.PLANE: drawPlaneSetting(); break; case SimpleTypes.VesselType.LANDER: drawLanderSetting(); break; default: break; } // save if (GUILayout.Button("Save", buttonStyle, GUILayout.Width(200), GUILayout.Height(30))) { float newFloat; if (float.TryParse(tooLowGearAltitudeString, out newFloat)) { planeConfig.TooLowGearAltitude = newFloat; } if (float.TryParse(touchDownSpeedString, out newFloat)) { landerConfig.TouchDownSpeed = newFloat; } if (float.TryParse(horizontalSpeedCheckAltitudeString, out newFloat)) { landerConfig.HorizontalSpeedCheckAltitude = newFloat; } // save Settings.SaveSettings(); Settings.SaveCurrentVesselConfig(FlightGlobals.ActiveVessel); } }
/* * Warning Message */ private void HandleWarningDisplay(int windowID) { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label(Constants.guiDialWarn); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(Constants.guiOK)) { this.state = DisplayState.infoWindow; } GUILayout.EndVertical(); GUI.DragWindow(); } //private void OnErrorDisplay()