示例#1
0
        public WdCountry(string name, WdData data, JsonDict tanks, JsonDict engines, JsonDict guns, JsonDict radios, JsonDict shells)
        {
            Name = name;

            Engines = new Dictionary <string, WdEngine>();
            foreach (var kvp in engines["shared"].GetDict())
            {
                var engine = new WdEngine(kvp.Key, kvp.Value.GetDict(), data);
                Engines.Add(kvp.Key, engine);
            }

            Radios = new Dictionary <string, WdRadio>();
            foreach (var kvp in radios["shared"].GetDict())
            {
                var radio = new WdRadio(kvp.Key, kvp.Value.GetDict(), data);
                Radios.Add(kvp.Key, radio);
            }

            Shells = new Dictionary <string, WdShell>();
            foreach (var kvp in shells.GetDict())
            {
                if (kvp.Key == "icons")
                {
                    continue;
                }
                var shell = new WdShell(kvp.Key, kvp.Value.GetDict(), data);
                Shells.Add(kvp.Key, shell);
            }

            Guns = new Dictionary <string, WdGun>();
            foreach (var kvp in guns["shared"].GetDict())
            {
                try
                {
                    var gun = new WdGun(kvp.Key, kvp.Value.GetDict(), data, this);
                    Guns.Add(kvp.Key, gun);
                }
                catch
                {
                    data.Warnings.Add("Could not load gun data for gun “{0}”".Fmt(kvp.Key));
                }
            }

            Tanks   = new Dictionary <string, WdTank>();
            Chassis = new Dictionary <string, WdChassis>();
            Turrets = new Dictionary <string, WdTurret>();
            foreach (var kvp in tanks.GetDict())
            {
                if (Name == "usa" && kvp.Key == "Sexton_I")
                {
                    continue; // this tank is weird; it's the only one which has non-"shared" modules with identical keys to another tank. Ignore it.
                }
                var tank = new WdTank(kvp.Key, kvp.Value.GetDict(), this, data);
                Tanks.Add(tank.RawId, tank);
            }
        }
示例#2
0
 public WotTank(WotTank tank)
 {
     TankId     = tank.TankId;
     Country    = tank.Country;
     Tier       = tank.Tier;
     Class      = tank.Class;
     Category   = tank.Category;
     Context    = tank.Context;
     _extras    = tank._extras;
     ClientData = tank.ClientData;
 }