private void GetHullValues() { HullDataObject hdo = DataController.DataAccess.hullMasterList .Where(h => h.iD.Equals(_hullID)) .First(); if (hdo != null) { currentHull = hdo; } else if (currentHull == null) { Debug.Log("No hull assigned"); } }
void FilterShipComponentsByHullClasses(int HullID) { //http://www.devcurry.com/2009/05/replicating-in-operator-in-linq.html //We need to allow for items that are the same class or less than the // hull specifies for the class of that slot. //Quality ranges from WORST (1) to BEST (5) //Use the HullID to get the Hull record, and use the // hull record to get the classes we can use with that hull. HullDataObject hdo = dbHulls.database.Find(x => x.iD.Equals(HullID)); List <EngineDataObject> okEngines = (from db in dbEngines.database where db.hardwareClass <= hdo.engineClass select db).OrderByDescending(x => x.hardwareClass).ToList <EngineDataObject>(); List <CargoDataObject> okCargo = (from db in dbCargo.database where db.hardwareClass <= hdo.cargoClass select db).OrderByDescending(x => x.hardwareClass).ToList <CargoDataObject>(); List <ShieldDataObject> okShields = (from db in dbShields.database where db.hardwareClass <= hdo.shieldClass select db).OrderByDescending(x => x.hardwareClass).ToList <ShieldDataObject>(); List <PlatingDataObject> okPlating = (from db in dbPlating.database where db.hardwareClass <= hdo.platingClass select db).OrderByDescending(x => x.hardwareClass).ToList <PlatingDataObject>(); engineNames = okEngines.Select(x => "[" + x.hardwareClass + "] " + x.name + " (T:" + x.forwardThrust.ToString() + ")").ToArray(); engineIDs = okEngines.Select(x => x.iD).ToArray(); engineNames.Union(emptyName); engineIDs.Union(emptyID); cargoNames = okCargo.Select(x => "[" + x.hardwareClass + "] " + x.name + " (C:" + x.capacity + ")").ToArray(); cargoIDs = okCargo.Select(x => x.iD).ToArray(); cargoNames.Union(emptyName); cargoIDs.Union(emptyID); shieldNames = okShields.Select(x => "[" + x.hardwareClass + "] " + x.name + " (S:" + x.Strength + ")").ToArray(); shieldIDs = okShields.Select(x => x.iD).ToArray(); shieldNames.Union(emptyName); shieldIDs.Union(emptyID); platingNames = okPlating.Select(x => "[" + x.hardwareClass + "] " + x.name + " (S:" + x.Strength + ")").ToArray(); platingIDs = okPlating.Select(x => x.iD).ToArray(); platingNames.Union(emptyName); platingIDs.Union(emptyID); }
public void Remove(HullDataObject dataObject) { database.Remove(dataObject); }
public void Add(HullDataObject dataObject) { database.Add(dataObject); }
private void GetHullValues() { HullDataObject hdo = DataController.DataAccess.hullMasterList .Where(h => h.iD.Equals(_hullID)) .First(); if (hdo!=null) { currentHull = hdo; }else if (currentHull == null) { Debug.Log("No hull assigned"); } }