Exemple #1
0
        public Tank(TankInfo info)
            : base(info.Database)
        {
            this.Name         = info.Name;
            this.Tier         = info.Tier;
            this.Description  = info.Description;
            this.Class        = info.Class;
            this.Key          = info.Key;
            this.Nation       = info.Nation;
            this.Id           = info.Id;
            this.Price        = info.Price;
            this.ShortName    = info.ShortName;
            this.NotInShop    = info.NotInShop;
            this.CurrencyType = info.CurrencyType;
            this.Tags         = info.Tags;

            this.Crews = new List <Crew>();

            _availableModuleDictionaries = new Dictionary <Type, object>();

            this.AvailableChassis = new Dictionary <string, Chassis>();
            _availableModuleDictionaries.Add(typeof(Chassis), AvailableChassis);

            this.AvailableEngines = new Dictionary <string, Engine>();
            _availableModuleDictionaries.Add(typeof(Engine), AvailableEngines);

            this.AvailableRadios = new Dictionary <string, Radio>();
            _availableModuleDictionaries.Add(typeof(Radio), AvailableRadios);

            this.AvailableTurrets = new Dictionary <string, Turret>();
            _availableModuleDictionaries.Add(typeof(Turret), AvailableTurrets);

            this.AvailableFuelTanks = new Dictionary <string, FuelTank>();
            _availableModuleDictionaries.Add(typeof(FuelTank), AvailableFuelTanks);

            this.AvailableGuns = new Dictionary <string, Gun>();
            _availableModuleDictionaries.Add(typeof(Gun), AvailableGuns);

            _lazyAvailableEquipments  = new Lazy <Dictionary <string, Equipment> >(GetAvailableEquipments);
            _lazyAvailableConsumables = new Lazy <Dictionary <string, Consumable> >(GetAvailableConsumables);
        }
        private void LoadTankInfo()
        {
            Log.Info("loading tank info");

            this.TankInfoCollection = new List <TankInfo>();

            using (var stream = new PackageStream(this.Database.PackageDatabase, this.GetPackageFileName("list.xml")))
            {
                using (var reader = new BigworldXmlReader(stream))
                {
                    reader.ReadStartElement("FromStream");

                    while (reader.IsStartElement())
                    {
                        var tankInfo = new TankInfo(this);
                        tankInfo.Deserialize(reader);
                        this.TankInfoCollection.Add(tankInfo);
                    }

                    reader.ReadEndElement();
                }
            }
        }