public void TestEngineComponentFactory() { ComponentTemplateSD componentTemplateSD = EngineComponentSD(); ComponentDesigner designer = new ComponentDesigner(componentTemplateSD, _faction.GetDataBlob <FactionTechDB>()); foreach (var ability in designer.ComponentDesignAttributes.Values) { if (ability.GuiHint == GuiHint.GuiTechSelectionList) { List <Guid> selectionlist = ability.GuidDictionary.Keys.Cast <Guid>().ToList(); ability.SetValueFromGuidList(selectionlist[selectionlist.Count - 1]); } else if (ability.GuiHint == GuiHint.GuiSelectionMaxMin) { ability.SetMax(); ability.SetValueFromInput(ability.MaxValue); } else { ability.SetValue(); } } designer.ComponentDesignAttributes["Size"].SetValueFromInput(250); ComponentDesign engineDesign = designer.CreateDesign(_faction); Assert.AreEqual(250, engineDesign.Mass); Dictionary <Guid, ComponentTemplateSD> componentsDict = new Dictionary <Guid, ComponentTemplateSD>(); componentsDict.Add(componentTemplateSD.ID, componentTemplateSD); StaticDataManager.ExportStaticData(componentsDict, "EngineComponentTest.json"); }
public void TestCargoType() { Dictionary <Guid, CargoTypeSD> cargoTypes = new Dictionary <Guid, CargoTypeSD>(); CargoTypeSD cargoTypeGeneral = new CargoTypeSD() { ID = new Guid("16B4C4F0-7292-4F4D-8FEA-22103C70B288"), Name = "General", Description = "Storage for general cargo items" }; cargoTypes.Add(cargoTypeGeneral.ID, cargoTypeGeneral); CargoTypeSD cargoTypeFuel = new CargoTypeSD() { ID = new Guid("D8E8DA2D-8DC8-4A3F-B989-5F2E67C55E77"), Name = "Fuel", Description = "Storage for fuel" }; cargoTypes.Add(cargoTypeFuel.ID, cargoTypeFuel); CargoTypeSD cargoTypePopulation = new CargoTypeSD() { ID = new Guid("9E52A3AF-66AF-4935-982D-26F3FEE775B0"), Name = "Cryogenic Storage", Description = "Storage for frozen people" }; cargoTypes.Add(cargoTypePopulation.ID, cargoTypePopulation); StaticDataManager.ExportStaticData(cargoTypes, "CargoTypeDataExportTest.json"); }
public void TestCargoComponentCreation() { ComponentTemplateSD cargo = GeneralCargo(); ComponentDesigner cargoDesigner = new ComponentDesigner(cargo, _faction.GetDataBlob <FactionTechDB>()); cargoDesigner.ComponentDesignAttributes["Size"].SetValue(); ComponentDesign cargoDesign = cargoDesigner.CreateDesign(_faction); bool hasAttribute = cargoDesign.TryGetAttribute <CargoStorageAtbDB>(out var attributeDB); Assert.IsTrue(hasAttribute); CargoTypeSD cargotype = _game.StaticData.CargoTypes[attributeDB.CargoTypeGuid]; Assert.AreEqual(100, attributeDB.StorageCapacity); Dictionary <Guid, ComponentTemplateSD> componentsDict = new Dictionary <Guid, ComponentTemplateSD>(); componentsDict.Add(cargo.ID, cargo); StaticDataManager.ExportStaticData(componentsDict, "CargoComponentTest.json"); }
public void TestRefinedMatsSave() { Dictionary <Guid, ProcessedMaterialSD> mats = new Dictionary <Guid, ProcessedMaterialSD>(); ProcessedMaterialSD soriumFuel = new ProcessedMaterialSD(); soriumFuel.Name = "Sorium Fuel"; soriumFuel.Description = "Fuel for SpaceShips"; soriumFuel.ID = new Guid("33E6AC88-0235-4917-A7FF-35C8886AAD3A"); soriumFuel.MineralsRequired = new Dictionary <Guid, int>(); soriumFuel.MineralsRequired.Add(new Guid("08f15d35-ea1d-442f-a2e3-bde04c5c22e9"), 1); soriumFuel.Mass = 1; //soriumFuel.CargoType = CargoType.Fuel; soriumFuel.IndustryPointCosts = 10; soriumFuel.OutputAmount = 1; mats.Add(soriumFuel.ID, soriumFuel); ProcessedMaterialSD DepleatedDuranuim = new ProcessedMaterialSD(); DepleatedDuranuim.Name = "Depleated Duranuim"; DepleatedDuranuim.Description = "A mix of Duranium and refined fuel to teset refinarys"; DepleatedDuranuim.ID = new Guid("6DA93677-EE08-4853-A8A5-0F46D93FE0EB"); DepleatedDuranuim.MineralsRequired = new Dictionary <Guid, int>(); DepleatedDuranuim.MineralsRequired.Add(new Guid("2dfc78ea-f8a4-4257-bc04-47279bf104ef"), 5); DepleatedDuranuim.MaterialsRequired = new Dictionary <Guid, int>(); DepleatedDuranuim.MaterialsRequired.Add(new Guid("33E6AC88-0235-4917-A7FF-35C8886AAD3A"), 1); DepleatedDuranuim.Mass = 1; //DepleatedDuranuim.CargoType = CargoType.General; DepleatedDuranuim.IndustryPointCosts = 20; DepleatedDuranuim.OutputAmount = 6; mats.Add(DepleatedDuranuim.ID, DepleatedDuranuim); StaticDataManager.ExportStaticData(mats, "ReinfedMaterialsDataExportTest.json"); }
public void TestEngineComponentFactory() { ComponentTemplateSD engine = EngineComponentSD(); ComponentDesign design = GenericComponentFactory.StaticToDesign(engine, _faction.GetDataBlob <FactionTechDB>(), _game.StaticData); foreach (var ability in design.ComponentDesignAttributes) { if (ability.GuiHint == GuiHint.GuiTechSelectionList) { List <Guid> selectionlist = ability.GuidDictionary.Keys.Cast <Guid>().ToList(); ability.SetValueFromGuidList(selectionlist[selectionlist.Count - 1]); } else if (ability.GuiHint == GuiHint.GuiSelectionMaxMin) { ability.SetMax(); ability.SetValueFromInput(ability.MaxValue); } else { ability.SetValue(); } } design.ComponentDesignAttributes[0].SetValueFromInput(250); Entity engineEntity = GenericComponentFactory.DesignToDesignEntity(_game, _faction, design); Assert.AreEqual(250, engineEntity.GetDataBlob <ComponentInfoDB>().SizeInTons); Dictionary <Guid, ComponentTemplateSD> componentsDict = new Dictionary <Guid, ComponentTemplateSD>(); componentsDict.Add(engine.ID, engine); StaticDataManager.ExportStaticData(componentsDict, "EngineComponentTest.json"); }
public static void SaveDataToDirectory(string dir) { StaticDataManager.ExportStaticData(Program.staticData.Installations, dir + "\\InstallationData.json"); StaticDataManager.ExportStaticData(Program.staticData.Components, dir + "\\ComponentData.json"); StaticDataManager.ExportStaticData(Program.staticData.Minerals, dir + "\\MineralData.json"); StaticDataManager.ExportStaticData(Program.staticData.Techs, dir + "\\TechnologyData.json"); StaticDataManager.ExportStaticData(Program.staticData.SystemGenSettings, dir + "\\SystemGenSettings.json"); }
public void TestSingleSystemSave() { _game = TestingUtilities.CreateTestUniverse(1); _smAuthToken = new AuthenticationToken(_game.SpaceMaster); StarSystemFactory starsysfac = new StarSystemFactory(_game); StarSystem sol = starsysfac.CreateSol(_game); StaticDataManager.ExportStaticData(sol, "solsave.json"); }
public void TestMineInstalationFactory() { ComponentTemplateSD mine = MineInstallation(); ComponentDesigner mineDesigner = new ComponentDesigner(mine, _faction.GetDataBlob <FactionTechDB>()); mineDesigner.ComponentDesignAttributes["MiningAmount"].SetValue(); ComponentDesign mineDesign = mineDesigner.CreateDesign(_faction); Assert.AreEqual(10, mineDesign.GetAttribute <MineResourcesAtbDB>().ResourcesPerEconTick.Values.ElementAt(0)); Dictionary <Guid, ComponentTemplateSD> componentsDict = new Dictionary <Guid, ComponentTemplateSD>(); componentsDict.Add(mine.ID, mine); StaticDataManager.ExportStaticData(componentsDict, "MineComponentTest.json"); }
public void ExportComponents() { ComponentTemplateSD engine = EngineComponentSD(); ComponentTemplateSD mine = MineInstallation(); ComponentTemplateSD lab = ResearchLab(); ComponentTemplateSD refinery = Refinery(); ComponentTemplateSD factory = Factory(); Dictionary <Guid, ComponentTemplateSD> componentsDict = new Dictionary <Guid, ComponentTemplateSD>(); componentsDict.Add(engine.ID, engine); componentsDict.Add(mine.ID, mine); componentsDict.Add(lab.ID, lab); componentsDict.Add(refinery.ID, refinery); componentsDict.Add(factory.ID, factory); StaticDataManager.ExportStaticData(componentsDict, "ComponentData.json"); }
public void TestMineInstalationFactory() { ComponentTemplateSD mine = MineInstallation(); ComponentDesign mineDesign = GenericComponentFactory.StaticToDesign(mine, _faction.GetDataBlob <FactionTechDB>(), _game.StaticData); mineDesign.ComponentDesignAttributes[0].SetValue(); Entity mineEntity = GenericComponentFactory.DesignToDesignEntity(_game, _faction, mineDesign); Assert.AreEqual(10, mineEntity.GetDataBlob <MineResourcesAtbDB>().ResourcesPerEconTick.Values.ElementAt(0)); Dictionary <Guid, ComponentTemplateSD> componentsDict = new Dictionary <Guid, ComponentTemplateSD>(); componentsDict.Add(mine.ID, mine); StaticDataManager.ExportStaticData(componentsDict, "MineComponentTest.json"); }
public void TestFactoryComponentCreation() { ComponentTemplateSD factory = Factory(); ComponentDesigner facDesigner = new ComponentDesigner(factory, _faction.GetDataBlob <FactionTechDB>()); facDesigner.ComponentDesignAttributes["Instalation Construction Points"].SetValue(); ComponentDesign facDesign = facDesigner.CreateDesign(_faction); ConstructionAtbDB attributeDB = facDesign.GetAttribute <ConstructionAtbDB>(); Assert.AreEqual(100, attributeDB.ConstructionPoints[ConstructionType.ShipComponents]); Dictionary <Guid, ComponentTemplateSD> componentsDict = new Dictionary <Guid, ComponentTemplateSD>(); componentsDict.Add(factory.ID, factory); StaticDataManager.ExportStaticData(componentsDict, "FactoryComponentTest.json"); }
public void TestFactoryComponentCreation() { ComponentTemplateSD factory = Factory(); ComponentDesign facDesign = GenericComponentFactory.StaticToDesign(factory, _faction.GetDataBlob <FactionTechDB>(), _game.StaticData); facDesign.ComponentDesignAttributes[0].SetValue(); Entity facDesignEntity = GenericComponentFactory.DesignToDesignEntity(_game, _faction, facDesign); ConstructionAtbDB attributeDB = facDesignEntity.GetDataBlob <ConstructionAtbDB>(); Assert.AreEqual(100, attributeDB.ConstructionPoints[ConstructionType.ShipComponents]); Dictionary <Guid, ComponentTemplateSD> componentsDict = new Dictionary <Guid, ComponentTemplateSD>(); componentsDict.Add(factory.ID, factory); StaticDataManager.ExportStaticData(componentsDict, "FactoryComponentTest.json"); }
public void TestCargoComponentCreation() { ComponentTemplateSD cargo = GeneralCargo(); ComponentDesign cargoDesign = GenericComponentFactory.StaticToDesign(cargo, _faction.GetDataBlob <FactionTechDB>(), _game.StaticData); cargoDesign.ComponentDesignAttributes[0].SetValue(); Entity cargoEntity = GenericComponentFactory.DesignToDesignEntity(_game, _faction, cargoDesign); CargoStorageAtbDB attributeDB = cargoEntity.GetDataBlob <CargoStorageAtbDB>(); CargoTypeSD cargotype = _game.StaticData.CargoTypes[attributeDB.CargoTypeGuid]; Assert.AreEqual(100, attributeDB.StorageCapacity); Dictionary <Guid, ComponentTemplateSD> componentsDict = new Dictionary <Guid, ComponentTemplateSD>(); componentsDict.Add(cargo.ID, cargo); StaticDataManager.ExportStaticData(componentsDict, "CargoComponentTest.json"); }
public void TestTechSave() { Dictionary <Guid, TechSD> techs = new Dictionary <Guid, TechSD>(); TechSD enginePowerModMax = new TechSD(); enginePowerModMax.ID = new Guid("b8ef73c7-2ef0-445e-8461-1e0508958a0e"); enginePowerModMax.MaxLevel = 7; enginePowerModMax.DataFormula = "[Level] * 1.5"; enginePowerModMax.Name = "Maximum Engine Power Modifier"; enginePowerModMax.Description = ""; enginePowerModMax.Category = ResearchCategories.PowerAndPropulsion; enginePowerModMax.CostFormula = "[Level] * 1"; enginePowerModMax.Requirements = new Dictionary <Guid, int>(); techs.Add(enginePowerModMax.ID, enginePowerModMax); TechSD enginePowerModMin = new TechSD(); enginePowerModMin.ID = new Guid("08fa4c4b-0ddb-4b3a-9190-724d715694de"); enginePowerModMin.MaxLevel = 7; enginePowerModMin.DataFormula = "1.0 - [Level] * 0.05"; enginePowerModMin.Name = "Minimum Engine Power Modifier"; enginePowerModMin.Description = ""; enginePowerModMin.Category = ResearchCategories.PowerAndPropulsion; enginePowerModMin.CostFormula = "[Level] * 1"; enginePowerModMin.Requirements = new Dictionary <Guid, int>(); techs.Add(enginePowerModMin.ID, enginePowerModMin); TechSD fuelUsage = new TechSD(); fuelUsage.ID = new Guid("8557acb9-c764-44e7-8ee4-db2c2cebf0bc"); fuelUsage.MaxLevel = 12; fuelUsage.DataFormula = "1 - [Level] * 0.1"; fuelUsage.Name = "Fuel Consumption: 1 Litre per Engine Power Hour"; fuelUsage.Description = ""; fuelUsage.Category = ResearchCategories.PowerAndPropulsion; fuelUsage.CostFormula = "[Level] * 1"; fuelUsage.Requirements = new Dictionary <Guid, int>(); techs.Add(fuelUsage.ID, fuelUsage); TechSD EngineTech1 = new TechSD(); EngineTech1.ID = new Guid("35608fe6-0d65-4a5f-b452-78a3e5e6ce2c"); EngineTech1.MaxLevel = 1; EngineTech1.DataFormula = "0.2"; EngineTech1.Name = "Conventional Engine Technology"; EngineTech1.Description = ""; EngineTech1.Category = ResearchCategories.PowerAndPropulsion; EngineTech1.CostFormula = "[Level] * 500"; EngineTech1.Requirements = new Dictionary <Guid, int>(); techs.Add(EngineTech1.ID, EngineTech1); TechSD EngineTech2 = new TechSD(); EngineTech2.ID = new Guid("c827d369-3f16-43ef-b112-7d5bcafb74c7"); EngineTech2.MaxLevel = 1; EngineTech2.DataFormula = "5"; EngineTech2.Name = "Nuclear Thermal Engine Technology"; EngineTech2.Description = ""; EngineTech2.Category = ResearchCategories.PowerAndPropulsion; EngineTech2.CostFormula = "[Level] * 2500"; EngineTech2.Requirements = new Dictionary <Guid, int>(); EngineTech2.Requirements.Add(new Guid("35608fe6-0d65-4a5f-b452-78a3e5e6ce2c"), 1); techs.Add(EngineTech2.ID, EngineTech2); TechSD EngineTech3 = new TechSD(); EngineTech3.ID = new Guid("db6818f3-99e9-46c1-b903-f3af978c38b2"); EngineTech3.MaxLevel = 1; EngineTech3.DataFormula = "5"; EngineTech3.Name = "Nuclear Pulse Engine Technology"; EngineTech3.Description = ""; EngineTech3.Category = ResearchCategories.PowerAndPropulsion; EngineTech3.CostFormula = "[Level] * 5000"; EngineTech3.Requirements = new Dictionary <Guid, int>(); EngineTech3.Requirements.Add(new Guid("c827d369-3f16-43ef-b112-7d5bcafb74c7"), 1); techs.Add(EngineTech3.ID, EngineTech3); TechSD EngineTech4 = new TechSD(); EngineTech4.ID = new Guid("f3f10e56-9345-40cc-af42-342e7240355d"); EngineTech4.MaxLevel = 1; EngineTech4.DataFormula = "5"; EngineTech4.Name = "Ion Drive Technology"; EngineTech4.Description = ""; EngineTech4.Category = ResearchCategories.PowerAndPropulsion; EngineTech4.CostFormula = "[Level] * 10000";; EngineTech4.Requirements = new Dictionary <Guid, int>(); EngineTech4.Requirements.Add(new Guid("db6818f3-99e9-46c1-b903-f3af978c38b2"), 1); techs.Add(EngineTech4.ID, EngineTech4); StaticDataManager.ExportStaticData(techs, "TechnologyDataExportTest.json"); }
public void TestExport() { WeightedList <AtmosphericGasSD> atmoGases = new WeightedList <AtmosphericGasSD>(); AtmosphericGasSD gas = new AtmosphericGasSD(); gas.BoilingPoint = 100; gas.MeltingPoint = 0; gas.ChemicalSymbol = "H20"; gas.Name = "Water"; gas.IsToxic = false; atmoGases.Add(1.0, gas); gas.BoilingPoint = 100; gas.MeltingPoint = 0; gas.ChemicalSymbol = "H2O"; gas.Name = "Water Second take"; gas.IsToxic = false; atmoGases.Add(1.0, gas); StaticDataManager.ExportStaticData(atmoGases, "AtmoGasesExportTest.json"); List <CommanderNameThemeSD> nameThemes = new List <CommanderNameThemeSD>(); CommanderNameThemeSD nameTheme = new CommanderNameThemeSD(); nameTheme.NameList = new List <CommanderNameSD>(); nameTheme.ThemeName = "The Creators"; CommanderNameSD name = new CommanderNameSD(); name.First = "Greg"; name.Last = "Nott"; name.IsFemale = false; nameTheme.NameList.Add(name); name.First = "Rod"; name.Last = "Serling"; name.IsFemale = false; nameTheme.NameList.Add(name); nameThemes.Add(nameTheme); StaticDataManager.ExportStaticData(nameThemes, "CommanderNameThemeExportTest.json"); StaticDataManager.ExportStaticData(VersionInfo.PulsarVersionInfo, "VersionInfoExportTest.vinfo"); List <MineralSD> minList = new List <MineralSD>(); MineralSD min = new MineralSD(); min.Abundance = new Dictionary <BodyType, double>(); min.Abundance.Add(BodyType.Asteroid, 0.01); min.Abundance.Add(BodyType.Comet, 0.05); min.Abundance.Add(BodyType.DwarfPlanet, 0.075); min.Abundance.Add(BodyType.GasDwarf, 0.1); min.Abundance.Add(BodyType.GasGiant, 1.0); min.Abundance.Add(BodyType.IceGiant, 0.5); min.Abundance.Add(BodyType.Moon, 0.5); min.Abundance.Add(BodyType.Terrestrial, 1.0); min.ID = Guid.NewGuid(); min.Name = "Sorium"; min.Description = "des"; minList.Add(min); StaticDataManager.ExportStaticData(minList, "MineralsExportTest.json"); //Dictionary<ID, TechSD> techs = Tech(); //TechSD tech1 = new TechSD(); //tech1.Name = "Trans-Newtonian Technology"; //tech1.Requirements = new Dictionary<ID, int>(); //tech1.Description = "Unlocks almost all other technology."; //tech1.Cost = 1000; //tech1.Category = ResearchCategories.ConstructionProduction; //tech1.ID = ID.NewGuid(); //TechSD tech2 = new TechSD(); //tech2.Name = "Construction Rate"; //tech2.Requirements = new Dictionary<ID, int>(); //tech2.Requirements.Add(tech1.ID, 0); //tech2.Description = "Boosts Construction Rate by 12 BP"; //tech2.Cost = 3000; //tech2.Category = ResearchCategories.ConstructionProduction; //tech2.ID = ID.NewGuid(); //techs.Add(tech1.ID, tech1); //techs.Add(tech2.ID, tech2); //StaticDataManager.ExportStaticData(techs, "./TechnologyDataExportTest.json"); //InstallationSD install = new InstallationSD(); //install.Name = "Mine"; //install.Description = "Employs population to mine transnewtonian resources."; //install.PopulationRequired = 1; //install.CargoSize = 1; //install.BaseAbilityAmounts = new Dictionary<AbilityType, int>(); //install.BaseAbilityAmounts.Add(AbilityType.Mine, 1); //install.TechRequirements = new List<ID>(); //install.TechRequirements.Add(tech1.ID); //use trans-newtonian techology you just added to the tech list //install.ResourceCosts = new Dictionary<ID, int>(); //install.ResourceCosts.Add(min.ID,60); //use Sorium that you just added to the mineral list //install.WealthCost = 120; //install.BuildPoints = 120; //installations.Add(install); //ComponentAbilitySD launchAbility = new ComponentAbilitySD(); //launchAbility.Ability = AbilityType.LaunchMissileSize; //launchAbility.AbilityAmount = new List<float>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; //launchAbility.CrewAmount = new List<float>() { 3, 6, 9, 12, 15, 18, 21, 24, 27, 30}; ////launchAbility.ID = ID.NewGuid(); //launchAbility.Name = "Missile Launcher Size"; //launchAbility.Description = "Can fire a missile of this size or smaller"; //launchAbility.WeightAmount = new List<float>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; //launchAbility.TechRequirements = new List<ID>() { }; //ComponentAbilitySD reloadAbility = new ComponentAbilitySD(); //reloadAbility.Name = "Missile Launcher Reload Rate"; //reloadAbility.Description = "Speed at which this launcher can reload from a magazine"; ////reloadAbility.ID = ID.NewGuid(); //reloadAbility.Ability = AbilityType.ReloadRateFromMag; //reloadAbility.AbilityAmount = new List<float>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; //reloadAbility.CrewAmount = new List<float>() { }; //ComponentSD missileLauncher = new ComponentSD(); //missileLauncher.ComponentAbilitySDs = new List<ComponentAbilitySD>() { launchAbility, reloadAbility}; //missileLauncher.Name = "MissileLauncher"; //missileLauncher.Description = "Can launch Missiles and be reloaded via a magazine"; //missileLauncher.ID = ID.NewGuid(); ////StaticDataManager.ExportStaticData(launchAbility, "./launcherabilitytest.json"); ////StaticDataManager.ExportStaticData(reloadAbility, "./launcherabilitytest.json"); //Dictionary<ID, ComponentSD> components = new Dictionary<ID, ComponentSD>(); //components.Add(missileLauncher.ID, missileLauncher); //StaticDataManager.ExportStaticData(components, "./Componentstest.json"); // test export of galaxy settings: GalaxyFactory gf = new GalaxyFactory(true, 1); StaticDataManager.ExportStaticData(gf.Settings, "SystemGenSettings.json"); }
public void ExportToFile() { StaticDataManager.ExportStaticData(_staticData.ComponentTemplates, "NewComponentData.json"); }