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 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 Window(int id) { if (!cfgWinData) { cfgWinData = true; // newScreenshotAtIntervals = AS.configuration.screenshotAtIntervals; newInterval = AS.configuration.screenshotInterval; interval = newInterval.ToString(); newConvertToJPG = AS.configuration.convertToJPG; newKeepOrginalPNG = AS.configuration.keepOrginalPNG; newNoGUIOnScreenshot = AS.configuration.noGUIOnScreenshot; newGUIOnScreenshot = AS.configuration.guiOnScreenshot; newScreenshotPath = AS.configuration.screenshotPath; newFilename = AS.configuration.filename; newJPGQuality = AS.configuration.JPGQuality; JPGQuality = newJPGQuality.ToString(); newScreenshotOnSceneChange = AS.configuration.screenshotOnSceneChange; newOnSpecialEvent = AS.configuration.onSpecialEvent; newKeycode = AS.configuration.keycode; newprecrashSnapshots = AS.configuration.precrashSnapshots; newsecondsUntilImpact = AS.configuration.secondsUntilImpact; newhsAltitudeLimit = AS.configuration.hsAltitudeLimit; newhsMinVerticalSpeed = AS.configuration.hsMinVerticalSpeed; newhsScreenshotInterval = AS.configuration.hsScreenshotInterval; secondsUntilImpact = AS.configuration.secondsUntilImpact.ToString(); hsAltitudeLimit = AS.configuration.hsAltitudeLimit.ToString(); hsMinVerticalSpeed = AS.configuration.hsMinVerticalSpeed.ToString(); hsScreenshotInterval = AS.configuration.hsScreenshotInterval.ToString(); newsupersize = AS.configuration.supersize; strsupersize = AS.configuration.supersize.ToString(); newautoSave = AS.configuration.autoSave; newminBetweenSaves = AS.configuration.minBetweenSaves; minBetweenSaves = AS.configuration.minBetweenSaves.ToString(); newsavePrefix = AS.configuration.savePrefix; newnumToRotate = AS.configuration.numToRotate; numToRotate = AS.configuration.numToRotate.ToString(); newautoSaveOnGameStart = AS.configuration.autoSaveOnGameStart; } SetVisible(true); GUI.enabled = true; GUILayout.BeginHorizontal(); GUILayout.EndHorizontal(); //DrawTitle ("Options"); GUILayout.BeginArea(new Rect(10, 50, 375, 450)); GUILayout.BeginVertical(); DrawTitle("Screenshot Options"); //GUILayout.BeginHorizontal (); //GUILayout.Label ("Take screenshots at specified intervals: "); //GUILayout.FlexibleSpace (); //newScreenshotAtIntervals = GUILayout.Toggle (newScreenshotAtIntervals, ""); //GUILayout.EndHorizontal (); GUILayout.BeginHorizontal(); GUILayout.Label("Screenshot Interval in seconds: "); GUILayout.FlexibleSpace(); interval = GUILayout.TextField(interval, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(30.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Convert to JPG: "); GUILayout.FlexibleSpace(); newConvertToJPG = GUILayout.Toggle(newConvertToJPG, ""); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Keep original PNG: "); GUILayout.FlexibleSpace(); newKeepOrginalPNG = GUILayout.Toggle(newKeepOrginalPNG, ""); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("JPEG Quality (1-100):"); GUILayout.FlexibleSpace(); JPGQuality = GUILayout.TextField(JPGQuality, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(30.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Supersize images (0-4):"); GUILayout.FlexibleSpace(); strsupersize = GUILayout.TextField(strsupersize, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(30.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Screenshot path:"); GUILayout.FlexibleSpace(); // GUILayout.EndHorizontal (); // GUILayout.BeginHorizontal (); // GUILayout.FlexibleSpace (); newScreenshotPath = GUILayout.TextField(newScreenshotPath, GUILayout.MinWidth(50F), GUILayout.MaxWidth(250F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Filename Format:"); GUILayout.FlexibleSpace(); newFilename = GUILayout.TextField(newFilename, GUILayout.MinWidth(30F), GUILayout.MaxWidth(160F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Screenshot after scene change:"); GUILayout.FlexibleSpace(); newScreenshotOnSceneChange = GUILayout.Toggle(newScreenshotOnSceneChange, ""); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Screenshot after special event:"); GUILayout.FlexibleSpace(); newOnSpecialEvent = GUILayout.Toggle(newOnSpecialEvent, ""); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Use Blizzy Toolbar if available:"); GUILayout.FlexibleSpace(); newUseBlizzyToolbar = GUILayout.Toggle(newUseBlizzyToolbar, ""); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Activation Keycode:"); GUILayout.FlexibleSpace(); newKeycode = GUILayout.TextField(newKeycode, GUILayout.MinWidth(30F), GUILayout.MaxWidth(40F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("No GUI on screenshot:"); GUILayout.FlexibleSpace(); newNoGUIOnScreenshot = GUILayout.Toggle(newNoGUIOnScreenshot, ""); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("GUI on screenshot: "); GUILayout.FlexibleSpace(); newGUIOnScreenshot = GUILayout.Toggle(newGUIOnScreenshot, ""); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndArea(); GUILayout.BeginArea(new Rect(400, 50, 300, 400)); GUILayout.BeginVertical(); DrawTitle("Pre-Crash Settings"); GUILayout.BeginHorizontal(); GUILayout.Label("Take pre-crash snapshots:"); GUILayout.FlexibleSpace(); newprecrashSnapshots = GUILayout.Toggle(newprecrashSnapshots, ""); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Seconds until impact:"); secondsUntilImpact = GUILayout.TextField(secondsUntilImpact, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(30.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Altitude limit (meters):"); hsAltitudeLimit = GUILayout.TextField(hsAltitudeLimit, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(60.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Minimum vertical speed:"); hsMinVerticalSpeed = GUILayout.TextField(hsMinVerticalSpeed, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(30.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Screenshot interval (pre-crash):"); hsScreenshotInterval = GUILayout.TextField(hsScreenshotInterval, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(30.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(""); GUILayout.EndHorizontal(); DrawTitle("Automatic Save Settings"); GUILayout.BeginHorizontal(); GUILayout.Label("Activation Key (not configurable):"); GUILayout.FlexibleSpace(); GUILayout.Label("Ctrl-F6"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Minutes between saves:"); minBetweenSaves = GUILayout.TextField(minBetweenSaves, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(30.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Save file format:"); newsavePrefix = GUILayout.TextField(newsavePrefix, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(160.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Max save files:"); numToRotate = GUILayout.TextField(numToRotate, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(30.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Autosave on at game start:"); GUILayout.FlexibleSpace(); newautoSaveOnGameStart = GUILayout.Toggle(newautoSaveOnGameStart, ""); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndArea(); // // I probably don't need to have the "finally" sections, but // it doesn't hurt and will be there if I need it in the future // try { newInterval = Convert.ToSingle(Convert.ToDouble(interval)); } catch (Exception) { } finally { } try { newJPGQuality = Convert.ToUInt16(JPGQuality); } catch (Exception) { } finally { } try { newsecondsUntilImpact = Convert.ToUInt16(secondsUntilImpact); } catch (Exception) { } finally { } try { newhsAltitudeLimit = Convert.ToUInt16(hsAltitudeLimit); } catch (Exception) { } finally { } try { newhsMinVerticalSpeed = Convert.ToUInt16(hsMinVerticalSpeed); } catch (Exception) { } finally { } try { newhsScreenshotInterval = Convert.ToSingle(Convert.ToDouble(hsScreenshotInterval)); } catch (Exception) { } finally { } try { newsupersize = Convert.ToUInt16(strsupersize); if (newsupersize < 0) { newsupersize = 0; } if (newsupersize > AS.configuration.MAX_SUPERSIZE) { newsupersize = AS.configuration.MAX_SUPERSIZE; } } catch (Exception) { } finally { } try { newminBetweenSaves = Convert.ToUInt16(minBetweenSaves); } catch (Exception) { } finally { } try { newnumToRotate = Convert.ToUInt16(numToRotate); } catch (Exception) { } finally { } GUI.DragWindow(); }