Inheritance: WindowInterface
        public bool Initialize(GameMain gameMain, out string reason)
        {
            _gameMain = gameMain;
            _pathSprite = SpriteManager.GetSprite("Path", _gameMain.Random);
            _fuelCircle = SpriteManager.GetSprite("FuelCircle", _gameMain.Random);
            _selectionSprites = new BBSprite[4];
            _selectionSprites[0] = SpriteManager.GetSprite("SelectionTL", _gameMain.Random);
            _selectionSprites[1] = SpriteManager.GetSprite("SelectionTR", _gameMain.Random);
            _selectionSprites[2] = SpriteManager.GetSprite("SelectionBL", _gameMain.Random);
            _selectionSprites[3] = SpriteManager.GetSprite("SelectionBR", _gameMain.Random);
            _showingFuelRange = false;
            _showingRadarRange = false;
            _showingOwners = false;

            _camera = new Camera(_gameMain.Galaxy.GalaxySize * 60, _gameMain.Galaxy.GalaxySize * 60, _gameMain.ScreenWidth, _gameMain.ScreenHeight);

            _starName = new RenderImage("starNameRendered", 1, 1, ImageBufferFormats.BufferRGB888A8);
            _starName.BlendingMode = BlendingModes.Modulated;

            _backBuffer = new RenderImage("galaxyBackBuffer", _gameMain.ScreenWidth, _gameMain.ScreenHeight, ImageBufferFormats.BufferRGB888A8);
            _backBuffer.BlendingMode = BlendingModes.Modulated;

            _systemView = new SystemView();
            if (!_systemView.Initialize(_gameMain, "GalaxyScreen", out reason))
            {
                return false;
            }
            _fleetView = new FleetView();
            if (!_fleetView.Initialize(_gameMain, out reason))
            {
                return false;
            }

            _taskBar = new TaskBar();
            if (!_taskBar.Initialize(_gameMain, out reason))
            {
                return false;
            }
            _inGameMenu = new InGameMenu();
            _researchScreen = new ResearchScreen();
            _shipDesignScreen = new ShipDesignScreen();
            _planetsView = new PlanetsView();
            _fleetListScreen = new FleetListScreen();
            if (!_inGameMenu.Initialize(_gameMain, out reason))
            {
                return false;
            }
            if (!_researchScreen.Initialize(_gameMain, out reason))
            {
                return false;
            }
            if (!_shipDesignScreen.Initialize(_gameMain, out reason))
            {
                return false;
            }
            if (!_planetsView.Initialize(_gameMain, out reason))
            {
                return false;
            }
            if (!_fleetListScreen.Initialize(_gameMain, out reason))
            {
                return false;
            }
            _inGameMenu.CloseWindow = CloseWindow;
            _researchScreen.CloseWindow = CloseWindow;
            _shipDesignScreen.CloseWindow = CloseWindow;
            _planetsView.CloseWindow = CloseWindow;
            _planetsView.CenterToSystem = CenterToSystem;
            _fleetListScreen.CloseWindow = CloseWindow;
            _fleetListScreen.SelectFleet = SelectFleet;

            _taskBar.ShowGameMenu = ShowInGameMenu;
            _taskBar.ShowResearchScreen = ShowResearchScreen;
            _taskBar.ShowShipDesignScreen = ShowShipDesignScreen;
            _taskBar.ShowPlanetsScreen = ShowPlanetsView;
            _taskBar.ShowFleetOverviewScreen = ShowFleetListScreen;
            _taskBar.EndTurn = CloseWindow;

            _travelETA = new BBLabel();
            _tentativeETA = new BBLabel();

            if (!_travelETA.Initialize(0, 0, "ETA", Color.White, out reason))
            {
                return false;
            }
            if (!_tentativeETA.Initialize(0, 0, "ETA", Color.White, out reason))
            {
                return false;
            }

            reason = null;
            return true;
        }
