void ParseKACAction(ConfigNode settings) { if (!settings.HasValue("KACAction")) { var val = KACAction.ToString(); settings.AddValue("KACAction", val); } string str = settings.GetValue("KACAction"); switch (str) { case ("KillWarp"): KACAction = KACWrapper.KACAPI.AlarmActionEnum.KillWarp; break; case ("KillWarpOnly"): KACAction = KACWrapper.KACAPI.AlarmActionEnum.KillWarpOnly; break; case ("MessageOnly"): KACAction = KACWrapper.KACAPI.AlarmActionEnum.MessageOnly; break; case ("PauseGame"): KACAction = KACWrapper.KACAPI.AlarmActionEnum.PauseGame; break; default: KACAction = KACWrapper.KACAPI.AlarmActionEnum.KillWarp; break; } ; }
public override void OnSave(ConfigNode config) { //Debug.Log (String.Format ("[EL] Settings save: {0}", config)); var settings = new ConfigNode("Settings"); config.AddNode(settings); settings.AddValue("UseKAC", use_KAC); settings.AddValue("KACAction", KACAction.ToString()); settings.AddValue("PreferBlizzy", PreferBlizzy); ExShipInfo.SaveSettings(settings.AddNode("ShipInfo")); ExBuildWindow.SaveSettings(settings.AddNode("BuildWindow")); }
public override void OnSave(ConfigNode config) { //Debug.Log (String.Format ("[EL] Settings save: {0}", config)); var settings = new ConfigNode("Settings"); bool uk = use_KAC; settings.AddValue("UseKAC", uk); string ka = KACAction.ToString(); settings.AddValue("KACAction", ka); config.AddNode(settings); ExShipInfo.SaveSettings(settings.AddNode("ShipInfo")); ExBuildWindow.SaveSettings(settings.AddNode("BuildWindow")); }
public override void OnLoad(ConfigNode config) { //Debug.Log (String.Format ("[EL] Settings load")); var settings = config.GetNode("Settings"); if (settings == null) { settings = new ConfigNode("Settings"); gui_enabled = true; // Show settings window on first startup } if (!settings.HasValue("UseKAC")) { var val = use_KAC; settings.AddValue("UseKAC", val); } if (!settings.HasValue("KACAction")) { var val = KACAction.ToString(); settings.AddValue("KACAction", val); } var uks = settings.GetValue("UseKAC"); bool uk = true; bool.TryParse(uks, out uk); use_KAC = uk; string str = settings.GetValue("KACAction"); switch (str) { case ("KillWarp"): KACAction = KACWrapper.KACAPI.AlarmActionEnum.KillWarp; break; case ("KillWarpOnly"): KACAction = KACWrapper.KACAPI.AlarmActionEnum.KillWarpOnly; break; case ("MessageOnly"): KACAction = KACWrapper.KACAPI.AlarmActionEnum.MessageOnly; break; case ("PauseGame"): KACAction = KACWrapper.KACAPI.AlarmActionEnum.PauseGame; break; default: KACAction = KACWrapper.KACAPI.AlarmActionEnum.KillWarp; break; } ; if (settings.HasNode("ShipInfo")) { var node = settings.GetNode("ShipInfo"); ExShipInfo.LoadSettings(node); } if (settings.HasNode("BuildWindow")) { var node = settings.GetNode("BuildWindow"); ExBuildWindow.LoadSettings(node); } if (CompatibilityChecker.IsWin64()) { enabled = false; } else { if (HighLogic.LoadedScene == GameScenes.SPACECENTER) { enabled = true; } } }