private void OnDestroy() { GameEvents.onGUIApplicationLauncherReady.Remove(onReady); GameEvents.onGUIApplicationLauncherUnreadifying.Remove(onUnreadifying); for (int i = vessels.Count - 1; i >= 0; i--) { SEP_VesselSection v = vessels[i]; if (v == null) { continue; } v.OnDestroy(); } if (window != null) { Destroy(window); } if (window_Obj != null) { Destroy(window_Obj); } }
public IList <IVesselSection> GetBodyVessels(string body) { List <IVesselSection> vesselList = new List <IVesselSection>(); if (string.IsNullOrEmpty(body)) { return(vesselList); } int l = vessels.Count; for (int i = 0; i < l; i++) { SEP_VesselSection vessel = vessels.At(i); if (vessel == null) { continue; } if (vessel.VesselBody == null) { continue; } if (vessel.VesselBody.bodyName != body) { continue; } vesselList.Add(vessel); } return(vesselList); }
private void OnDestroy() { instance = null; GameEvents.onGUIApplicationLauncherReady.Remove(onReady); GameEvents.onGUIApplicationLauncherUnreadifying.Remove(onUnreadifying); GameEvents.OnGameSettingsApplied.Remove(onSettingsApplied); SEP_Utilities.onExperimentActivate.Remove(onExpActivate); SEP_Utilities.onExperimentDeactivate.Remove(onExpDeactivate); for (int i = vessels.Count - 1; i >= 0; i--) { SEP_VesselSection v = vessels.At(i); if (v == null) { continue; } v.OnDestroy(); } if (window != null) { Destroy(window.gameObject); } if (compactWindow != null) { Destroy(compactWindow.gameObject); } }
public void addVesselSection(Vessel v) { if (v == null) { return; } if (vessels.Contains(v.id)) { return; } IList <string> bodies = GetBodies; SEP_VesselSection s = new SEP_VesselSection(v); vessels.Add(v.id, s); if (_windowMinimized || window == null) { return; } if (!settings.showAllVessels) { string name = v.mainBody.bodyName; bool flag = false; for (int i = bodies.Count - 1; i >= 0; i--) { string b = bodies[i]; if (b != name) { continue; } flag = true; break; } if (!flag) { window.AddBodySection(name); if (bodies.Count <= 0) { window.addVesselSection(s); } } else { window.UpdateBodySection(name, GetBodyVessels(name).Count); } if (_currentBody != name) { return; } } window.addVesselSection(s); }