public bool Initalize(int screenWidth, int screenHeight, DirectoryInfo dataSet, bool showTutorial, Form parentForm, out string reason) { _parentForm = parentForm; Random = new Random(); MousePos = new Point(); ScreenWidth = screenWidth; ScreenHeight = screenHeight; GameDataSet = dataSet; Galaxy = new Galaxy(); EmpireManager = new EmpireManager(this); ShipShader = GorgonLibrary.Graphics.FXShader.FromFile("ColorShader.fx", GorgonLibrary.Graphics.ShaderCompileOptions.OptimizationLevel3); StarShader = GorgonLibrary.Graphics.FXShader.FromFile("StarShader.fx", GorgonLibrary.Graphics.ShaderCompileOptions.OptimizationLevel3); if (!SpriteManager.Initialize(GameDataSet, out reason)) { return false; } if (!FontManager.Initialize(GameDataSet, out reason)) { return false; } RaceManager = new RaceManager(); if (!RaceManager.Initialize(GameDataSet, Random, out reason)) { return false; } AIManager = new AIManager(); if (!AIManager.Initialize(GameDataSet, out reason)) { return false; } MasterTechnologyManager = new MasterTechnologyManager(); if (!MasterTechnologyManager.Initialize(this, out reason)) { return false; } _mainGameMenu = new MainGameMenu(); if (!_mainGameMenu.Initialize(this, out reason)) { return false; } _screenInterface = _mainGameMenu; _currentScreen = Screen.MainMenu; _situationReport = new SituationReport(this); Cursor = SpriteManager.GetSprite("Cursor", Random); if (Cursor == null) { reason = "Cursor is not defined in sprites.xml"; return false; } reason = string.Empty; return true; }
public void Load(XElement empire, MasterTechnologyManager MTM) { var technologies = empire.Element("Technologies"); var compTechs = technologies.Element("Computer"); var constTechs = technologies.Element("Construction"); var ffTechs = technologies.Element("ForceField"); var planetTechs = technologies.Element("Planetology"); var propTechs = technologies.Element("Propulsion"); var weaponTechs = technologies.Element("Weapon"); WhichComputerBeingResearched = MTM.GetTechnologyWithName(compTechs.Attribute("Researching").Value); WhichConstructionBeingResearched = MTM.GetTechnologyWithName(constTechs.Attribute("Researching").Value); WhichForceFieldBeingResearched = MTM.GetTechnologyWithName(ffTechs.Attribute("Researching").Value); WhichPlanetologyBeingResearched = MTM.GetTechnologyWithName(planetTechs.Attribute("Researching").Value); WhichPropulsionBeingResearched = MTM.GetTechnologyWithName(propTechs.Attribute("Researching").Value); WhichWeaponBeingResearched = MTM.GetTechnologyWithName(weaponTechs.Attribute("Researching").Value); ComputerPercentage = int.Parse(compTechs.Attribute("Percentage").Value); ConstructionPercentage = int.Parse(constTechs.Attribute("Percentage").Value); ForceFieldPercentage = int.Parse(ffTechs.Attribute("Percentage").Value); PlanetologyPercentage = int.Parse(planetTechs.Attribute("Percentage").Value); PropulsionPercentage = int.Parse(propTechs.Attribute("Percentage").Value); WeaponPercentage = int.Parse(weaponTechs.Attribute("Percentage").Value); ComputerLocked = bool.Parse(compTechs.Attribute("Locked").Value); ConstructionLocked = bool.Parse(constTechs.Attribute("Locked").Value); ForceFieldLocked = bool.Parse(ffTechs.Attribute("Locked").Value); PlanetologyLocked = bool.Parse(planetTechs.Attribute("Locked").Value); PropulsionLocked = bool.Parse(propTechs.Attribute("Locked").Value); WeaponLocked = bool.Parse(weaponTechs.Attribute("Locked").Value); ComputerResearchAmount = float.Parse(compTechs.Attribute("Invested").Value); ConstructionResearchAmount = float.Parse(constTechs.Attribute("Invested").Value); ForceFieldResearchAmount = float.Parse(ffTechs.Attribute("Invested").Value); PlanetologyResearchAmount = float.Parse(planetTechs.Attribute("Invested").Value); PropulsionResearchAmount = float.Parse(propTechs.Attribute("Invested").Value); WeaponResearchAmount = float.Parse(weaponTechs.Attribute("Invested").Value); foreach (var researched in compTechs.Element("Researched").Elements()) { ResearchedComputerTechs.Add(MTM.GetTechnologyWithName(researched.Value)); } foreach (var unresearched in compTechs.Element("Unresearched").Elements()) { UnresearchedComputerTechs.Add(MTM.GetTechnologyWithName(unresearched.Value)); } foreach (var researched in constTechs.Element("Researched").Elements()) { ResearchedConstructionTechs.Add(MTM.GetTechnologyWithName(researched.Value)); } foreach (var unresearched in constTechs.Element("Unresearched").Elements()) { UnresearchedConstructionTechs.Add(MTM.GetTechnologyWithName(unresearched.Value)); } foreach (var researched in ffTechs.Element("Researched").Elements()) { ResearchedForceFieldTechs.Add(MTM.GetTechnologyWithName(researched.Value)); } foreach (var unresearched in ffTechs.Element("Unresearched").Elements()) { UnresearchedForceFieldTechs.Add(MTM.GetTechnologyWithName(unresearched.Value)); } foreach (var researched in planetTechs.Element("Researched").Elements()) { ResearchedPlanetologyTechs.Add(MTM.GetTechnologyWithName(researched.Value)); } foreach (var unresearched in planetTechs.Element("Unresearched").Elements()) { UnresearchedPlanetologyTechs.Add(MTM.GetTechnologyWithName(unresearched.Value)); } foreach (var researched in propTechs.Element("Researched").Elements()) { ResearchedPropulsionTechs.Add(MTM.GetTechnologyWithName(researched.Value)); } foreach (var unresearched in propTechs.Element("Unresearched").Elements()) { UnresearchedPropulsionTechs.Add(MTM.GetTechnologyWithName(unresearched.Value)); } foreach (var researched in weaponTechs.Element("Researched").Elements()) { ResearchedWeaponTechs.Add(MTM.GetTechnologyWithName(researched.Value)); } foreach (var unresearched in weaponTechs.Element("Unresearched").Elements()) { UnresearchedWeaponTechs.Add(MTM.GetTechnologyWithName(unresearched.Value)); } UpdateValues(); }