Exemple #1
0
        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);
        }
Exemple #2
0
        public bool Initialize(GameMain gameMain, string identifier, out string reason)
        {
            _isExplored = false;
            _isOwnedSystem = false;
            if (!base.Initialize(gameMain.ScreenWidth - 300, gameMain.ScreenHeight / 2 - 240, 300, 480, StretchableImageType.ThinBorderBG, gameMain, true, gameMain.Random, out reason))
            {
                return false;
            }
            _infrastructureIcon = SpriteManager.GetSprite("InfrastructureIcon", gameMain.Random);
            _defenseIcon = SpriteManager.GetSprite("MilitaryIcon", gameMain.Random);
            _researchIcon = SpriteManager.GetSprite("ResearchIcon", gameMain.Random);
            _environmentIcon = SpriteManager.GetSprite("EnvironmentIcon", gameMain.Random);
            _constructionIcon = SpriteManager.GetSprite("ConstructionIcon", gameMain.Random);

            if (_infrastructureIcon == null || _defenseIcon == null || _researchIcon == null || _environmentIcon == null || _constructionIcon == null)
            {
                reason = "One or more of the following sprites does not exist: InfrastructureIcon, MilitaryIcon, ResearchIcon, EnvironmentIcon, and/or ConstructionIcon";
                return false;
            }

            _name = new BBSingleLineTextBox();
            if (!_name.Initialize(string.Empty, _xPos + 10, _yPos + 15, 280, 35, false, gameMain.Random, out reason))
            {
                return false;
            }
            _generalPurposeBackground = new BBStretchableImage();
            _infrastructureBackground = new BBStretchableImage();
            _researchBackground = new BBStretchableImage();
            _environmentBackground = new BBStretchableImage();
            _defenseBackground = new BBStretchableImage();
            _constructionProjectButton = new BBStretchButton();
            _popLabel = new BBLabel();
            _terrainLabel = new BBLabel();
            _productionLabel = new BBLabel();

            _infrastructureLabel = new BBLabel();
            _researchLabel = new BBLabel();
            _environmentLabel = new BBLabel();
            _defenseLabel = new BBLabel();
            _constructionLabel = new BBLabel();

            _generalPurposeText = new BBTextBox();
            _transferLabel = new BBLabel();

            _infrastructureSlider = new BBScrollBar();
            _researchSlider = new BBScrollBar();
            _environmentSlider = new BBScrollBar();
            _defenseSlider = new BBScrollBar();
            _constructionSlider = new BBScrollBar();
            _popTransferSlider = new BBScrollBar();

            _infrastructureLockButton = new BBButton();
            _researchLockButton = new BBButton();
            _environmentLockButton = new BBButton();
            _defenseLockButton = new BBButton();
            _constructionLockButton = new BBButton();

            _relocateToButton = new BBButton();
            _transferToButton = new BBButton();

            if (!_generalPurposeBackground.Initialize(_xPos + 10, _yPos + 130, 280, 300, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_generalPurposeText.Initialize(_xPos + 20, _yPos + 140, 260, 260, true, false, "PlanetUIText" + identifier, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_infrastructureBackground.Initialize(_xPos + 10, _yPos + 130, 280, 60, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_researchBackground.Initialize(_xPos + 10, _yPos + 190, 280, 60, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_environmentBackground.Initialize(_xPos + 10, _yPos + 250, 280, 60, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_defenseBackground.Initialize(_xPos + 10, _yPos + 310, 280, 60, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_constructionProjectButton.Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 10, _yPos + 370, 280, 60, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_terrainLabel.Initialize(_xPos + 55, _yPos + 60, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_popLabel.Initialize(_xPos + 55, _yPos + 80, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_productionLabel.Initialize(_xPos + 55, _yPos + 100, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }

            if (!_infrastructureLabel.Initialize(_xPos + 65, _yPos + 140, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_infrastructureSlider.Initialize(_xPos + 65, _yPos + 160, 200, 0, 100, true, true, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_infrastructureLockButton.Initialize("LockBG", "LockFG", string.Empty, ButtonTextAlignment.CENTER, _xPos + 267, _yPos + 160, 16, 16, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_researchLabel.Initialize(_xPos + 65, _yPos + 200, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_researchSlider.Initialize(_xPos + 65, _yPos + 220, 200, 0, 100, true, true, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_researchLockButton.Initialize("LockBG", "LockFG", string.Empty, ButtonTextAlignment.CENTER, _xPos + 267, _yPos + 220, 16, 16, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_environmentLabel.Initialize(_xPos + 65, _yPos + 260, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_environmentSlider.Initialize(_xPos + 65, _yPos + 280, 200, 0, 100, true, true, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_environmentLockButton.Initialize("LockBG", "LockFG", string.Empty, ButtonTextAlignment.CENTER, _xPos + 267, _yPos + 280, 16, 16, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_defenseLabel.Initialize(_xPos + 65, _yPos + 320, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_defenseSlider.Initialize(_xPos + 65, _yPos + 340, 200, 0, 100, true, true, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_defenseLockButton.Initialize("LockBG", "LockFG", string.Empty, ButtonTextAlignment.CENTER, _xPos + 267, _yPos + 340, 16, 16, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_constructionLabel.Initialize(_xPos + 65, _yPos + 380, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_constructionSlider.Initialize(_xPos + 65, _yPos + 400, 200, 0, 100, true, true, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_constructionLockButton.Initialize("LockBG", "LockFG", string.Empty, ButtonTextAlignment.CENTER, _xPos + 267, _yPos + 400, 16, 16, gameMain.Random, out reason))
            {
                return false;
            }

            if (!_transferLabel.Initialize(_xPos + 20, _yPos + 370, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_popTransferSlider.Initialize(_xPos + 20, _yPos + 400, 260, 0, 1, true, true, gameMain.Random, out reason))
            {
                return false;
            }

            if (!_relocateToButton.Initialize("RelocateToBG", "RelocateToFG", string.Empty, ButtonTextAlignment.CENTER, _xPos + 130, _yPos + 435, 75, 35, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_relocateToButton.SetToolTip("RelocateToolTip" + identifier, "Set a friendly system as the destination of newly built ships", gameMain.ScreenWidth, gameMain.ScreenHeight, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_transferToButton.Initialize("TransferToBG", "TransferToFG", string.Empty, ButtonTextAlignment.CENTER, _xPos + 215, _yPos + 435, 75, 35, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_transferToButton.SetToolTip("TransferToToolTip" + identifier, "Send up to half of the population to another occupied system", gameMain.ScreenWidth, gameMain.ScreenHeight, gameMain.Random, out reason))
            {
                return false;
            }

            reason = null;
            return true;
        }
        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;
        }
Exemple #4
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            _gameMain = gameMain;
            _title = SpriteManager.GetSprite("Title", _gameMain.Random);
            if (_title == null)
            {
                reason = "Title Sprite not found";
                return false;
            }

            _singlePlayerButton = new BBButton();
            _multiPlayerButton = new BBButton();
            _exitButton = new BBButton();

            _hostOrConnectButton = new BBButton();
            _cancelButton = new BBButton();
            _ipAddressTextBox = new BBSingleLineTextBox();
            _playerNameTextBox = new BBSingleLineTextBox();
            _debugText = new BBLabel();

            _showingMultiplayerOptions = false;

            int x = _gameMain.ScreenSize.X / 2 - 130;
            int y = _gameMain.ScreenSize.Y / 2 + 50;

            if (!_singlePlayerButton.Initialize("MainButtonBG", "MainButtonFG", "Single Player", "LargeComputerFont", ButtonTextAlignment.CENTER, x, y + 50, 260, 40, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_multiPlayerButton.Initialize("MainButtonBG", "MainButtonFG", "MultiPlayer", "LargeComputerFont", ButtonTextAlignment.CENTER, x, y + 100, 260, 40, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_exitButton.Initialize("MainButtonBG", "MainButtonFG", "Exit", "LargeComputerFont", ButtonTextAlignment.CENTER, x, y + 200, 260, 40, _gameMain.Random, out reason))
            {
                return false;
            }

            if (!_playerNameTextBox.Initialize("Player Name", x, y, 260, 40, false, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_ipAddressTextBox.Initialize(string.Empty, x - 150, y + 50, 260, 40, false, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_hostOrConnectButton.Initialize("MainButtonBG", "MainButtonFG", "Host", "LargeComputerFont", ButtonTextAlignment.CENTER, x + 150, y + 50, 260, 40, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_cancelButton.Initialize("MainButtonBG", "MainButtonFG", "Back", "LargeComputerFont", ButtonTextAlignment.CENTER, x, y + 100, 260, 40, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_debugText.Initialize(10, _gameMain.ScreenSize.Y - 30, string.Empty, Color.White, out reason))
            {
                return false;
            }
            _singlePlayerButton.SetTextColor(Color.Gold, Color.Black);
            _multiPlayerButton.SetTextColor(Color.Gold, Color.Black);
            _exitButton.SetTextColor(Color.Gold, Color.Black);
            _hostOrConnectButton.SetTextColor(Color.Gold, Color.Black);
            _cancelButton.SetTextColor(Color.Gold, Color.Black);

            _gameMain.LevelNumber = 100;
            _gameMain.SetupLevel();
            _debugText.SetText("Num of Asteroids: " + _gameMain.AsteroidManager.Asteroids.Count);

            reason = null;
            return true;
        }
Exemple #5
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            if (!Initialize(gameMain.ScreenWidth - 300, 0, 300, 480, StretchableImageType.ThinBorderBG, gameMain, true, gameMain.Random, out reason))
            {
                return false;
            }

            _empireBackground = new BBStretchableImage();
            _empireNameLabel = new BBLabel();
            _nextFleet = new BBButton();
            _previousFleet = new BBButton();

            _shipBackground = new BBStretchableImage[6];
            _shipPreview = new BBStretchableImage();

            _shipSliders = new BBScrollBar[6];
            _shipLabels = new BBLabel[6];

            if (!_empireBackground.Initialize(_xPos + 10, _yPos + 10, 280, 40, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_empireNameLabel.Initialize(_xPos + 10, _yPos + 10, string.Empty, Color.White, out reason))
            {
                return false;
            }
            if (!_previousFleet.Initialize("ScrollLeftBGButton", "ScrollLeftFGButton", string.Empty, ButtonTextAlignment.LEFT, _xPos + 18, _yPos + 22, 16, 16, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_nextFleet.Initialize("ScrollRightBGButton", "ScrollRightFGButton", string.Empty, ButtonTextAlignment.LEFT, _xPos + 266, _yPos + 22, 16, 16, gameMain.Random, out reason))
            {
                return false;
            }

            if (!_shipPreview.Initialize(0, 0, 170, 170, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }

            for (int i = 0; i < _shipBackground.Length; i++)
            {
                _shipBackground[i] = new BBStretchableImage();
                _shipLabels[i] = new BBLabel();
                _shipSliders[i] = new BBScrollBar();

                if (!_shipBackground[i].Initialize(_xPos + 10, _yPos + 55 + (i * 55), 280, 55, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_shipLabels[i].Initialize(_xPos + 15, _yPos + 65 + (i * 55), "Test", Color.White, out reason))
                {
                    return false;
                }
                if (!_shipSliders[i].Initialize(_xPos + 15, _yPos + 85 + (i * 55), 270, 1, 1, true, true, gameMain.Random, out reason))
                {
                    return false;
                }
            }
            return true;
        }
        public bool Initialize(GameMain gameMain, out string reason)
        {
            int x = (gameMain.ScreenSize.X / 2) - 300;
            int y = (gameMain.ScreenSize.Y / 2) - 300;

            if (!base.Initialize(x, y, 600, 600, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return false;
            }

            x += 20;
            y += 20;

            _leftButton = new BBButton();
            _rightButton = new BBButton();
            _upButton = new BBButton();
            _downButton = new BBButton();
            _colorLabels = new BBLabel[3];
            _colorSliders = new BBScrollBar[3];
            _shipCostLabel = new BBLabel();
            _bankLabel = new BBLabel();
            _shipStatsBackground = new BBStretchableImage();
            _shipStatsTextBox = new BBTextBox();
            _selectShipButton = new BBButton();

            if (!_leftButton.Initialize("ScrollLeftBGButton", "ScrollLeftFGButton", string.Empty, ButtonTextAlignment.CENTER, x + 5, y + 141, 16, 16, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_rightButton.Initialize("ScrollRightBGButton", "ScrollRightFGButton", string.Empty, ButtonTextAlignment.CENTER, x + 277, y + 141, 16, 16, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_upButton.Initialize("ScrollUpBGButton", "ScrollUpFGButton", string.Empty, ButtonTextAlignment.CENTER, x + 141, y + 5, 16, 16, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_downButton.Initialize("ScrollDownBGButton", "ScrollDownFGButton", string.Empty, ButtonTextAlignment.CENTER, x + 141, y + 277, 16, 16, gameMain.Random, out reason))
            {
                return false;
            }

            if (!_shipCostLabel.Initialize(x + 133, y + 310, "Ship Cost:", Color.Green, out reason))
            {
                return false;
            }

            for (int i = 0; i < 3; i++)
            {
                _colorLabels[i] = new BBLabel();
                _colorSliders[i] = new BBScrollBar();
                if (!_colorLabels[i].Initialize(x + 5, y + 340 + (i * 50), string.Empty, Color.White, out reason))
                {
                    return false;
                }
                if (!_colorSliders[i].Initialize(x + 5, y + 365 + (i * 50), 288, 1, 256, true, true, gameMain.Random, out reason))
                {
                    return false;
                }
                _colorSliders[i].TopIndex = 255;
            }
            _colorLabels[0].SetColor(Color.Red, Color.Empty);
            _colorLabels[1].SetColor(Color.Green, Color.Empty);
            _colorLabels[2].SetColor(Color.Blue, Color.Empty);

            if (!_shipStatsBackground.Initialize(x + 300, y + 5, 250, 500, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_shipStatsTextBox.Initialize(x + 305, y + 10, 240, 490, false, false, "ShipStatsTextBox", gameMain.Random, out reason))
            {
                return false;
            }
            if (!_bankLabel.Initialize(x + 300, y + 510, "Bank:", Color.White, out reason))
            {
                return false;
            }
            if (!_selectShipButton.Initialize("ConfirmBG", "ConfirmFG", string.Empty, ButtonTextAlignment.CENTER, x + 485, y + 530, 75, 35, _gameMain.Random, out reason))
            {
                return false;
            }

            RefreshColorValues();
            _size = 1;
            _style = 1;
            _angle = 0;

            _shipSprite = SpriteManager.GetShipSprite(_size, _style, _gameMain.Random);

            return true;
        }
Exemple #7
0
        public bool Initialize(GameMain gameMain, string identifier, out string reason)
        {
            _isExplored    = false;
            _isOwnedSystem = false;
            if (!base.Initialize(gameMain.ScreenWidth - 300, gameMain.ScreenHeight / 2 - 240, 300, 480, StretchableImageType.ThinBorderBG, gameMain, true, gameMain.Random, out reason))
            {
                return(false);
            }
            _infrastructureIcon = SpriteManager.GetSprite("InfrastructureIcon", gameMain.Random);
            _defenseIcon        = SpriteManager.GetSprite("MilitaryIcon", gameMain.Random);
            _researchIcon       = SpriteManager.GetSprite("ResearchIcon", gameMain.Random);
            _environmentIcon    = SpriteManager.GetSprite("EnvironmentIcon", gameMain.Random);
            _constructionIcon   = SpriteManager.GetSprite("ConstructionIcon", gameMain.Random);

            if (_infrastructureIcon == null || _defenseIcon == null || _researchIcon == null || _environmentIcon == null || _constructionIcon == null)
            {
                reason = "One or more of the following sprites does not exist: InfrastructureIcon, MilitaryIcon, ResearchIcon, EnvironmentIcon, and/or ConstructionIcon";
                return(false);
            }

            _name = new BBSingleLineTextBox();
            if (!_name.Initialize(string.Empty, _xPos + 10, _yPos + 15, 280, 35, false, gameMain.Random, out reason))
            {
                return(false);
            }
            _generalPurposeBackground  = new BBStretchableImage();
            _infrastructureBackground  = new BBStretchableImage();
            _researchBackground        = new BBStretchableImage();
            _environmentBackground     = new BBStretchableImage();
            _defenseBackground         = new BBStretchableImage();
            _constructionProjectButton = new BBStretchButton();
            _popLabel        = new BBLabel();
            _terrainLabel    = new BBLabel();
            _productionLabel = new BBLabel();

            _infrastructureLabel = new BBLabel();
            _researchLabel       = new BBLabel();
            _environmentLabel    = new BBLabel();
            _defenseLabel        = new BBLabel();
            _constructionLabel   = new BBLabel();

            _generalPurposeText = new BBTextBox();
            _transferLabel      = new BBLabel();

            _infrastructureSlider = new BBScrollBar();
            _researchSlider       = new BBScrollBar();
            _environmentSlider    = new BBScrollBar();
            _defenseSlider        = new BBScrollBar();
            _constructionSlider   = new BBScrollBar();
            _popTransferSlider    = new BBScrollBar();

            _infrastructureLockButton = new BBButton();
            _researchLockButton       = new BBButton();
            _environmentLockButton    = new BBButton();
            _defenseLockButton        = new BBButton();
            _constructionLockButton   = new BBButton();

            _relocateToButton = new BBButton();
            _transferToButton = new BBButton();

            if (!_generalPurposeBackground.Initialize(_xPos + 10, _yPos + 130, 280, 300, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_generalPurposeText.Initialize(_xPos + 20, _yPos + 140, 260, 260, true, false, "PlanetUIText" + identifier, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_infrastructureBackground.Initialize(_xPos + 10, _yPos + 130, 280, 60, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_researchBackground.Initialize(_xPos + 10, _yPos + 190, 280, 60, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_environmentBackground.Initialize(_xPos + 10, _yPos + 250, 280, 60, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_defenseBackground.Initialize(_xPos + 10, _yPos + 310, 280, 60, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_constructionProjectButton.Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 10, _yPos + 370, 280, 60, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_terrainLabel.Initialize(_xPos + 55, _yPos + 60, string.Empty, System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_popLabel.Initialize(_xPos + 55, _yPos + 80, string.Empty, System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_productionLabel.Initialize(_xPos + 55, _yPos + 100, string.Empty, System.Drawing.Color.White, out reason))
            {
                return(false);
            }

            if (!_infrastructureLabel.Initialize(_xPos + 65, _yPos + 140, string.Empty, System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_infrastructureSlider.Initialize(_xPos + 65, _yPos + 160, 200, 0, 100, true, true, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_infrastructureLockButton.Initialize("LockBG", "LockFG", string.Empty, ButtonTextAlignment.CENTER, _xPos + 267, _yPos + 160, 16, 16, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_researchLabel.Initialize(_xPos + 65, _yPos + 200, string.Empty, System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_researchSlider.Initialize(_xPos + 65, _yPos + 220, 200, 0, 100, true, true, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_researchLockButton.Initialize("LockBG", "LockFG", string.Empty, ButtonTextAlignment.CENTER, _xPos + 267, _yPos + 220, 16, 16, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_environmentLabel.Initialize(_xPos + 65, _yPos + 260, string.Empty, System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_environmentSlider.Initialize(_xPos + 65, _yPos + 280, 200, 0, 100, true, true, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_environmentLockButton.Initialize("LockBG", "LockFG", string.Empty, ButtonTextAlignment.CENTER, _xPos + 267, _yPos + 280, 16, 16, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_defenseLabel.Initialize(_xPos + 65, _yPos + 320, string.Empty, System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_defenseSlider.Initialize(_xPos + 65, _yPos + 340, 200, 0, 100, true, true, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_defenseLockButton.Initialize("LockBG", "LockFG", string.Empty, ButtonTextAlignment.CENTER, _xPos + 267, _yPos + 340, 16, 16, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_constructionLabel.Initialize(_xPos + 65, _yPos + 380, string.Empty, System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_constructionSlider.Initialize(_xPos + 65, _yPos + 400, 200, 0, 100, true, true, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_constructionLockButton.Initialize("LockBG", "LockFG", string.Empty, ButtonTextAlignment.CENTER, _xPos + 267, _yPos + 400, 16, 16, gameMain.Random, out reason))
            {
                return(false);
            }

            if (!_transferLabel.Initialize(_xPos + 20, _yPos + 370, string.Empty, System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_popTransferSlider.Initialize(_xPos + 20, _yPos + 400, 260, 0, 1, true, true, gameMain.Random, out reason))
            {
                return(false);
            }

            if (!_relocateToButton.Initialize("RelocateToBG", "RelocateToFG", string.Empty, ButtonTextAlignment.CENTER, _xPos + 130, _yPos + 435, 75, 35, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_relocateToButton.SetToolTip("RelocateToolTip" + identifier, "Set a friendly system as the destination of newly built ships", gameMain.ScreenWidth, gameMain.ScreenHeight, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_transferToButton.Initialize("TransferToBG", "TransferToFG", string.Empty, ButtonTextAlignment.CENTER, _xPos + 215, _yPos + 435, 75, 35, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_transferToButton.SetToolTip("TransferToToolTip" + identifier, "Send up to half of the population to another occupied system", gameMain.ScreenWidth, gameMain.ScreenHeight, gameMain.Random, out reason))
            {
                return(false);
            }

            reason = null;
            return(true);
        }
        public bool Initialize(GameMain gameMain, out string reason)
        {
            int x = (gameMain.ScreenWidth / 2) - 400;
            int y = (gameMain.ScreenHeight / 2) - 300;

            if (!base.Initialize(x, y, 800, 600, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return false;
            }
            _shipStyleBackground = new BBStretchableImage();
            _shipSizeButtons = new BBStretchButton[4];
            _prevShipStyleButton = new BBButton();
            _nextShipStyleButton = new BBButton();

            if (!_shipStyleBackground.Initialize(x + 15, y + 385, 220, 200, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_prevShipStyleButton.Initialize("ScrollLeftBGButton", "ScrollLeftFGButton", string.Empty, ButtonTextAlignment.CENTER, x + 22, y + 477, 16, 16, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_nextShipStyleButton.Initialize("ScrollRightBGButton", "ScrollRightFGButton", string.Empty, ButtonTextAlignment.CENTER, x + 212, y + 477, 16, 16, gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < _shipSizeButtons.Length; i++)
            {
                _shipSizeButtons[i] = new BBStretchButton();
            }
            if (!_shipSizeButtons[0].Initialize("Small", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 235, y + 385, 80, 50, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_shipSizeButtons[1].Initialize("Medium", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 235, y + 435, 80, 50, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_shipSizeButtons[2].Initialize("Large", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 235, y + 485, 80, 50, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_shipSizeButtons[3].Initialize("Huge", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 235, y + 535, 80, 50, gameMain.Random, out reason))
            {
                return false;
            }

            _engineBackground = new BBStretchableImage();
            _engineButton = new BBStretchButton();
            _maneuverButton = new BBStretchButton();
            _engineSpeed = new BBLabel();
            _combatSpeed = new BBLabel();
            _costPerPowerLabel = new BBLabel();
            _spacePerPowerLabel = new BBLabel();
            _defenseRating = new BBLabel();

            if (!_engineBackground.Initialize(x + 15, y + 15, 300, 180, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_engineButton.Initialize(string.Empty, ButtonTextAlignment.CENTER, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 25, y + 25, 280, 35, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_maneuverButton.Initialize(string.Empty, ButtonTextAlignment.CENTER, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 25, y + 62, 280, 35, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_engineSpeed.Initialize(x + 25, y + 100, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_combatSpeed.Initialize(x + 165, y + 100, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_costPerPowerLabel.Initialize(x + 25, y + 120, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_spacePerPowerLabel.Initialize(x + 25, y + 140, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_defenseRating.Initialize(x + 25, y + 160, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }

            _defensiveEquipmentBackground = new BBStretchableImage();
            _armorButton = new BBStretchButton();
            _shieldButton = new BBStretchButton();
            _ECMButton = new BBStretchButton();
            _hitPointsLabel = new BBLabel();
            _absorbtionLabel = new BBLabel();
            _missileDefenseLabel = new BBLabel();
            if (!_defensiveEquipmentBackground.Initialize(x + 15, y + 195, 300, 190, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_armorButton.Initialize(string.Empty, ButtonTextAlignment.CENTER, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 25, y + 206, 280, 35, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_shieldButton.Initialize(string.Empty, ButtonTextAlignment.CENTER, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 25, y + 243, 280, 35, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_ECMButton.Initialize(string.Empty, ButtonTextAlignment.CENTER, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 25, y + 280, 280, 35, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_hitPointsLabel.Initialize(x + 25, y + 315, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_absorbtionLabel.Initialize(x + 25, y + 335, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_missileDefenseLabel.Initialize(x + 25, y + 355, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }

            _computerBackground = new BBStretchableImage();
            _computerButton = new BBStretchButton();
            _attackRating = new BBLabel();

            if (!_computerBackground.Initialize(x + 315, y + 15, 470, 55, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_computerButton.Initialize(string.Empty, ButtonTextAlignment.CENTER, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 325, y + 25, 280, 35, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_attackRating.Initialize(x + 610, y + 30, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }

            _weaponsBackground = new BBStretchableImage();
            _weaponButtons = new BBStretchButton[4];
            _weaponCountLabels = new BBLabel[4];
            _weaponDescriptions = new BBLabel[4];
            _weaponCounts = new BBNumericUpDown[4];

            if (!_weaponsBackground.Initialize(x + 315, y + 70, 470, 220, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }

            for (int i = 0; i < 4; i++)
            {
                _weaponButtons[i] = new BBStretchButton();
                _weaponCountLabels[i] = new BBLabel();
                _weaponDescriptions[i] = new BBLabel();
                _weaponCounts[i] = new BBNumericUpDown();

                if (!_weaponButtons[i].Initialize(string.Empty, ButtonTextAlignment.CENTER, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 325, y + 80 + (i * 50), 280, 30, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_weaponCountLabels[i].Initialize(x + 695, y + 85 + (i * 50), "Count:", System.Drawing.Color.White, out reason))
                {
                    return false;
                }
                _weaponCountLabels[i].SetAlignment(true);
                if (!_weaponCounts[i].Initialize(x + 700, y + 85 + (i * 50), 70, 1, 99, 1, 1, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_weaponDescriptions[i].Initialize(x + 325, y + 112 + (i * 50), string.Empty, System.Drawing.Color.White, out reason))
                {
                    return false;
                }
            }

            _specialsBackground = new BBStretchableImage();
            _specialButtons = new BBStretchButton[3];
            _specialDescriptions = new BBTextBox[3];

            if (!_specialsBackground.Initialize(x + 315, y + 290, 470, 230, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 3; i++)
            {
                _specialButtons[i] = new BBStretchButton();
                _specialDescriptions[i] = new BBTextBox();

                if (!_specialButtons[i].Initialize(string.Empty, ButtonTextAlignment.CENTER, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 325, y + 300 + (i * 70), 450, 30, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_specialDescriptions[i].Initialize(x + 325, y + 332 + (i * 70), 450, 38, true, true, "SpecialDesc" + i, gameMain.Random, out reason))
                {
                    return false;
                }
            }

            _statsBackground = new BBStretchableImage();
            _spaceLabel = new BBLabel();
            _costLabel = new BBLabel();
            _nameField = new BBSingleLineTextBox();

            if (!_statsBackground.Initialize(x + 315, y + 520, 470, 65, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_spaceLabel.Initialize(x + 450, y + 559, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_costLabel.Initialize(x + 325, y + 559, string.Empty, System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_nameField.Initialize(string.Empty, x + 325, y + 527, 150, 30, false, gameMain.Random, out reason))
            {
                return false;
            }

            _clearButton = new BBButton();
            _confirmButton = new BBButton();

            if (!_clearButton.Initialize("CancelBG", "CancelFG", string.Empty, ButtonTextAlignment.CENTER, x + 595, y + 535, 75, 35, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_confirmButton.Initialize("ConfirmBG", "ConfirmFG", string.Empty, ButtonTextAlignment.CENTER, x + 685, y + 535, 75, 35, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_clearButton.SetToolTip("ClearDesign", "Clear Ship Design", gameMain.ScreenWidth, gameMain.ScreenHeight, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_confirmButton.SetToolTip("ConfirmDesign", "Add Ship Design", gameMain.ScreenWidth, gameMain.ScreenHeight, gameMain.Random, out reason))
            {
                return false;
            }

            _equipmentSelection = new EquipmentSelection();
            if (!_equipmentSelection.Initialize(gameMain, out reason))
            {
                return false;
            }
            _equipmentSelection.OnSelectManeuver = OnSelectManeuver;
            _selectionShowing = false;

            _fleetSpecsWindow = new FleetSpecsWindow();
            if (!_fleetSpecsWindow.Initialize(gameMain, "ShipDesign", out reason))
            {
                return false;
            }
            _fleetSpecsWindow.ScrapAction = ScrapAction;
            _fleetSpecsShowing = false;

            return true;
        }
        public bool Initialize(GameMain gameMain, out string reason)
        {
            _gameMain = gameMain;

            int x = _gameMain.ScreenSize.X / 2 - 400;
            int y = _gameMain.ScreenSize.Y / 2 - 300;

            _background = new BBStretchableImage();

            _energyUpgradeBackground = new BBStretchableImage();
            _engineUpgradeBackground = new BBStretchableImage();
            _weaponUpgradeBackground = new BBStretchableImage();
            _shieldUpgradeBackground = new BBStretchableImage();

            _playerStatusBackground = new BBStretchableImage();
            _chatBackground = new BBStretchableImage();

            _playerStatusTextBox = new BBTextBox();
            _chatTextBox = new BBTextBox();
            _messageTextBox = new BBSingleLineTextBox();

            _readyButton = new BBButton();

            _energyButtons = new BBStretchButton[3];
            _energyLabels = new BBLabel[3];
            for (int i = 0; i < 3; i++)
            {
                _energyButtons[i] = new BBStretchButton();
                _energyLabels[i] = new BBLabel();
            }
            _engineButtons = new BBStretchButton[4];
            _engineLabels = new BBLabel[4];
            for (int i = 0; i < 4; i++)
            {
                _engineButtons[i] = new BBStretchButton();
                _engineLabels[i] = new BBLabel();
            }
            _weaponButtons = new BBStretchButton[8];
            _weaponLabels = new BBLabel[8];
            for (int i = 0; i < 8; i++)
            {
                _weaponButtons[i] = new BBStretchButton();
                _weaponLabels[i] = new BBLabel();
            }
            _shieldButtons = new BBStretchButton[4];
            _shieldLabels = new BBLabel[4];
            for (int i = 0; i < 4; i++)
            {
                _shieldButtons[i] = new BBStretchButton();
                _shieldLabels[i] = new BBLabel();
            }

            _upgradeLabels = new BBLabel[4];
            for (int i = 0; i < 4; i++)
            {
                _upgradeLabels[i] = new BBLabel();
            }

            if (!_background.Initialize(x - 30, y - 30, 860, 660, StretchableImageType.ThickBorder, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_energyUpgradeBackground.Initialize(x, y, 400, 150, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_engineUpgradeBackground.Initialize(x, y + 150, 400, 190, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_weaponUpgradeBackground.Initialize(x + 400, y, 400, 340, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_shieldUpgradeBackground.Initialize(x, y + 340, 800, 110, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_playerStatusBackground.Initialize(x, y + 450, 400, 150, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_chatBackground.Initialize(x + 400, y + 450, 400, 150, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }

            if (!_playerStatusTextBox.Initialize(x + 410, y + 460, 380, 95, false, true, "PlayerStatusTextBox", _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_chatTextBox.Initialize(x + 10, y + 460, 380, 100, true, true, "UpgradeChatTextBox", _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_messageTextBox.Initialize(string.Empty, x + 10, y + 560, 380, 30, false, _gameMain.Random, out reason))
            {
                return false;
            }

            if (!_energyButtons[0].Initialize("Upgrade Recharge Rate", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 32, 380, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_energyButtons[1].Initialize("Upgrade Capacity", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 69, 380, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_energyButtons[2].Initialize("Buy Emergency Battery", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 106, 380, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 3; i++)
            {
                if (!_energyLabels[i].Initialize(x + 375, y + 40 + (i * 37), string.Empty, Color.GreenYellow, out reason))
                {
                    return false;
                }
                _energyLabels[i].SetAlignment(true);
            }

            if (!_engineButtons[0].Initialize("Upgrade Acceleration", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 182, 380, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_engineButtons[1].Initialize("Upgrade Rotation Speed", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 219, 380, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_engineButtons[2].Initialize("Upgrade Reverse Thrusters", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 256, 380, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_engineButtons[3].Initialize("Upgrade Boosters", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 293, 380, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 4; i++)
            {
                if (!_engineLabels[i].Initialize(x + 375, y + 190 + (i * 37), string.Empty, Color.GreenYellow, out reason))
                {
                    return false;
                }
                _engineLabels[i].SetAlignment(true);
            }

            if (!_weaponButtons[0].Initialize("Reduce Cooldown", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 410, y + 32, 380, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_weaponButtons[1].Initialize("Reduce Energy Consumption", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 410, y + 69, 380, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_weaponButtons[2].Initialize("Upgrade Damage", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 410, y + 106, 380, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_weaponButtons[3].Initialize("Upgrade Velocity", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 410, y + 143, 380, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_weaponButtons[4].Initialize("Upgrade Penetration", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 410, y + 180, 380, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_weaponButtons[5].Initialize("Buy Additional Mount", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 410, y + 217, 380, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_weaponButtons[6].Initialize("Add Shrapnel", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 410, y + 252, 380, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_weaponButtons[7].Initialize("Buy Nuclear Missile", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 410, y + 287, 380, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 8; i++)
            {
                if (!_weaponLabels[i].Initialize(x + 775, y + 40 + (i * 37), string.Empty, Color.GreenYellow, out reason))
                {
                    return false;
                }
                _weaponLabels[i].SetAlignment(true);
            }

            if (!_shieldButtons[0].Initialize("Upgrade Shredding", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 372, 390, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_shieldButtons[1].Initialize("Upgrade Hardness", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 409, 390, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_shieldButtons[2].Initialize("Upgrade Inertial Stabilizer", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 400, y + 372, 390, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_shieldButtons[3].Initialize("Buy Phasing Cloak", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 400, y + 409, 390, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 4; i++)
            {
                if (!_shieldLabels[i].Initialize(x + 385 + ((i / 2) * 390), y + 380 + ((i % 2) * 37), string.Empty, Color.GreenYellow, out reason))
                {
                    return false;
                }
                _shieldLabels[i].SetAlignment(true);
            }

            if (!_readyButton.Initialize("ConfirmBG", "ConfirmFG", string.Empty, ButtonTextAlignment.CENTER, x + 715, y + 555, 75, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            _messageTextBox.Select();

            _showingShipSelection = false;

            return true;
        }
Exemple #10
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            if (!Initialize(gameMain.ScreenWidth - 300, 0, 300, 480, StretchableImageType.ThinBorderBG, gameMain, true, gameMain.Random, out reason))
            {
                return(false);
            }

            _empireBackground = new BBStretchableImage();
            _empireNameLabel  = new BBLabel();
            _nextFleet        = new BBButton();
            _previousFleet    = new BBButton();

            _shipBackground = new BBStretchableImage[6];
            _shipPreview    = new BBStretchableImage();

            _shipSliders = new BBScrollBar[6];
            _shipLabels  = new BBLabel[6];

            if (!_empireBackground.Initialize(_xPos + 10, _yPos + 10, 280, 40, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_empireNameLabel.Initialize(_xPos + 10, _yPos + 10, string.Empty, Color.White, out reason))
            {
                return(false);
            }
            if (!_previousFleet.Initialize("ScrollLeftBGButton", "ScrollLeftFGButton", string.Empty, ButtonTextAlignment.LEFT, _xPos + 18, _yPos + 22, 16, 16, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_nextFleet.Initialize("ScrollRightBGButton", "ScrollRightFGButton", string.Empty, ButtonTextAlignment.LEFT, _xPos + 266, _yPos + 22, 16, 16, gameMain.Random, out reason))
            {
                return(false);
            }

            if (!_shipPreview.Initialize(0, 0, 170, 170, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }

            for (int i = 0; i < _shipBackground.Length; i++)
            {
                _shipBackground[i] = new BBStretchableImage();
                _shipLabels[i]     = new BBLabel();
                _shipSliders[i]    = new BBScrollBar();

                if (!_shipBackground[i].Initialize(_xPos + 10, _yPos + 55 + (i * 55), 280, 55, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
                {
                    return(false);
                }
                if (!_shipLabels[i].Initialize(_xPos + 15, _yPos + 65 + (i * 55), "Test", Color.White, out reason))
                {
                    return(false);
                }
                if (!_shipSliders[i].Initialize(_xPos + 15, _yPos + 85 + (i * 55), 270, 1, 1, true, true, gameMain.Random, out reason))
                {
                    return(false);
                }
            }
            return(true);
        }