/// <summary> /// Timer data methods /// </summary> public TimeSpan getTimerSpan(string name) { TimeSpan ret = System.TimeSpan.Zero; KCoopTimer t = timers.Find(d => d.name == name); if (t != null) { ret = t.getTime(); } return(ret); }
private void Initialize() { Instance = this; SaveAbleList.Clear(); KCoopTimer t = new KCoopTimer("KSCtimer", false); timers.Add(t); SaveAbleList.Add(t); t = new KCoopTimer("Flighttimer", false); timers.Add(t); SaveAbleList.Add(t); t = new KCoopTimer("Editortimer", false); timers.Add(t); SaveAbleList.Add(t); //UnityEngine.Object.DontDestroyOnLoad(this); flag_Initialized = true; // add scenario module var game = HighLogic.CurrentGame; ProtoScenarioModule psm = game.scenarios.Find(s => s.moduleName == typeof(KerbalCooperation).Name); if (psm == null) { psm = game.AddProtoScenarioModule(typeof(KerbalCooperation), GameScenes.SPACECENTER, GameScenes.FLIGHT, GameScenes.EDITOR); } else { if (!psm.targetScenes.Any(s => s == GameScenes.SPACECENTER)) { psm.targetScenes.Add(GameScenes.SPACECENTER); } if (!psm.targetScenes.Any(s => s == GameScenes.FLIGHT)) { psm.targetScenes.Add(GameScenes.FLIGHT); } if (!psm.targetScenes.Any(s => s == GameScenes.EDITOR)) { psm.targetScenes.Add(GameScenes.EDITOR); } } }