public ComponentStats GetComponentStats(int id) { if (!_componentStatsMap.TryGetValue(id, out var item)) { var serializable = _content.GetComponentStats(id); item = new ComponentStats(serializable, this); _componentStatsMap.Add(id, item); } return(item); }
public ComponentStats GetComponentStats(ItemId <ComponentStats> id, bool notNull = false) { if (_database._componentStatsMap.TryGetValue(id.Value, out var item)) { return(item); } var serializable = _content.GetComponentStats(id.Value); if (serializable != null && !serializable.Disabled) { return(ComponentStats.Create(serializable, this)); } var value = ComponentStats.DefaultValue; if (notNull && value == null) { throw new DatabaseException("Data not found " + id); } return(value); }
public void Load() { foreach (var item in _content.AmmunitionObsoleteList) { if (!item.Disabled && !_database._ammunitionObsoleteMap.ContainsKey(item.Id)) { AmmunitionObsolete.Create(item, this); } } foreach (var item in _content.ComponentList) { if (!item.Disabled && !_database._componentMap.ContainsKey(item.Id)) { Component.Create(item, this); } } foreach (var item in _content.ComponentModList) { if (!item.Disabled && !_database._componentModMap.ContainsKey(item.Id)) { ComponentMod.Create(item, this); } } foreach (var item in _content.ComponentStatsList) { if (!item.Disabled && !_database._componentStatsMap.ContainsKey(item.Id)) { ComponentStats.Create(item, this); } } foreach (var item in _content.DeviceList) { if (!item.Disabled && !_database._deviceMap.ContainsKey(item.Id)) { Device.Create(item, this); } } foreach (var item in _content.DroneBayList) { if (!item.Disabled && !_database._droneBayMap.ContainsKey(item.Id)) { DroneBay.Create(item, this); } } foreach (var item in _content.FactionList) { if (!item.Disabled && !_database._factionMap.ContainsKey(item.Id)) { Faction.Create(item, this); } } foreach (var item in _content.SatelliteList) { if (!item.Disabled && !_database._satelliteMap.ContainsKey(item.Id)) { Satellite.Create(item, this); } } foreach (var item in _content.SatelliteBuildList) { if (!item.Disabled && !_database._satelliteBuildMap.ContainsKey(item.Id)) { SatelliteBuild.Create(item, this); } } foreach (var item in _content.ShipList) { if (!item.Disabled && !_database._shipMap.ContainsKey(item.Id)) { Ship.Create(item, this); } } foreach (var item in _content.ShipBuildList) { if (!item.Disabled && !_database._shipBuildMap.ContainsKey(item.Id)) { ShipBuild.Create(item, this); } } foreach (var item in _content.SkillList) { if (!item.Disabled && !_database._skillMap.ContainsKey(item.Id)) { Skill.Create(item, this); } } foreach (var item in _content.TechnologyList) { if (!item.Disabled && !_database._technologyMap.ContainsKey(item.Id)) { Technology.Create(item, this); } } foreach (var item in _content.CharacterList) { if (!item.Disabled && !_database._characterMap.ContainsKey(item.Id)) { Character.Create(item, this); } } foreach (var item in _content.FleetList) { if (!item.Disabled && !_database._fleetMap.ContainsKey(item.Id)) { Fleet.Create(item, this); } } foreach (var item in _content.LootList) { if (!item.Disabled && !_database._lootMap.ContainsKey(item.Id)) { LootModel.Create(item, this); } } foreach (var item in _content.QuestList) { if (!item.Disabled && !_database._questMap.ContainsKey(item.Id)) { QuestModel.Create(item, this); } } foreach (var item in _content.QuestItemList) { if (!item.Disabled && !_database._questItemMap.ContainsKey(item.Id)) { QuestItem.Create(item, this); } } foreach (var item in _content.AmmunitionList) { if (!item.Disabled && !_database._ammunitionMap.ContainsKey(item.Id)) { Ammunition.Create(item, this); } } foreach (var item in _content.BulletPrefabList) { if (!item.Disabled && !_database._bulletPrefabMap.ContainsKey(item.Id)) { BulletPrefab.Create(item, this); } } foreach (var item in _content.VisualEffectList) { if (!item.Disabled && !_database._visualEffectMap.ContainsKey(item.Id)) { VisualEffect.Create(item, this); } } foreach (var item in _content.WeaponList) { if (!item.Disabled && !_database._weaponMap.ContainsKey(item.Id)) { Weapon.Create(item, this); } } foreach (var item in _content.Images) { if (!_database._images.ContainsKey(item.Key)) { _database._images.Add(item.Key, item.Value); } } foreach (var item in _content.AudioClips) { if (!_database._audioClips.ContainsKey(item.Key)) { _database._audioClips.Add(item.Key, item.Value); } } foreach (var item in _content.Localizations) { if (!_database._localizations.ContainsKey(item.Key)) { _database._localizations.Add(item.Key, item.Value); } } if (_database.DatabaseSettings == null) { _database.DatabaseSettings = DatabaseSettings.Create(_content.DatabaseSettings ?? new Serializable.DatabaseSettingsSerializable { ItemType = Enums.ItemType.DatabaseSettings }, this); } if (_database.ExplorationSettings == null) { _database.ExplorationSettings = ExplorationSettings.Create(_content.ExplorationSettings ?? new Serializable.ExplorationSettingsSerializable { ItemType = Enums.ItemType.ExplorationSettings }, this); } if (_database.GalaxySettings == null) { _database.GalaxySettings = GalaxySettings.Create(_content.GalaxySettings ?? new Serializable.GalaxySettingsSerializable { ItemType = Enums.ItemType.GalaxySettings }, this); } if (_database.ShipSettings == null) { _database.ShipSettings = ShipSettings.Create(_content.ShipSettings ?? new Serializable.ShipSettingsSerializable { ItemType = Enums.ItemType.ShipSettings }, this); } }
public void AddComponentStats(int id, ComponentStats item) { _database._componentStatsMap.Add(id, item); }