void Add(Vessel v) { Log.Info("VesselStatsManager.Add"); bool b; if (v == null) { return; } Log.Info("Add: " + v.name); if (moduleFilterList == null) { Log.Info("modulefilterList is null"); return; } bool b1 = true, b2 = true; if (v.name.Length >= 9) { b1 = (v.name.Substring(0, 9) != "kerbalEVA"); } if (v.name.Length >= 4) { b2 = (v.name.Substring(0, 4) != "flag"); } //if ((v.name.Length >= 9 && v.name.Substring(0, 9) != "kerbalEVA") && (v.name.Length >= 4 && v.name.Substring(0, 4) != "flag") || // v.name.Length < 4) if (b1 && b2) { Log.Info("ModuleFilterList.count: " + moduleFilterList.Count().ToString()); if (!vesselDict.ContainsKey(v)) { ResourceStats r = VesselStatsManager.Instance.gameObject.AddComponent <ResourceStats>(); if (r == null) { Log.Info("r == null"); } vesselDict.Add(v, r); foreach (PartTapIn part in v.Parts) { b = true; foreach (var s in moduleFilterList) { if (part.Modules.Contains(s)) { b = false; break; } } if (b) { Log.Info("Add 2"); part.OnRequestResource.Add(r.Sample); } } } } }
public void Add(Vessel v) { if (!vesselDict.ContainsKey(v)) { ResourceStats r = VesselStatsManager.Instance.gameObject.AddComponent <ResourceStats> (); vesselDict.Add(v, r); foreach (PartTapIn part in v.Parts) { part.OnRequestResource.Add(r.Sample); } } }
public void Remove(Vessel v) { if (vesselDict.ContainsKey(v)) { ResourceStats r = vesselDict[v]; foreach (PartTapIn part in v.parts) { part.OnRequestResource.Remove(r.Sample); } vesselDict.Remove(v); } }