Ejemplo n.º 1
0
        public Database(string path, bool loadAllData)
        {
            _jsonDatabase = new JsonDatabase();
            _jsonDatabase.LoadData(path);

            if (loadAllData)
            {
                _components         = _jsonDatabase.Components.ToDictionary(item => item.Id, item => new Component(item, this));
                _devices            = _jsonDatabase.Devices.ToDictionary(item => item.Id, item => new Device(item, this));
                _weapons            = _jsonDatabase.Weapons.ToDictionary(item => item.Id, item => new Weapon(item, this));
                _ammunition         = _jsonDatabase.Ammunitions.ToDictionary(item => item.Id, item => new Ammunition(item, this));
                _droneBays          = _jsonDatabase.DroneBays.ToDictionary(item => item.Id, item => new DroneBay(item, this));
                _ships              = _jsonDatabase.Ships.ToDictionary(item => item.Id, item => new Ship(item, this));
                _shipBuilds         = _jsonDatabase.ShipBuilds.ToDictionary(item => item.Id, item => new ShipBuild(item, this));
                _satellites         = _jsonDatabase.Satellites.ToDictionary(item => item.Id, item => new Satellite(item, this));
                _satelliteBuilds    = _jsonDatabase.SatelliteBuilds.ToDictionary(item => item.Id, item => new SatelliteBuild(item, this));
                _technologies       = _jsonDatabase.Technologies.ToDictionary(item => item.Id, item => new Technology(item, this));
                _skills             = _jsonDatabase.Skills.ToDictionary(item => item.Id, item => new Skill(item, this));
                _componentStats     = _jsonDatabase.ComponentStats.ToDictionary(item => item.Id, item => new ComponentStats(item, this));
                _componentMods      = _jsonDatabase.ComponentMods.ToDictionary(item => item.Id, item => new ComponentMod(item, this));
                _factions           = _jsonDatabase.Factions.ToDictionary(item => item.Id, item => new Faction(item, this));
                _characters         = _jsonDatabase.Characters.ToDictionary(item => item.Id, item => new Character(item, this));
                _questItems         = _jsonDatabase.QuestItems.ToDictionary(item => item.Id, item => new QuestItem(item, this));
                _ammunitionObsolete = _jsonDatabase.AmmunitionObsolete.ToDictionary(item => item.Id, item => new AmmunitionObsolete(item, this));
                _bulletPrefabs      = _jsonDatabase.BulletPrefabs.ToDictionary(item => item.Id, item => new BulletPrefab(item, this));
                _visualEffects      = _jsonDatabase.VisualEffects.ToDictionary(item => item.Id, item => new VisualEffect(item, this));
            }
        }
Ejemplo n.º 2
0
 public void Load(IDataSource dataSource = null)
 {
     Reset();
     _jsonDatabase = new JsonDatabase(dataSource ?? _defaultDataSource, _serializer);
 }