Initialize() public méthode

public Initialize ( GameMain gameMain, string identifier, string &reason ) : bool
gameMain GameMain
identifier string
reason string
Résultat bool
        public bool Initialize(GameMain gameMain, out string reason)
        {
            _gameMain = gameMain;
            _camera   = new Camera(gameMain.Galaxy.GalaxySize * 60, gameMain.Galaxy.GalaxySize * 60, gameMain.ScreenWidth, gameMain.ScreenHeight);
            _camera.CenterCamera(_camera.Width / 2, _camera.Height / 2, _camera.MaxZoom);

            _updateStep = 0;

            _exploredSystemsThisTurn   = new Dictionary <Empire, List <StarSystem> >();
            _colonizableFleetsThisTurn = new Dictionary <Empire, List <Fleet> >();
            _newResearchTopicsNeeded   = new Dictionary <Empire, List <TechField> >();

            _systemInfoWindow = new SystemInfoWindow();
            if (!_systemInfoWindow.Initialize(gameMain, out reason))
            {
                return(false);
            }

            _systemView = new SystemView();
            if (!_systemView.Initialize(gameMain, "ProcessingScreen", out reason))
            {
                return(false);
            }

            _colonizeScreen = new ColonizeScreen();
            if (!_colonizeScreen.Initialize(gameMain, out reason))
            {
                return(false);
            }

            _researchPrompt = new ResearchPrompt();
            if (!_researchPrompt.Initialize(gameMain, out reason))
            {
                return(false);
            }

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

            reason = null;
            return(true);
        }
        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;
        }
Exemple #3
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);
        }
        public bool Initialize(GameMain gameMain, out string reason)
        {
            _gameMain = gameMain;
            _camera = new Camera(gameMain.Galaxy.GalaxySize * 60, gameMain.Galaxy.GalaxySize * 60, gameMain.ScreenWidth, gameMain.ScreenHeight);
            _camera.CenterCamera(_camera.Width / 2, _camera.Height / 2, _camera.MaxZoom);

            _updateStep = 0;

            _exploredSystemsThisTurn = new Dictionary<Empire, List<StarSystem>>();
            _colonizableFleetsThisTurn = new Dictionary<Empire, List<Fleet>>();
            _newResearchTopicsNeeded = new Dictionary<Empire, List<TechField>>();

            _systemInfoWindow = new SystemInfoWindow();
            if (!_systemInfoWindow.Initialize(gameMain, out reason))
            {
                return false;
            }

            _systemView = new SystemView();
            if (!_systemView.Initialize(gameMain, "ProcessingScreen", out reason))
            {
                return false;
            }

            _colonizeScreen = new ColonizeScreen();
            if (!_colonizeScreen.Initialize(gameMain, out reason))
            {
                return false;
            }

            _researchPrompt = new ResearchPrompt();
            if (!_researchPrompt.Initialize(gameMain, out reason))
            {
                return false;
            }

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

            reason = null;
            return true;
        }