/** Called on destroy */ public void OnDestroy() { debugPrint("OnDestroy()"); /** Save to config */ PluginConfiguration config = PluginConfiguration.CreateForType <ExperimentTracker>(); config.SetValue("expGUI", expGUI); config.SetValue("expListRectX", (int)expListRect.x); config.SetValue("expListRectY", (int)expListRect.y); config.SetValue("infGUI", infGUI); config.SetValue("infRectX", (int)infRect.x); config.SetValue("infRectY", (int)infRect.y); config.save(); /** Unregister for events */ //GameEvents.onGUIApplicationLauncherReady.Remove(setupButton); /** Remove button */ #if false if (etButton != null) { ApplicationLauncher.Instance.RemoveModApplication(etButton); } #endif toolbarControl.OnDestroy(); Destroy(toolbarControl); }
public override void OnSave(ConfigNode node) { PluginConfiguration config = PluginConfiguration.CreateForType <DigitalClock>(); config.SetValue("Window Position", _windowPosition); config.save(); }
public void CheckMigrateSettings() { Safe.Utilities.SafeHouse.Logger.SuperVerbose("kOSCustomParameters.CheckMigrateSettings()"); if (!migrated) { var config = PluginConfiguration.CreateForType <kOSCustomParameters>(); config.load(); var ipu = config.GetValue("InstructionsPerUpdate", -1); // if the ipu is set below zero, it means that the file was created after we switch to // the new system, or that the user selected to prevent future migrations. if (ipu > 0) { kOSSettingsChecker.QueueDialog( 0.5f, 0.5f, // causes it to be centered (half of box's own width left and down from center is the corner). new MultiOptionDialog( "Migration Dialog", MIGRATION_DIALOG_TEXT, "kOS", HighLogic.UISkin, new DialogGUIButton("Yes: migrate settings", MigrateSettingsNormal, true), new DialogGUIButton("Yes: migrate settings this one time,\nbut never ask again for this or any other game", MigrateSettingsPrevent, true), new DialogGUIButton("No: start with new default settings", DontMigrate, true), new DialogGUIButton("No: start with new default settings\nand never ask again for this or any other game", DontMigrateAndPrevent, true) )); } else { Safe.Utilities.SafeHouse.Logger.LogError("ipu: " + ipu.ToString()); migrated = true; } } }
public void SaveConfigXml() { if (_settingsWindow) { _settingsWindowPosition = _settingsWindow.transform.position; } PluginConfiguration config = PluginConfiguration.CreateForType <WindowManager>(); config.load(); config.SetValue("dbg_controlWindowPosition", _settingsWindowPosition); config.SetValue("dbg_UIAlphaValue", (double)_UIAlphaValue); config.SetValue("dbg_UIScaleValue", (double)_UIScaleValue); config.SetValue("dbg_ShowKSPJoints", ShowKSPJoints); config.SetValue("dbg_ReinforceExistingJoints", ReinforceExistingJoints); config.SetValue("dbg_BuildAdditionalJointToParent", BuildAdditionalJointToParent); config.SetValue("dbg_ShowAdditionalJointToParent", ShowAdditionalJointToParent); config.SetValue("dbg_BuildMultiPartJointTreeChildren", BuildMultiPartJointTreeChildren); config.SetValue("dbg_ShowMultiPartJointTreeChildren", ShowMultiPartJointTreeChildren); config.SetValue("dbg_BuildMultiPartJointTreeChildrenRoot", BuildMultiPartJointTreeChildrenRoot); config.SetValue("dbg_ShowMultiPartJointTreeChildrenRoot", ShowMultiPartJointTreeChildrenRoot); config.save(); }
// Load the settings of the plugin. private void LoadSettings() { print("[notes.dll] Loading Config..."); PluginConfiguration _configFile = PluginConfiguration.CreateForType <Notes>(); _configFile.load(); _windowRect = _configFile.GetValue("main window position", new Rect(50f, 25f, 425f, 487f)); _windowRect2 = _configFile.GetValue("list window position", new Rect(Screen.width / 2f - 150f, Screen.height / 2f - 75f, 520f, 390f)); _windowRect3 = _configFile.GetValue("del dialog position", new Rect(Screen.width / 2f - 150f, Screen.height / 2f - 75f, 220f, 100f)); _windowRect4 = _windowRect3; _windowRect5 = _windowRect3; _windowRect6 = _windowRect3; _keybind = _configFile.GetValue("keybind", "n"); _keybind2 = _configFile.GetValue("keybind2", "l"); _versionLastRun = _configFile.GetValue <string>("version"); _fontSize = _configFile.GetValue("font size", 13); _file = _configFile.GetValue("last note opened", "notes"); _useKspSkin = _configFile.GetValue <bool>("use ksp skin"); _visible = _configFile.GetValue <bool>("main window state"); _mouseButton = _configFile.GetValue("mouse button", 2); _notesDir = _configFile.GetValue("notesdir", KSPUtil.ApplicationRootPath.Replace("\\", "/") + "GameData/notes/Plugins/PluginData/notes/"); print("[notes.dll] Config Loaded Successfully"); }
private void Start() { available = (PSystemSetup.Instance.GetSpaceCenterFacility("TrackingStation").GetFacilityLevel() > 0); lastTime = DateTime.Now; config = PluginConfiguration.CreateForType <FlightPlan> (); config.load(); UI = new UICore.UICore(); UI.LoadConfig("GameData/FlightPlan/Skin/FlightPlan.cfg"); winId = GUIUtility.GetControlID(FocusType.Passive); winRect = config.GetValue <Rect> (this.name, new Rect(0, 0, Screen.width / 2, Screen.height / 2)); showAsUT = config.GetValue <bool> ("showAsUT", false); GameEvents.onGUIApplicationLauncherReady.Add(CreateLauncher); GameEvents.onHideUI.Add(OnHide); GameEvents.onShowUI.Add(OnUnHide); GameEvents.onGamePause.Add(OnHide); GameEvents.onGameUnpause.Add(OnUnHide); KACWrapper.InitKACWrapper(); if (KACWrapper.APIReady) { KACWrapper.KAC.onAlarmStateChanged += KACWrapper_KAC_onAlarmStateChanged; } }
// Called after the scene is loaded. public void Awake() { ASPConsoleStuff.AAprint("Awake()"); #if DEBUG // don't load configs because KramaxReload screws up PluginConfiguration #else PluginConfiguration config = PluginConfiguration.CreateForType <AutoAsparagus> (); config.load(); vizualize = config.GetValue <bool> ("vizualize"); stageParachutes = config.GetValue <bool> ("stageParachutes"); stageLaunchClamps = config.GetValue <bool> ("stageLaunchClamps"); launchClampsStage = config.GetValue <int> ("launchClampsStage"); stagesepratrons = config.GetValue <bool> ("stagesepratrons"); useSmartStage = config.GetValue <bool> ("useSmartStage"); windowRect.x = (float)config.GetValue <int> ("windowRectX"); windowRect.y = (float)config.GetValue <int> ("windowRectY"); if ((windowRect.x == 0) && (windowRect.y == 0)) { windowRect.x = Screen.width * 0.35f; windowRect.y = Screen.height * 0.1f; } #endif ASPConsoleStuff.AAprint("Add onEditorShipModified hook"); GameEvents.onEditorShipModified.Add(onCraftChange); ASPConsoleStuff.AAprint("End of Awake()"); }
public void Load(ConfigNode node) { PluginConfiguration config = PluginConfiguration.CreateForType <HeadMaster>(); config.load(); MainGUI = config.GetValue <Rect>("Window Position"); }
/// <summary> /// Doesn't work Yet Stumped /// </summary> /// <param name="node"></param> private void Load(ConfigNode node) { PluginConfiguration config = PluginConfiguration.CreateForType <MissionController>(); config.load(); mainWindowPosition = config.GetValue <Rect>("MainWindow"); }
public override void OnLoad(ConfigNode node) { PluginConfiguration config = PluginConfiguration.CreateForType <AntennaPrototype>(); config.load(); windowPosition = config.GetValue <Rect>("Window Position"); }
public void Save(ConfigNode node) { PluginConfiguration config = PluginConfiguration.CreateForType <HeadMaster>(); config.SetValue("Window Position", MainGUI); config.save(); }
public override void OnSave(ConfigNode node) { PluginConfiguration config = PluginConfiguration.CreateForType <AntennaPrototype>(); config.SetValue("Window Position", windowPosition); config.save(); }
public static void SavePreferences() { PluginConfiguration config = PluginConfiguration.CreateForType <PrefLoader>(); //config.SetVal("buoyancyMultiplicator", Preferences.buoyancyMultiplicator); config.SetVal("showVolumeInfoInEditor", Preferences.showVolumeInfoInEditor); config.SetVal("showVolumeInfoInFlight", Preferences.showVolumeInfoInFlight); config.SetVal("showTemperatureInEditor", Preferences.showTemperatureInEditor); //config.SetVal("showTemperatureInFlight", Preferences.showTemperatureInFlight); config.SetVal("showAbsPressureInEditor", Preferences.showAbsPressureInEditor); config.SetVal("showAbsPressureInFlight", Preferences.showAbsPressureInFlight); config.SetVal("showBuoyancyInEditor", Preferences.showBuoyancyInEditor); config.SetVal("showBuoyancyInFlight", Preferences.showBuoyancyInFlight); config.SetVal("showVesselBuoyancyInEditor", Preferences.showVesselBuoyancyInEditor); config.SetVal("showVesselBuoyancyInFlight", Preferences.showVesselBuoyancyInFlight); config.SetVal("showVesselMassInEditor", Preferences.showVesselMassInEditor); config.SetVal("showVesselMassInFlight", Preferences.showVesselMassInFlight); config.SetVal("showGravPullInEditor", Preferences.showGravPullInEditor); config.SetVal("showGravPullInFlight", Preferences.showGravPullInFlight); config.SetVal("debugLevel", Preferences.debugLevel); //config.SetVal("pressureDestruction", Preferences.pressureDestruction); //config.SetVal("alwaysControllable", Preferences.alwaysControllable); config.save(); }
public override void OnSave(ConfigNode node) { try { PluginConfiguration config = PluginConfiguration.CreateForType <Biomatic>(); config.SetValue("Window Position", windowPos); config.SetValue("List items", listIgnore.Count); List <string> .Enumerator en = listIgnore.GetEnumerator(); int count = 0; while (en.MoveNext()) { config.SetValue("Item" + count.ToString(), en.Current); count++; } en.Dispose(); config.SetValue("DeWarp", deWarp); config.SetValue("Use altitude", includeAlt); config.SetValue("Show description", showDescription); config.SetValue("Width", ((int)100 * fixedwidth)); config.SetValue("Toolbar", useStockToolBar ? "stock" : "blizzy"); config.SetValue("Instant dewarp", instantDewarp); config.SetValue("OnOff", (systemOn ? "On" : "Off")); config.SetValue("Show recent", showHistory); config.SetValue("Sound", soundType.ToString()); config.SetValue("Per vessel", perVessel); config.save(); } catch (Exception ex) { print("Biomatic - OnSave(): " + ex.Message); } }
public void Start() { v = null; CurrentSMA = -1e6; CurrentSMA = 1e6; CurrentBodySynchronous = -1e6; TargetString = "0"; Exponent = 6; //load config instead of hardcoding these PluginConfiguration Config = PluginConfiguration.CreateForType <StationKeeping>(); Config.load(); AltSkin = Config.GetValue("AltSkin", false); RCSOnly = Config.GetValue <bool>("RCSOnly", false); RealSMA = Config.GetValue <bool>("RealSMA", false); Tolerance = Config.GetValue <double>("Tolerance", 0.01); fTolerance = (Convert.ToInt32(Math.Round(Tolerance * 100f + 0.5f))); double WindowX = Config.GetValue <double>("WindowX", 500); double WindowY = Config.GetValue <double>("WindowY", 500); WindowRect = new Rect((float)WindowX, (float)WindowY, 200, 125); InitializeToolbarButton(); GameEvents.onPlanetariumTargetChanged.Add(OnMapTargetChange); }
private void LoadVersion() { PluginConfiguration _configfile = PluginConfiguration.CreateForType <ImgViewer>(); _configfile.load(); _versionlastrun = _configfile.GetValue <string>("version"); }
private void Start() { resourcePool = new SortedList <string, double> (); requestPool = new SortedList <string, double> (); vesselSpareSpace = new SortedList <string, double> (); partResources = new List <PartResource> (); config = PluginConfiguration.CreateForType <SimpleLogistics> (); config.load(); windowRect = config.GetValue <Rect>(this.name, new Rect(0, 0, 400, 400)); windowId = GUIUtility.GetControlID(FocusType.Passive); globalHidden = false; gamePaused = false; active = false; refresh = true; requested = false; GameEvents.onGUIApplicationLauncherReady.Add(CreateLauncher); GameEvents.onLevelWasLoaded.Add(onLevelWasLoaded); GameEvents.onVesselChange.Add(onVesselChange); GameEvents.onHideUI.Add(onHideUI); GameEvents.onShowUI.Add(onShowUI); GameEvents.onGamePause.Add(onGamePause); GameEvents.onGameUnpause.Add(onGameUnpause); }
static Configuration() { PluginConfiguration config = PluginConfiguration.CreateForType <BetterBurnTime>(); config.load(); // General program usage useSimpleAcceleration = config.GetValue("UseSimpleAcceleration", false); // Impact tracker showImpact = config.GetValue("ShowImpactTracker", true); impactMaxTimeUntil = config.GetValue("MaxTimeToImpact", 120.0); // Closest approach showClosestApproach = config.GetValue("ShowClosestApproachTracker", true); closestApproachMaxTimeUntilEncounter = config.GetValue("MaxTimeUntilEncounter", 900.0); // seconds closestApproachMaxDistanceKm = config.GetValue("MaxClosestApproachDistanceKm", 10.0); closestApproachMinTargetDistance = config.GetValue("MinTargetDistanceMeters", 200.0); // N items, separated by whitespace // Some options: ·•▪●■ countdownText = config.GetValue("CountdownText", "● ● ● • • • • · · · · ·").Trim(); // For details on how format strings work, see: // https://msdn.microsoft.com/en-us/library/0c899ak8.aspx timeFormatSeconds = config.GetValue("FormatSeconds", "{0}s").Trim(); timeFormatMinutesSeconds = config.GetValue("FormatMinutesSeconds", "{0}m{1}s").Trim(); timeFormatHoursMinutesSeconds = config.GetValue("FormatHoursMinutesSeconds", "{0}h{1}m{2}s").Trim(); timeFormatHoursMinutes = config.GetValue("FormatHoursMinutes", "{0}h{1}m").Trim(); timeFormatHours = config.GetValue("FormatHours", "{0}h").Trim(); timeFormatWarning = config.GetValue("FormatWarning", "(~{0})").Trim(); config.save(); }
/// <summary> /// Called when this instance is destroyed. /// </summary> public void OnDestroy() { if (_active) { Hide(); } if (_instance == this) { _instance = null; } PluginConfiguration config = PluginConfiguration.CreateForType <KompLogSettings> (); config.load(); string pos = "CalcWindowPos"; if (HighLogic.LoadedSceneIsFlight) { pos = "FlightCalcWindowPos"; } config.SetValue(pos, _windowPos); config.SetValue("CalcGlobalNotes", _globalScratchPad); config.SetValue("CalcSimple", _simple); config.SetValue("CalcWidth", _width); config.save(); }
public override void OnSave(ConfigNode node) { //print("###OnSave"); PluginConfiguration config = PluginConfiguration.CreateForType <Biomatic>(); config.SetValue("Window Position", windowPos); config.SetValue("List items", listIgnore.Count); List <string> .Enumerator en = listIgnore.GetEnumerator(); int count = 0; while (en.MoveNext()) { config.SetValue("Item" + count.ToString(), en.Current); count++; } en.Dispose(); config.SetValue("DeWarp", deWarp); config.SetValue("Use altitude", includeAlt); config.SetValue("Show description", showDescription); config.SetValue("Toolbar", useStockToolBar ? "stock": "blizzy"); config.save(); }
void Start() { if (!GTIConfig.CameraFocusChanger.Activate || PluginExists("CameraFocusChanger")) { Destroy(this); return; } GTIDebug.Log("Starting GTI_CameraFocusChanger"); //DebugPrint("Starting Camera Focus Changer"); flightCamera = FlightCamera.fetch; pivotTranslateSharpness = 0.5f; hasReachedTarget = false; isFocusing = false; PluginConfiguration config = PluginConfiguration.CreateForType <GTI_CameraFocusChanger>(); config.load(); actionKey = config.GetValue <KeyCode>("actionKey", KeyCode.O); showUpdateMessage = config.GetValue <bool>("showUpdateMessage", true); GameEvents.OnCameraChange.Add(OnCameraChange); GameEvents.onVesselChange.Add(OnVesselChange); GameEvents.onVesselWillDestroy.Add(OnVesselWillDestroy); GameEvents.onVesselGoOnRails.Add(OnVesselGoOnRails); GameEvents.onStageSeparation.Add(OnStageSeparation); GameEvents.onUndock.Add(OnUndock); API.SetInstance(this); }
/// <summary> /// Loads stored configuration from file (and/or initializes default values) /// </summary> private void InitSettings() { // default keycode for kiss kissKeyCode = KeyCode.F8; kissKeyCaption = "F8"; windowPosSize = new Rect(0, 0, 400, 500); isVisible = false; showSettings = false; kissTooltip = string.Empty; dblClicked = false; selectedFileName = string.Empty; config = PluginConfiguration.CreateForType <KerbalImprovedSaveSystem>(); config.load(); windowPosSize = config.GetValue <Rect>("Window Position", windowPosSize.CenterScreen()); confirmOverwrite = config.GetValue <bool>("confirmOverwrite", false); confirmDelete = config.GetValue <bool>("confirmDelete", true); useGameTime = config.GetValue <bool>("useGameTime", false); reverseOrder = config.GetValue <bool>("reverseOrder", false); selectedDfltSaveName = config.GetValue <int>("selectedDfltSaveNameInt", 0); quickSaveMode = config.GetValue <bool>("quickSaveMode", false); kissKeyCode = config.GetValue <KeyCode>("kissKeyCode", KeyCode.F8); kissKeyCaption = config.GetValue <string>("kissKeyCaption", "F8"); }
private void Load() { PluginConfiguration config = PluginConfiguration.CreateForType <NavHud>(); config.load(); if (config.GetValue <int>("version") < _version) { Save(); } else { _mainWindowPosition = config.GetValue <Rect>("main window position"); _colorWindowPosition = config.GetValue <Rect>("color window position"); _hudTextWindowPosition = config.GetValue <Rect>("hud text position", new Rect(Screen.width / 2 - 20.0f, Screen.height * 0.7f, 10, 10)); _enableText = config.GetValue("enable text", true); _lockText = config.GetValue("lock text", false); _toggleKey = config.GetValue <KeyCode>("toggle key"); _enabled = config.GetValue <bool>("enabled", true); useBlizzy = config.GetValue <bool>("useBlizzy", true); _linesEnabled = config.GetValue <bool>("linesEnabled", true); _markersEnabled = config.GetValue <bool>("markersEnabled", true); // _waypointEnabled = config.GetValue<bool>("waypointEnabled", true);// Broken 1.1.3 waypoint code _enableMap = config.GetValue <bool>("enabledMap", false); _hideWithUI = config.GetValue <bool>("hideWithUI", true); _values.Load(config); } }
public static Vector2 LoadBounds <T>() { Vector2 bounds = new Vector2(float.NegativeInfinity, float.PositiveInfinity); try { PluginConfiguration config = PluginConfiguration.CreateForType <T>(); config.load(); bounds = config.GetValue("bounds", bounds); config.save(); } catch (Exception e) { Logging.PostErrorMessage( "{0} handled while loading PluginData for type {1}: do you have a malformed XML file?", e.GetType().FullName, typeof(T).Name ); Logging.PostDebugMessage(e.ToString()); } return(bounds); }
// Load only the version. private void LoadVersion() { PluginConfiguration _configFile = PluginConfiguration.CreateForType <Notes>(); _configFile.load(); _versionLastRun = _configFile.GetValue <string>("version"); }
public static float LoadStep <T>(float defStep = 1f) { double stepMult; stepMult = (double)defStep; try { PluginConfiguration config = PluginConfiguration.CreateForType <T>(); config.load(); stepMult = config.GetValue("stepMult", stepMult); config.save(); } catch (Exception e) { Logging.PostErrorMessage( "{0} handled while loading PluginData for type {1}: do you have a malformed XML file?", e.GetType().FullName, typeof(T).Name ); Logging.PostDebugMessage(e.ToString()); } return((float)stepMult); }
public override void OnLoad(ConfigNode node) { PluginConfiguration config = PluginConfiguration.CreateForType <DigitalClock>(); config.load(); _windowPosition = config.GetValue <Rect>("Window Position"); }
/// <summary>Loads settings from the XML file inside PluginData directory.</summary> /// <returns>Loaded settings.</returns> public static Settings <TAddon> Load() { var settings = PluginConfiguration.CreateForType <TAddon>(); settings.load(); return(new Settings <TAddon> { SettingsWindowPosition = settings.GetValue(nameof(SettingsWindowPosition), Vector2.zero), GaugeWindowPosition = settings.GetValue(nameof(GaugeWindowPosition), Vector2.zero), ShowAppLauncherButton = settings.GetValue(nameof(ShowAppLauncherButton), true), LockGaugeWindow = settings.GetValue(nameof(LockGaugeWindow), true), ForceShowGauge = settings.GetValue(nameof(ForceShowGauge), false), GaugeShowingThreshold = settings.GetValue(nameof(GaugeShowingThreshold), DefaultGaugeShowingThreshold), GaugeHidingThreshold = settings.GetValue(nameof(GaugeHidingThreshold), DefaultGaugeHidingThreshold), ShowTemperature = settings.GetValue(nameof(ShowTemperature), true), ShowTemperatureLimit = settings.GetValue(nameof(ShowTemperatureLimit), true), ShowTemperatureRate = settings.GetValue(nameof(ShowTemperatureRate), true), ShowCriticalPart = settings.GetValue(nameof(ShowCriticalPart), true), HighlightCriticalPart = settings.GetValue(nameof(HighlightCriticalPart), true), PartMenuTemperature = settings.GetValue(nameof(PartMenuTemperature), true), PartMenuTemperatureLimit = settings.GetValue(nameof(PartMenuTemperatureLimit), true), PartMenuTemperatureRate = settings.GetValue(nameof(PartMenuTemperatureRate), true), UseExclusionList = settings.GetValue(nameof(UseExclusionList), false), ExclusionList = settings.GetValue(nameof(ExclusionList), ""), }); }
public void MigrateSettings(bool preventFuture) { var config = PluginConfiguration.CreateForType <kOSCustomParameters>(); config.load(); InstructionsPerUpdate = config.GetValue("InstructionsPerUpdate", -1); useCompressedPersistence = config.GetValue <bool>("InstructionsPerUpdate"); showStatistics = config.GetValue <bool>("InstructionsPerUpdate"); startOnArchive = config.GetValue <bool>("StartOnArchive"); obeyHideUi = config.GetValue <bool>("ObeyHideUI"); enableSafeMode = config.GetValue <bool>("EnableSafeMode"); audibleExceptions = config.GetValue <bool>("AudibleExceptions"); verboseExceptions = config.GetValue <bool>("VerboseExceptions"); debugEachOpcode = config.GetValue <bool>("DebugEachOpcode"); useBlizzyToolbarOnly = config.GetValue <bool>("UseBlizzyToolbarOnly"); config.SetValue("SettingMigrationComment", "All settings except telnet settings are now stored in the game's save file. Settings stored here will be ignored."); if (preventFuture) { config.SetValue("InstructionsPerUpdate", -2); // using -2 so it's different from the default value used above config.SetValue("PreventFutureMigrationComment", "The user selected to prevent future migration notices when loading or creating save files. Change the IPU value to a positive value to re-enable migrations."); } config.save(); migrated = true; }
public void Load(ConfigNode node) { PluginConfiguration config = PluginConfiguration.CreateForType <KerbalWeatherSystems>(); config.load(); MainGUI = config.GetValue <Rect>("Window Position"); }