public bool Initialize(int screenWidth, int screenHeight, Xasteroids parentForm, out string reason) { _parentForm = parentForm; Random = new Random(); MousePos = new Point(); ScreenSize = new Point(screenWidth, screenHeight); PlayerList = new PlayerList(); ShipShader = GorgonLibrary.Graphics.FXShader.FromFile("ColorShader.fx", GorgonLibrary.Graphics.ShaderCompileOptions.OptimizationLevel3); if (!SpriteManager.Initialize(out reason)) { return false; } if (!FontManager.Initialize(out reason)) { return false; } _backgroundStars = new BackgroundStars(); if (!_backgroundStars.Initialize(this, out reason)) { return false; } Cursor = SpriteManager.GetSprite("Cursor", Random); if (Cursor == null) { reason = "Cursor is not defined in sprites.xml"; return false; } PlayerManager = new PlayerManager(this); AsteroidManager = new AsteroidManager(this); ObjectManager = new ObjectManager(this); ShipSelectionWindow = new ShipSelectionWindow(); if (!ShipSelectionWindow.Initialize(this, out reason)) { return false; } ShipSelectionWindow.ShipSelected += OnShipSelected; _mainMenu = new MainMenu(); if (!_mainMenu.Initialize(this, out reason)) { return false; } _screenInterface = _mainMenu; _currentScreen = Screen.MainMenu; ChatText = new StringBuilder(); NewChatMessage = false; return true; }
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; }