Beispiel #2
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            _gameMain            = gameMain;
            _pathSprite          = SpriteManager.GetSprite("Path", _gameMain.Random);
            _fuelCircle          = SpriteManager.GetSprite("FuelCircle", _gameMain.Random);
            _selectionSprites    = new BBSprite[4];
            _selectionSprites[0] = SpriteManager.GetSprite("SelectionTL", _gameMain.Random);
            _selectionSprites[1] = SpriteManager.GetSprite("SelectionTR", _gameMain.Random);
            _selectionSprites[2] = SpriteManager.GetSprite("SelectionBL", _gameMain.Random);
            _selectionSprites[3] = SpriteManager.GetSprite("SelectionBR", _gameMain.Random);
            _showingFuelRange    = false;
            _showingRadarRange   = false;
            _showingOwners       = false;

            _camera = new Camera(_gameMain.Galaxy.GalaxySize * 60, _gameMain.Galaxy.GalaxySize * 60, _gameMain.ScreenWidth, _gameMain.ScreenHeight);

            _starName = new RenderImage("starNameRendered", 1, 1, ImageBufferFormats.BufferRGB888A8);
            _starName.BlendingMode = BlendingModes.Modulated;

            _backBuffer = new RenderImage("galaxyBackBuffer", _gameMain.ScreenWidth, _gameMain.ScreenHeight, ImageBufferFormats.BufferRGB888A8);
            _backBuffer.BlendingMode = BlendingModes.Modulated;

            _systemView = new SystemView();
            if (!_systemView.Initialize(_gameMain, "GalaxyScreen", out reason))
            {
                return(false);
            }
            _fleetView = new FleetView();
            if (!_fleetView.Initialize(_gameMain, out reason))
            {
                return(false);
            }

            _taskBar = new TaskBar();
            if (!_taskBar.Initialize(_gameMain, out reason))
            {
                return(false);
            }
            _inGameMenu       = new InGameMenu();
            _researchScreen   = new ResearchScreen();
            _shipDesignScreen = new ShipDesignScreen();
            _planetsView      = new PlanetsView();
            _fleetListScreen  = new FleetListScreen();
            if (!_inGameMenu.Initialize(_gameMain, out reason))
            {
                return(false);
            }
            if (!_researchScreen.Initialize(_gameMain, out reason))
            {
                return(false);
            }
            if (!_shipDesignScreen.Initialize(_gameMain, out reason))
            {
                return(false);
            }
            if (!_planetsView.Initialize(_gameMain, out reason))
            {
                return(false);
            }
            if (!_fleetListScreen.Initialize(_gameMain, out reason))
            {
                return(false);
            }
            _inGameMenu.CloseWindow       = CloseWindow;
            _researchScreen.CloseWindow   = CloseWindow;
            _shipDesignScreen.CloseWindow = CloseWindow;
            _planetsView.CloseWindow      = CloseWindow;
            _planetsView.CenterToSystem   = CenterToSystem;
            _fleetListScreen.CloseWindow  = CloseWindow;
            _fleetListScreen.SelectFleet  = SelectFleet;

            _taskBar.ShowGameMenu            = ShowInGameMenu;
            _taskBar.ShowResearchScreen      = ShowResearchScreen;
            _taskBar.ShowShipDesignScreen    = ShowShipDesignScreen;
            _taskBar.ShowPlanetsScreen       = ShowPlanetsView;
            _taskBar.ShowFleetOverviewScreen = ShowFleetListScreen;
            _taskBar.EndTurn = CloseWindow;

            _travelETA    = new BBLabel();
            _tentativeETA = new BBLabel();

            if (!_travelETA.Initialize(0, 0, "ETA", Color.White, out reason))
            {
                return(false);
            }
            if (!_tentativeETA.Initialize(0, 0, "ETA", Color.White, out reason))
            {
                return(false);
            }

            reason = null;
            return(true);
        }