Beyond_Beyaan.Screens.ColonizeScreen.Initialize C# (CSharp) Метод

Initialize() публичный Метод

public Initialize ( GameMain gameMain, string &reason ) : bool
gameMain GameMain
reason string
Результат bool
        public bool Initialize(GameMain gameMain, out string reason)
        {
            if (!this.Initialize(gameMain.ScreenWidth / 2 - 200, gameMain.ScreenHeight / 2 - 300, 400, 250, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return false;
            }

            _shipButtons = new BBStretchButton[4];
            for (int i = 0; i < _shipButtons.Length; i++)
            {
                _shipButtons[i] = new BBStretchButton();
                if (!_shipButtons[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 20, _yPos + 60, 200, 40, gameMain.Random, out reason))
                {
                    return false;
                }
            }
            _instructionLabel = new BBLabel();
            _systemNameLabel = new BBLabel();
            _cancelButton = new BBButton();
            _colonizeButton = new BBButton();
            _groundViewBackground = new BBStretchableImage();
            _nameBackground = new BBStretchableImage();
            _nameTextBox = new BBSingleLineTextBox();

            if (!_instructionLabel.Initialize(_xPos + 20, _yPos + 25, "Select a ship to colonize this planet", Color.White, out reason))
            {
                return false;
            }
            if (!_systemNameLabel.Initialize(_xPos + 300, _yPos + 130, string.Empty, Color.White, out reason))
            {
                return false;
            }
            if (!_cancelButton.Initialize("CancelColonizeBG", "CancelColonizeFG", string.Empty, ButtonTextAlignment.LEFT, _xPos + 230, _yPos + 195, 75, 35, gameMain.Random, out reason))
            {
                return false;
            }

            if (!_colonizeButton.Initialize("TransferToBG", "TransferToFG", string.Empty, ButtonTextAlignment.LEFT, _xPos + 310, _yPos + 195, 75, 35, gameMain.Random, out reason))
            {
                return false;
            }

            if (!_nameBackground.Initialize(gameMain.ScreenWidth / 2 - 100, gameMain.ScreenHeight / 2 - 40, 200, 80, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_nameTextBox.Initialize(string.Empty, gameMain.ScreenWidth / 2 - 80, gameMain.ScreenHeight / 2 - 20, 160, 40, false, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_groundViewBackground.Initialize(gameMain.ScreenWidth / 2 - 440, gameMain.ScreenHeight / 2 - 340, 880, 680, StretchableImageType.ThickBorder, gameMain.Random, out reason))
            {
                return false;
            }
            _colonizing = false;

            return true;
        }

Usage Example

        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);
        }
All Usage Examples Of Beyond_Beyaan.Screens.ColonizeScreen::Initialize