コード例 #1
0
        public void FillList(string newTypeFullName)
        {
            List <string> dbTypes = GetDbTypes(newTypeFullName);
            DPSData       dpsData = new DPSData(newTypeFullName);

            using (CargoContext cargoContext = new CargoContext())
            {
                List <Equipment> equipment = new List <Equipment>();

                var temp = cargoContext.ShipGirlsEquipment.Where(e => dbTypes.Contains(e.Type))
                           .Include(e => e.FK_Tech)
                           .Include(e => e.FK_Nationality)
                           .Include(e => e.FK_Nationality.FK_Icon)
                           .Include(e => e.FK_Type);

                if (temp != null)
                {
                    equipment.AddRange(temp);
                }

                ActionBlock <Equipment> loadBlock = new ActionBlock <Equipment>(
                    (equip) =>
                {
                    AddItemToList(equip, equip.FK_Type.Name, dpsData);
                });

                foreach (Equipment equip in equipment)
                {
                    loadBlock.Post(equip);
                }

                loadBlock.Complete();
                loadBlock.Completion.Wait();
            }
        }
コード例 #2
0
        public void ChangeCurrentListStats(string type)
        {
            List <BaseEquipmentItem> list = (GetList(type) as IEnumerable <object>)?
                                            .Cast <BaseEquipmentItem>()?.ToList();

            DPSData dpsData = new DPSData(type);

            list?.ForEach(item => item.ChangeStats(dpsData));
        }
コード例 #3
0
        private void AddItemToList(Equipment item, string newType, DPSData dpsData)
        {
            switch (newType)
            {
            case "AA Gun":
                AAGuns.Add(new AAGun(item, dpsData));
                break;

            case "Auxiliary":
                AuxiliaryItems.Add(new AuxiliaryItem(item));
                break;

            case "Submarine Torpedo":
                SubmarineTorpedoes.Add(new SubmarineTorpedo(item, dpsData));
                break;

            case "Torpedo":
                Torpedoes.Add(new Torpedo(item, dpsData));
                break;

            case "Torpedo Bomber":
                TorpedoBomberPlanes.Add(new TorpedoBomberPlane(item, dpsData));
                break;

            case string s when s.Contains("Gun"):
                MainGuns.Add(new MainGun(item, dpsData));

                break;

            case string s when s == "Fighter" || s == "Dive Bomber" || s == "Seaplane":
                Planes.Add(new Plane(item, dpsData));
                break;

            default:
                AswItems.Add(new ASWItem(item));
                break;
            }
        }
コード例 #4
0
 public virtual void ChangeStats(DPSData dpsData = null)
 {
     this.DisplayMaxStats = !this.DisplayMaxStats;
 }