Beispiel #1
0
        public int GetShipCount(int shipTypeID)
        {
            var entry = CelestialObjectShips.SingleOrDefault(x => x.ShipTypeID == shipTypeID);

            if (entry != null)
            {
                return(entry.Count);
            }
            else
            {
                return(0);
            }
        }
Beispiel #2
0
        public void SetShipCount(int shipTypeID, int count)
        {
            var entry = CelestialObjectShips.SingleOrDefault(x => x.ShipTypeID == shipTypeID);

            if (entry == null)
            {
                entry            = new CelestialObjectShip();
                entry.ShipTypeID = shipTypeID;
                CelestialObjectShips.Add(entry);
            }
            entry.Count = count;
            if (count == 0)
            {
                CelestialObjectShips.Remove(entry);
            }
        }