internal void SetFaction(Entity factionEntity) { FactionInfoDB factionInfo = factionEntity.GetDataBlob <FactionInfoDB>(); StarSystemStates = new Dictionary <Guid, SystemState>(); foreach (var guid in factionInfo.KnownSystems) { StarSystemStates[guid] = new SystemState(Game.Systems[guid], factionEntity); } GalacticMap.SetFaction(); }
public IndustryJob(FactionInfoDB factionInfo, Guid itemID) { ItemGuid = itemID; var design = factionInfo.IndustryDesigns[itemID]; TypeID = design.IndustryTypeID; Name = design.Name; ResourcesRequired = design.ResourceCosts; ProductionPointsLeft = design.IndustryPointCosts; ProductionPointsCost = design.IndustryPointCosts; NumberOrdered = 1; }
public ComponentListVM(Entity factionEntity) { FactionInfoDB factionInfo = factionEntity.GetDataBlob <FactionInfoDB>(); Engines = new ObservableCollection <ComponentListEngineVM>(); foreach (var componentDesign in factionInfo.ComponentDesigns.Values) { if (componentDesign.HasDataBlob <EnginePowerAtbDB>()) { Engines.Add(new ComponentListEngineVM(componentDesign)); } } }
/// <summary> /// "Set" and returns the designdata /// this also sets up a research item for the design, /// and adds it to the factions designs. /// </summary> /// <returns></returns> public ComponentDesign CreateDesign(Entity factionEntity) { FactionInfoDB faction = factionEntity.GetDataBlob <FactionInfoDB>(); //set up the research FactionTechDB factionTech = factionEntity.GetDataBlob <FactionTechDB>(); TechSD tech = new TechSD(); tech.ID = Guid.NewGuid(); tech.Name = _design.Name + " Design Research"; tech.Description = "Research into building " + _design.Name; tech.MaxLevel = 1; tech.CostFormula = _design.ResearchCostValue.ToString(); _design.TechID = tech.ID; factionTech.MakeResearchable(tech); //add it to researchable techs EvalAll(); foreach (var designAttribute in ComponentDesignAttributes.Values) { if (designAttribute.DataBlobType != null) { if (designAttribute.DataBlobArgs == null) { designAttribute.SetValue(); //force recalc. } object[] constructorArgs = designAttribute.DataBlobArgs; try { dynamic attrbute = (IComponentDesignAttribute)Activator.CreateInstance(designAttribute.DataBlobType, constructorArgs); _design.AttributesByType[attrbute.GetType()] = attrbute; } catch (MissingMethodException e) { string exstr = "The Attribute: " + designAttribute.DataBlobType + " was found, but the arguments did not match any constructors.\nThe given arguments are:\n" + designAttribute.DataBlobArgs + "\n" + constructorArgs + "\n" + "which are of type: " + constructorArgs.GetType() + "\nThe full exception is as follows:\n" + e; throw new Exception(exstr); } } } faction.InternalComponentDesigns[_design.ID] = _design; faction.IndustryDesigns[_design.ID] = _design; return(_design); }
internal void HardRefresh() { _factionInfoDB = _uiState.Faction.GetDataBlob <FactionInfoDB>(); if (_selectedEntity.Entity.HasDataBlob <IndustryAbilityDB>()) { _industryDB = _selectedEntity.Entity.GetDataBlob <IndustryAbilityDB>(); _industryPannel = new IndustryPannel2(_uiState, _selectedEntity.Entity, _industryDB); } else { _industryDB = null; _industryPannel = null; } _cargoList = new CargoListPannelSimple(_staticData, _selectedEntity); }
internal void HardRefresh() { _factionInfoDB = _uiState.Faction.GetDataBlob <FactionInfoDB>(); if (_selectedEntity.Entity.HasDataBlob <CargoStorageDB>()) { var storeDB = _selectedEntity.Entity.GetDataBlob <CargoStorageDB>(); _storeVM = new CargoStorageVM(_uiState.Game.StaticData, storeDB); _storeVM.SetUpdateListner(_selectedEntity.Entity.Manager.ManagerSubpulses); } if (_selectedEntity.Entity.HasDataBlob <IndustryAbilityDB>()) { _industryDB = _selectedEntity.Entity.GetDataBlob <IndustryAbilityDB>(); _industryPannel = new IndustryPannel2(_uiState, _selectedEntity.Entity, _industryDB); } else { _industryDB = null; _industryPannel = null; } _cargoList = new CargoListPannelSimple(_staticData, _selectedEntity); /* * lock (_factionInfoDB.ComponentDesigns) * { * int num = _factionInfoDB.ComponentDesigns.Count; * _constructableDesigns = new ComponentDesign[num]; * _constructablesNames = new string[num]; * _constructablesIDs = new Guid[num]; * int i = 0; * foreach (var design in _factionInfoDB.ComponentDesigns) * { * _constructableDesigns[i] = design.Value; * _constructablesIDs[i] = design.Key; * _constructablesNames[i] = design.Value.Name; * i++; * } * * * }*/ }
/// <summary> /// "Set" and returns the designdata /// this also sets up a research item for the design, /// and adds it to the factions designs. /// </summary> /// <returns></returns> public ComponentDesign CreateDesign(Entity factionEntity) { FactionInfoDB faction = factionEntity.GetDataBlob <FactionInfoDB>(); //set up the research FactionTechDB factionTech = factionEntity.GetDataBlob <FactionTechDB>(); TechSD tech = new TechSD(); tech.ID = Guid.NewGuid(); tech.Name = _design.Name + " Design Research"; tech.Description = "Research into building " + _design.Name; tech.MaxLevel = 1; tech.CostFormula = _design.ResearchCostValue.ToString(); _design.TechID = tech.ID; factionTech.MakeResearchable(tech); //add it to researchable techs SetAttributes(); faction.InternalComponentDesigns[_design.ID] = _design; faction.IndustryDesigns[_design.ID] = _design; return(_design); }
/// <summary> /// "Set" and returns the designdata /// this also sets up a research item for the design, /// and adds it to the factions designs. /// </summary> /// <returns></returns> public ComponentDesign CreateDesign(Entity factionEntity) { FactionInfoDB faction = factionEntity.GetDataBlob <FactionInfoDB>(); //set up the research FactionTechDB factionTech = factionEntity.GetDataBlob <FactionTechDB>(); TechSD tech = new TechSD(); tech.ID = Guid.NewGuid(); tech.Name = _design.Name + " Design Research"; tech.Description = "Research into building " + _design.Name; tech.MaxLevel = 1; tech.CostFormula = _design.ResearchCostValue.ToString(); _design.TechID = tech.ID; factionTech.MakeResearchable(tech); //add it to researchable techs EvalAll(); foreach (var designAttribute in ComponentDesignAttributes.Values) { if (designAttribute.DataBlobType != null) { if (designAttribute.DataBlobArgs == null) { designAttribute.SetValue(); //force recalc. } object[] constructorArgs = designAttribute.DataBlobArgs; dynamic attrbute = (IComponentDesignAttribute)Activator.CreateInstance(designAttribute.DataBlobType, constructorArgs); _design.AttributesByType.Add(attrbute.GetType(), attrbute); } } faction.InternalComponentDesigns.Add(_design.Guid, _design); return(_design); }
public List <IConstrucableDesign> GetJobItems(FactionInfoDB factionInfoDB) { return(factionInfoDB.IndustryDesigns.Values.ToList()); }