public bool Initialize(GameMain gameMain, out string reason)
        {
            if (!this.Initialize(gameMain.ScreenWidth / 2 - 230, gameMain.ScreenHeight / 2 - 180, 460, 360, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return false;
            }

            _discoveredTechs = new List<Technology>();
            _fieldsNeedingNewTopics = new List<TechField>();
            _availableTopics = new Dictionary<TechField, List<Technology>>();

            _techDescriptionBackground = new BBStretchableImage();
            _availableTechsToResearchBackground = new BBStretchableImage();
            _instructionLabel = new BBLabel();
            _techDescription = new BBTextBox();
            _scrollBar = new BBScrollBar();
            _availableTechsToResearchButtons = new BBInvisibleStretchButton[4];
            _researchCosts = new BBLabel[4];

            if (!_techDescriptionBackground.Initialize(_xPos + 20, _yPos + 20, 420, 170, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_availableTechsToResearchBackground.Initialize(_xPos + 20, _yPos + 220, 420, 120, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_instructionLabel.Initialize(_xPos + 20, _yPos + 195, "Please select an item to research", System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_techDescription.Initialize(_xPos + 165, _yPos + 33, 265, 150, true, true, "TechDescriptionTextBox", gameMain.Random, out reason))
            {
                return false;
            }
            if (!_scrollBar.Initialize(_xPos + 415, _yPos + 230, 100, 4, 4, false, false, gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < _availableTechsToResearchButtons.Length; i++)
            {
                _availableTechsToResearchButtons[i] = new BBInvisibleStretchButton();
                _researchCosts[i] = new BBLabel();
                if (!_availableTechsToResearchButtons[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, _xPos + 30, _yPos + 230 + (i * 25), 385, 25, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_availableTechsToResearchButtons[i].SetToolTip("ItemToResearch" + i + "ToolTip", string.Empty, gameMain.ScreenWidth, gameMain.ScreenHeight, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_researchCosts[i].Initialize(_xPos + 405, _yPos + 232 + (i * 25), string.Empty, System.Drawing.Color.White, out reason))
                {
                    return false;
                }
                _researchCosts[i].SetAlignment(true);
            }

            return true;
        }
Exemple #2
0
        public StarSystem(string name, int id, int x, int y, Color color, string description, Random r)
        {
            this.Sprite = SpriteManager.GetSprite("Star", r);
            this.name   = name;
            this.x      = x;
            this.y      = y;
            this.size   = 1;
            ID          = id;

            Color = color;

            exploredBy = new List <Empire>();
            planets    = new List <Planet>();

            //type = StarType.NORMAL;

            string reason;

            StarName = new BBLabel();
            StarName.Initialize(0, 0, name, Color.White, out reason);
            EmpiresWithFleetAdjacentLastTurn = new List <Empire>();
            EmpiresWithFleetAdjacentThisTurn = new List <Empire>();
            EmpiresWithPlanetsInThisSystem   = new List <Empire>();
            OwnerPercentage = new Dictionary <Empire, float>();
        }
        public bool Initialize(GameMain gameMain, out string reason)
        {
            if (!this.Initialize(gameMain.ScreenWidth / 2 - 230, gameMain.ScreenHeight / 2 - 180, 460, 360, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return(false);
            }

            _discoveredTechs        = new List <Technology>();
            _fieldsNeedingNewTopics = new List <TechField>();
            _availableTopics        = new Dictionary <TechField, List <Technology> >();

            _techDescriptionBackground          = new BBStretchableImage();
            _availableTechsToResearchBackground = new BBStretchableImage();
            _instructionLabel = new BBLabel();
            _techDescription  = new BBTextBox();
            _scrollBar        = new BBScrollBar();
            _availableTechsToResearchButtons = new BBInvisibleStretchButton[4];
            _researchCosts = new BBLabel[4];

            if (!_techDescriptionBackground.Initialize(_xPos + 20, _yPos + 20, 420, 170, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_availableTechsToResearchBackground.Initialize(_xPos + 20, _yPos + 220, 420, 120, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_instructionLabel.Initialize(_xPos + 20, _yPos + 195, "Please select an item to research", System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_techDescription.Initialize(_xPos + 165, _yPos + 33, 265, 150, true, true, "TechDescriptionTextBox", gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_scrollBar.Initialize(_xPos + 415, _yPos + 230, 100, 4, 4, false, false, gameMain.Random, out reason))
            {
                return(false);
            }
            for (int i = 0; i < _availableTechsToResearchButtons.Length; i++)
            {
                _availableTechsToResearchButtons[i] = new BBInvisibleStretchButton();
                _researchCosts[i] = new BBLabel();
                if (!_availableTechsToResearchButtons[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, _xPos + 30, _yPos + 230 + (i * 25), 385, 25, gameMain.Random, out reason))
                {
                    return(false);
                }
                if (!_availableTechsToResearchButtons[i].SetToolTip("ItemToResearch" + i + "ToolTip", string.Empty, gameMain.ScreenWidth, gameMain.ScreenHeight, gameMain.Random, out reason))
                {
                    return(false);
                }
                if (!_researchCosts[i].Initialize(_xPos + 405, _yPos + 232 + (i * 25), string.Empty, System.Drawing.Color.White, out reason))
                {
                    return(false);
                }
                _researchCosts[i].SetAlignment(true);
            }

            return(true);
        }
Exemple #4
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);
        }
        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 #6
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            _gameMain = gameMain;

            _energyX = (_gameMain.ScreenSize.X / 2) - 190;
            _shipStatsBackground = new BBStretchableImage();
            _miniMapBackground = new BBStretchableImage();
            if (!_shipStatsBackground.Initialize((_gameMain.ScreenSize.X / 2) - 200, -20, 400, 90, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_miniMapBackground.Initialize(_gameMain.ScreenSize.X - 250, _gameMain.ScreenSize.Y - 250, 300, 300, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }

            _bankAmount = new BBLabel();
            _energyAmount = new BBLabel();

            if (!_bankAmount.Initialize(_energyX, 40, string.Empty, Color.White, out reason))
            {
                return false;
            }
            if (!_energyAmount.Initialize(_energyX + 380, 40, string.Empty, Color.White, out reason))
            {
                return false;
            }
            _energyAmount.SetAlignment(true);

            _horizontalEnergyBar = SpriteManager.GetSprite("ScrollHorizontalBar", gameMain.Random);
            if (_horizontalEnergyBar == null)
            {
                reason = "ScrollHorizontalBar sprite not found";
                return false;
            }

            /*_debuggingText = new BBTextBox();
            if (!_debuggingText.Initialize(0, 0, 300, 300, true, false, "DebugText", gameMain.Random, out reason))
            {
                return false;
            }*/

            _miniMapTarget = new RenderImage("MiniMapRender", 230, 230, ImageBufferFormats.BufferRGB888A8);
            _miniMapTarget.BlendingMode = BlendingModes.Modulated;

            _dot = SpriteManager.GetSprite("BackgroundStar", _gameMain.Random);
            if (_dot == null)
            {
                reason = "Star sprite doesn't exist.";
                return false;
            }
            _delay = 0;
            return true;
        }
        public bool Initialize(GameMain gameMain, out string reason)
        {
            if (!this.Initialize((gameMain.ScreenWidth / 2) - 200, (gameMain.ScreenHeight / 2) - 200, 400, 100, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return false;
            }

            _informationText = new BBLabel();
            if (!_informationText.Initialize((gameMain.ScreenWidth / 2), (gameMain.ScreenHeight / 2) - 150, string.Empty, Color.White, out reason))
            {
                return false;
            }
            return true;
        }
        public bool Initialize(GameMain gameMain, out string reason)
        {
            if (!this.Initialize((gameMain.ScreenWidth / 2) - 200, (gameMain.ScreenHeight / 2) - 200, 400, 100, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return(false);
            }

            _informationText = new BBLabel();
            if (!_informationText.Initialize((gameMain.ScreenWidth / 2), (gameMain.ScreenHeight / 2) - 150, string.Empty, Color.White, out reason))
            {
                return(false);
            }
            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;
            }

            _fieldsBackground = new BBStretchableImage();
            _technologyListBackground = new BBStretchableImage();
            if (!_fieldsBackground.Initialize(x + 20, y + 20, 760, 230, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_technologyListBackground.Initialize(x + 20, y + 300, 760, 280, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }

            _techFieldLabels = new BBLabel[6];
            _techNamesBeingResearchedLabels = new BBLabel[6];
            _techProgressLabels = new BBLabel[6];
            _techSliders = new BBScrollBar[6];
            _techLockButtons = new BBButton[6];
            for (int i = 0; i < 6; i++)
            {
                _techFieldLabels[i] = new BBLabel();
                _techNamesBeingResearchedLabels[i] = new BBLabel();
                _techProgressLabels[i] = new BBLabel();
                _techSliders[i] = new BBScrollBar();
                _techLockButtons[i] = new BBButton();
            }
            _totalResearchPointsLabel = new BBLabel();

            if (!_techFieldLabels[0].Initialize(x + 135, y + 35, "Computers:", System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_techFieldLabels[1].Initialize(x + 135, y + 65, "Construction:", System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_techFieldLabels[2].Initialize(x + 135, y + 95, "Force Fields:", System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_techFieldLabels[3].Initialize(x + 135, y + 125, "Planetology:", System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_techFieldLabels[4].Initialize(x + 135, y + 155, "Propulsion:", System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_techFieldLabels[5].Initialize(x + 135, y + 185, "Weapons:", System.Drawing.Color.White, out reason))
            {
                return false;
            }

            for (int i = 0; i < 6; i++)
            {
                _techFieldLabels[i].SetAlignment(true);
                if (!_techNamesBeingResearchedLabels[i].Initialize(x + 140, y + 35 + (i * 30), "None", System.Drawing.Color.White, out reason))
                {
                    return false;
                }
                if (!_techProgressLabels[i].Initialize(x + 545, y + 35 + (i * 30), "N/A", System.Drawing.Color.White, out reason))
                {
                    return false;
                }
                _techProgressLabels[i].SetAlignment(true);
                if (!_techSliders[i].Initialize(x + 550, y + 35 + (i * 30), 200, 0, 100, true, true, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_techLockButtons[i].Initialize("LockBG", "LockFG", string.Empty, ButtonTextAlignment.LEFT, x + 755, y + 35 + (i * 30), 16, 16, gameMain.Random, out reason))
                {
                    return false;
                }
            }

            if (!_totalResearchPointsLabel.Initialize(x + 765, y + 215, "Total Research Points: 0", System.Drawing.Color.White, out reason))
            {
                return false;
            }
            _totalResearchPointsLabel.SetAlignment(true);

            _researchedTechnologyDescriptions = new BBTextBox();
            if (!_researchedTechnologyDescriptions.Initialize(x + 30, y + 310, 740, 260, true, true, "TechnologyListDescriptions", gameMain.Random, out reason))
            {
                return false;
            }

            _techFieldButtons = new BBStretchButton[6];
            for (int i = 0; i < 6; i++)
            {
                _techFieldButtons[i] = new BBStretchButton();
            }

            if (!_techFieldButtons[0].Initialize("Computers", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 20, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_techFieldButtons[1].Initialize("Construction", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 147, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_techFieldButtons[2].Initialize("Force Fields", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 274, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_techFieldButtons[3].Initialize("Planetology", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 401, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_techFieldButtons[4].Initialize("Propulsion", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 528, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_techFieldButtons[5].Initialize("Weapons", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 655, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return false;
            }

            reason = null;
            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;
        }
        public bool Initialize(GameMain gameMain, string name, out string reason)
        {
            _x = (gameMain.ScreenWidth / 2) - 430;
            _y = (gameMain.ScreenHeight / 2) - 300;
            if (!Initialize((gameMain.ScreenWidth / 2) - 450, (gameMain.ScreenHeight / 2) - 320, 900, 640, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return(false);
            }
            _shipBackground = new BBStretchableImage();             //Used for sprite preview
            if (!_shipBackground.Initialize(0, 0, 170, 170, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }
            _shipBackgrounds        = new BBStretchableImage[6];
            _beamBackgrounds        = new BBStretchableImage[6];
            _missileBackgrounds     = new BBStretchableImage[6];
            _attackBackgrounds      = new BBStretchableImage[6];
            _hitPointsBackgrounds   = new BBStretchableImage[6];
            _shieldBackgrounds      = new BBStretchableImage[6];
            _galaxySpeedBackgrounds = new BBStretchableImage[6];
            _combatSpeedBackgrounds = new BBStretchableImage[6];
            _weaponsBackgrounds     = new BBStretchableImage[6];
            _specialsBackgrounds    = new BBStretchableImage[6];
            _scrapButtons           = new BBButton[6];
            _shipNameLabels         = new BBLabel[6];
            _beamDefLabels          = new BBLabel[6];
            _beamDefValueLabels     = new BBLabel[6];
            _missileDefLabels       = new BBLabel[6];
            _missileDefValueLabels  = new BBLabel[6];
            _attackLevelLabels      = new BBLabel[6];
            _attackLevelValueLabels = new BBLabel[6];
            _hitPointsLabels        = new BBLabel[6];
            _hitPointsValueLabels   = new BBLabel[6];
            _shieldLabels           = new BBLabel[6];
            _shieldValueLabels      = new BBLabel[6];
            _galaxySpeedLabels      = new BBLabel[6];
            _galaxySpeedValueLabels = new BBLabel[6];
            _combatSpeedLabels      = new BBLabel[6];
            _combatSpeedValueLabels = new BBLabel[6];
            _costLabels             = new BBLabel[6];
            _costValueLabels        = new BBLabel[6];
            _amountLabels           = new BBLabel[6];
            _amountValueLabels      = new BBLabel[6];
            _weaponLabels           = new BBLabel[6][];
            _specialLabels          = new BBLabel[6][];
            for (int i = 0; i < 6; i++)
            {
                _shipBackgrounds[i]        = new BBStretchableImage();
                _scrapButtons[i]           = new BBButton();
                _shipNameLabels[i]         = new BBLabel();
                _beamBackgrounds[i]        = new BBStretchableImage();
                _missileBackgrounds[i]     = new BBStretchableImage();
                _attackBackgrounds[i]      = new BBStretchableImage();
                _hitPointsBackgrounds[i]   = new BBStretchableImage();
                _shieldBackgrounds[i]      = new BBStretchableImage();
                _galaxySpeedBackgrounds[i] = new BBStretchableImage();
                _combatSpeedBackgrounds[i] = new BBStretchableImage();
                _weaponsBackgrounds[i]     = new BBStretchableImage();
                _specialsBackgrounds[i]    = new BBStretchableImage();
                _beamDefLabels[i]          = new BBLabel();
                _beamDefValueLabels[i]     = new BBLabel();
                _missileDefLabels[i]       = new BBLabel();
                _missileDefValueLabels[i]  = new BBLabel();
                _attackLevelLabels[i]      = new BBLabel();
                _attackLevelValueLabels[i] = new BBLabel();
                _hitPointsLabels[i]        = new BBLabel();
                _hitPointsValueLabels[i]   = new BBLabel();
                _shieldLabels[i]           = new BBLabel();
                _shieldValueLabels[i]      = new BBLabel();
                _galaxySpeedLabels[i]      = new BBLabel();
                _galaxySpeedValueLabels[i] = new BBLabel();
                _combatSpeedLabels[i]      = new BBLabel();
                _combatSpeedValueLabels[i] = new BBLabel();
                _costLabels[i]             = new BBLabel();
                _costValueLabels[i]        = new BBLabel();
                _amountLabels[i]           = new BBLabel();
                _amountValueLabels[i]      = new BBLabel();
                if (!_shipBackgrounds[i].Initialize(_x, _y + (i * 100), 860, 100, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
                {
                    return(false);
                }
                if (!_shipNameLabels[i].Initialize(_x + 10, _y + 10 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return(false);
                }
                if (!_scrapButtons[i].Initialize("ScrapShipBG", "ScrapShipFG", string.Empty, ButtonTextAlignment.LEFT, _x + 250, _y + 5 + (i * 100), 75, 35, gameMain.Random, out reason))
                {
                    return(false);
                }
                if (!_scrapButtons[i].SetToolTip(name + "ScrapShipToolTip" + i, "Scrap Ship Design", gameMain.ScreenWidth, gameMain.ScreenHeight, gameMain.Random, out reason))
                {
                    return(false);
                }
                if (!_beamBackgrounds[i].Initialize(_x + 5, _y + 39 + (i * 100), 160, 28, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return(false);
                }
                if (!_beamDefLabels[i].Initialize(_x + 10, _y + 43 + (i * 100), "Beam Defense:", Color.Orange, out reason))
                {
                    return(false);
                }
                if (!_beamDefValueLabels[i].Initialize(_x + 155, _y + 43 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return(false);
                }
                if (!_missileBackgrounds[i].Initialize(_x + 5, _y + 66 + (i * 100), 160, 28, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return(false);
                }
                if (!_missileDefLabels[i].Initialize(_x + 10, _y + 72 + (i * 100), "Missile Defense:", Color.Orange, out reason))
                {
                    return(false);
                }
                if (!_missileDefValueLabels[i].Initialize(_x + 155, _y + 72 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return(false);
                }
                if (!_attackBackgrounds[i].Initialize(_x + 165, _y + 39 + (i * 100), 160, 28, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return(false);
                }
                if (!_attackLevelLabels[i].Initialize(_x + 170, _y + 43 + (i * 100), "Attack Level:", Color.Orange, out reason))
                {
                    return(false);
                }
                if (!_attackLevelValueLabels[i].Initialize(_x + 315, _y + 43 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return(false);
                }
                if (!_hitPointsBackgrounds[i].Initialize(_x + 165, _y + 66 + (i * 100), 160, 28, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return(false);
                }
                if (!_hitPointsLabels[i].Initialize(_x + 170, _y + 72 + (i * 100), "Hit Points:", Color.Orange, out reason))
                {
                    return(false);
                }
                if (!_hitPointsValueLabels[i].Initialize(_x + 315, _y + 72 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return(false);
                }
                if (!_shieldBackgrounds[i].Initialize(_x + 325, _y + 5 + (i * 100), 140, 35, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return(false);
                }
                if (!_shieldLabels[i].Initialize(_x + 330, _y + 12 + (i * 100), "Shield Level:", Color.Orange, out reason))
                {
                    return(false);
                }
                if (!_shieldValueLabels[i].Initialize(_x + 455, _y + 12 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return(false);
                }
                if (!_galaxySpeedBackgrounds[i].Initialize(_x + 325, _y + 39 + (i * 100), 140, 28, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return(false);
                }
                if (!_galaxySpeedLabels[i].Initialize(_x + 330, _y + 43 + (i * 100), "Galaxy Speed:", Color.Orange, out reason))
                {
                    return(false);
                }
                if (!_galaxySpeedValueLabels[i].Initialize(_x + 455, _y + 43 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return(false);
                }
                if (!_combatSpeedBackgrounds[i].Initialize(_x + 325, _y + 66 + (i * 100), 140, 28, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return(false);
                }
                if (!_combatSpeedLabels[i].Initialize(_x + 330, _y + 72 + (i * 100), "Combat Speed:", Color.Orange, out reason))
                {
                    return(false);
                }
                if (!_combatSpeedValueLabels[i].Initialize(_x + 455, _y + 72 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return(false);
                }
                if (!_weaponsBackgrounds[i].Initialize(_x + 470, _y + (i * 100), 200, 100, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
                {
                    return(false);
                }
                if (!_specialsBackgrounds[i].Initialize(_x + 670, _y + (i * 100), 190, 100, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
                {
                    return(false);
                }
                if (!_amountLabels[i].Initialize(_x + 675, _y + (i * 100) + 63, "Amt:", Color.Orange, out reason))
                {
                    return(false);
                }
                if (!_amountValueLabels[i].Initialize(_x + 755, _y + (i * 100) + 63, string.Empty, Color.White, out reason))
                {
                    return(false);
                }
                if (!_costLabels[i].Initialize(_x + 760, _y + (i * 100) + 63, "Cost: ", Color.Orange, out reason))
                {
                    return(false);
                }
                if (!_costValueLabels[i].Initialize(_x + 855, _y + (i * 100) + 63, string.Empty, Color.White, out reason))
                {
                    return(false);
                }
                _beamDefValueLabels[i].SetAlignment(true);
                _missileDefValueLabels[i].SetAlignment(true);
                _attackLevelValueLabels[i].SetAlignment(true);
                _hitPointsValueLabels[i].SetAlignment(true);
                _shieldValueLabels[i].SetAlignment(true);
                _galaxySpeedValueLabels[i].SetAlignment(true);
                _combatSpeedValueLabels[i].SetAlignment(true);
                _costValueLabels[i].SetAlignment(true);
                _amountValueLabels[i].SetAlignment(true);
                _weaponLabels[i] = new BBLabel[4];
                for (int j = 0; j < _weaponLabels[i].Length; j++)
                {
                    _weaponLabels[i][j] = new BBLabel();
                    if (!_weaponLabels[i][j].Initialize(_x + 475, _y + 7 + (i * 100 + j * 21), string.Empty, Color.White, out reason))
                    {
                        return(false);
                    }
                }
                _specialLabels[i] = new BBLabel[3];
                for (int j = 0; j < _specialLabels[i].Length; j++)
                {
                    _specialLabels[i][j] = new BBLabel();
                    if (!_specialLabels[i][j].Initialize(_x + 675, _y + 7 + (i * 100 + j * 21), string.Empty, Color.White, out reason))
                    {
                        return(false);
                    }
                }
            }

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

            _x = (gameMain.ScreenWidth / 2) - 500;
            _y = (gameMain.ScreenHeight / 2) - 305;
            if (!Initialize((gameMain.ScreenWidth / 2) - 520, (gameMain.ScreenHeight / 2) - 320, 1040, 640, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return false;
            }

            _shipNames = new BBStretchButton[6];
            for (int i = 0; i < _shipNames.Length; i++)
            {
                _shipNames[i] = new BBStretchButton();
                if (!_shipNames[i].Initialize(string.Empty, ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _x + 80 + (150 * i), _y, 150, 40, _gameMain.Random, out reason))
                {
                    return false;
                }
            }

            _planetBackgrounds = new BBStretchButton[10];
            _planetNames = new BBLabel[10];
            _statusLabels = new BBLabel[11];
            _scrollBar = new BBScrollBar();

            _statusLabels[0] = new BBLabel();
            if (!_statusLabels[0].Initialize(_x, _y + 10, "Status", Color.White, out reason))
            {
                return false;
            }

            for (int i = 0; i < 10; i++)
            {
                _planetBackgrounds[i] = new BBStretchButton();
                if (!_planetBackgrounds[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _x, _y + 40 + (50 * i), 980, 50, _gameMain.Random, out reason))
                {
                    return false;
                }
                _planetNames[i] = new BBLabel();
                if (!_planetNames[i].Initialize(_x + 5, _y + 65 + (50 * i), string.Empty, Color.GreenYellow, out reason))
                {
                    return false;
                }
                _statusLabels[i + 1] = new BBLabel();
                if (!_statusLabels[i + 1].Initialize(_x + 5, _y + 45 + (50 * i), string.Empty, Color.Orange, out reason))
                {
                    return false;
                }
            }

            _shipAmountLabels = new BBStretchButton[10][];
            for (int i = 0; i < _shipAmountLabels.Length; i++)
            {
                _shipAmountLabels[i] = new BBStretchButton[6];
                for (int j = 0; j < 6; j++)
                {
                    _shipAmountLabels[i][j] = new BBStretchButton();
                    if (!_shipAmountLabels[i][j].Initialize(string.Empty, ButtonTextAlignment.CENTER, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, _x + 80 + (150 * j), _y + 43 + (i * 50), 150, 25, _gameMain.Random, out reason))
                    {
                        return false;
                    }
                }
            }

            if (!_scrollBar.Initialize(_x + 980, _y + 40, 500, 10, 10, false, false, _gameMain.Random, out reason))
            {
                return false;
            }

            _maintenanceCostBackground = new BBStretchableImage();
            _maintenanceLabel = new BBLabel();
            _maintenanceAmountLabel = new BBLabel();
            _scrapButtons = new BBButton[6];
            for (int i = 0; i < _scrapButtons.Length; i++)
            {
                _scrapButtons[i] = new BBButton();
                if (!_scrapButtons[i].Initialize("ScrapShipBG", "ScrapShipFG", string.Empty, ButtonTextAlignment.LEFT, _x + 112 + (150 * i), _y + 540, 75, 35, gameMain.Random, out reason))
                {
                    return false;
                }
            }

            if (!_maintenanceCostBackground.Initialize(_x + 220, _y + 577, 280, 35, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_maintenanceLabel.Initialize(_x + 225, _y + 585, "Maintenance Cost:", Color.Orange, out reason))
            {
                return false;
            }
            if (!_maintenanceAmountLabel.Initialize(_x + 495, _y + 585, string.Empty, Color.White, out reason))
            {
                return false;
            }
            _maintenanceAmountLabel.SetAlignment(true);

            _viewSpecsButton = new BBStretchButton();
            if (!_viewSpecsButton.Initialize("View Ship Specifications", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _x + 500, _y + 577, 280, 35, gameMain.Random, out reason))
            {
                return false;
            }

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

            reason = null;
            return true;
        }
        public bool Initialize(GameMain gameMain, out string reason)
        {
            int x = (gameMain.ScreenWidth / 2) - 350;
            int y = (gameMain.ScreenHeight / 2) - 300;
            if (!Initialize((gameMain.ScreenWidth / 2) - 370, (gameMain.ScreenHeight / 2) - 320, 740, 640, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return false;
            }
            _shipBackgrounds = new BBStretchableImage[6];
            _beamBackgrounds = new BBStretchableImage[6];
            _missileBackgrounds = new BBStretchableImage[6];
            _attackBackgrounds = new BBStretchableImage[6];
            _hitPointsBackgrounds = new BBStretchableImage[6];
            _shieldBackgrounds = new BBStretchableImage[6];
            _galaxySpeedBackgrounds = new BBStretchableImage[6];
            _combatSpeedBackgrounds = new BBStretchableImage[6];
            _weaponsBackgrounds = new BBStretchableImage[6];
            _specialsBackgrounds = new BBStretchableImage[6];
            _scrapButtons = new BBButton[6];
            _shipNameLabels = new BBLabel[6];
            _beamDefLabels = new BBLabel[6];
            _beamDefValueLabels = new BBLabel[6];
            _missileDefLabels = new BBLabel[6];
            _missileDefValueLabels = new BBLabel[6];
            _attackLevelLabels = new BBLabel[6];
            _attackLevelValueLabels = new BBLabel[6];
            _hitPointsLabels = new BBLabel[6];
            _hitPointsValueLabels = new BBLabel[6];
            _shieldLabels = new BBLabel[6];
            _shieldValueLabels = new BBLabel[6];
            _galaxySpeedLabels = new BBLabel[6];
            _galaxySpeedValueLabels = new BBLabel[6];
            _combatSpeedLabels = new BBLabel[6];
            _combatSpeedValueLabels = new BBLabel[6];
            _costLabels = new BBLabel[6];
            _costValueLabels = new BBLabel[6];
            for (int i = 0; i < 6; i++)
            {
                _shipBackgrounds[i] = new BBStretchableImage();
                _scrapButtons[i] = new BBButton();
                _shipNameLabels[i] = new BBLabel();
                _beamBackgrounds[i] = new BBStretchableImage();
                _missileBackgrounds[i] = new BBStretchableImage();
                _attackBackgrounds[i] = new BBStretchableImage();
                _hitPointsBackgrounds[i] = new BBStretchableImage();
                _shieldBackgrounds[i] = new BBStretchableImage();
                _galaxySpeedBackgrounds[i] = new BBStretchableImage();
                _combatSpeedBackgrounds[i] = new BBStretchableImage();
                _weaponsBackgrounds[i] = new BBStretchableImage();
                _specialsBackgrounds[i] = new BBStretchableImage();
                _beamDefLabels[i] = new BBLabel();
                _beamDefValueLabels[i] = new BBLabel();
                _missileDefLabels[i] = new BBLabel();
                _missileDefValueLabels[i] = new BBLabel();
                _attackLevelLabels[i] = new BBLabel();
                _attackLevelValueLabels[i] = new BBLabel();
                _hitPointsLabels[i] = new BBLabel();
                _hitPointsValueLabels[i] = new BBLabel();
                _shieldLabels[i] = new BBLabel();
                _shieldValueLabels[i] = new BBLabel();
                _galaxySpeedLabels[i] = new BBLabel();
                _galaxySpeedValueLabels[i] = new BBLabel();
                _combatSpeedLabels[i] = new BBLabel();
                _combatSpeedValueLabels[i] = new BBLabel();
                _costLabels[i] = new BBLabel();
                _costValueLabels[i] = new BBLabel();
                if (!_shipBackgrounds[i].Initialize(x, y + (i * 100), 700, 100, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_shipNameLabels[i].Initialize(x + 10, y + 10 + (i * 100), string.Empty, System.Drawing.Color.White, out reason))
                {
                    return false;
                }
                if (!_scrapButtons[i].Initialize("ScrapShipBG", "ScrapShipFG", string.Empty, ButtonTextAlignment.LEFT, x + 250, y + 5 + (i * 100), 75, 35, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_scrapButtons[i].SetToolTip("ScrapShipToolTip" + i, "Scrap Ship Design", gameMain.ScreenWidth, gameMain.ScreenHeight, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_beamBackgrounds[i].Initialize(x + 5, y + 39 + (i * 100), 160, 28, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_beamDefLabels[i].Initialize(x + 10, y + 43 + (i * 100), "Beam Defense:", Color.Orange, out reason))
                {
                    return false;
                }
                if (!_beamDefValueLabels[i].Initialize(x + 155, y + 43 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return false;
                }
                if (!_missileBackgrounds[i].Initialize(x + 5, y + 66 + (i * 100), 160, 28, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_missileDefLabels[i].Initialize(x + 10, y + 72 + (i * 100), "Missile Defense:", Color.Orange, out reason))
                {
                    return false;
                }
                if (!_missileDefValueLabels[i].Initialize(x + 155, y + 72 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return false;
                }
                if (!_attackBackgrounds[i].Initialize(x + 165, y + 39 + (i * 100), 160, 28, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_attackLevelLabels[i].Initialize(x + 170, y + 43 + (i * 100), "Attack Level:", Color.Orange, out reason))
                {
                    return false;
                }
                if (!_attackLevelValueLabels[i].Initialize(x + 315, y + 43 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return false;
                }
                if (!_hitPointsBackgrounds[i].Initialize(x + 165, y + 66 + (i * 100), 160, 28, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_hitPointsLabels[i].Initialize(x + 170, y + 72 + (i * 100), "Hit Points:", Color.Orange, out reason))
                {
                    return false;
                }
                if (!_hitPointsValueLabels[i].Initialize(x + 315, y + 72 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return false;
                }
                _beamDefValueLabels[i].SetAlignment(true);
                _missileDefValueLabels[i].SetAlignment(true);
                _attackLevelValueLabels[i].SetAlignment(true);
                _hitPointsValueLabels[i].SetAlignment(true);
            }

            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;
        }
        private void SetControlsAndWindow()
        {
            _columnValues.Clear();
            int width = LABEL_WIDTH + _numOfColumnsVisible * COLUMN_WIDTH + (_scrollBarVisible ? 16 : 0);
            int height = 40 + _maxVisible * 40;
            int left = (_middleX - (width / 2));
            int top = (_middleY - (height / 2));
            string reason; //Unused, since at this point we've already initialized at least once, meaning everything is set up correctly
            _columnNames.Clear();
            _columnNames.Add(new BBLabel());
            _columnNames[0].Initialize(left + 5, top + 10, "Name", System.Drawing.Color.White, out reason);
            _columnValues.Add(new BBLabel[_maxVisible]);
            for (int i = 0; i < _maxVisible; i++)
            {
                _buttons[i].MoveTo(left, top + 40 + (i * 40));
                _buttons[i].ResizeButton(LABEL_WIDTH + _numOfColumnsVisible * COLUMN_WIDTH, 40);
                _columnValues[0][i] = new BBLabel();
                _columnValues[0][i].Initialize(left + 5, top + 50 + (i * 40), string.Empty, System.Drawing.Color.White, out reason);
            }
            left += LABEL_WIDTH;
            for (int i = 1; i <= _numOfColumnsVisible; i++)
            {
                _columnNames.Add(new BBLabel());
                _columnNames[i].Initialize(left + ((i - 1) * COLUMN_WIDTH) + 5, top + 10, string.Empty, System.Drawing.Color.White, out reason);
                _columnValues.Add(new BBLabel[_maxVisible]);
                for (int j = 0; j < _maxVisible; j++)
                {
                    _columnValues[i][j] = new BBLabel();
                    _columnValues[i][j].Initialize(left + ((i - 1) * COLUMN_WIDTH) + 5, top + 50 + (j * 40), string.Empty, System.Drawing.Color.White, out reason);
                }
            }
            //Move and resize the window to fit
            _xPos = (_gameMain.ScreenWidth / 2) - (width / 2) - 10;
            _yPos = (_gameMain.ScreenHeight / 2) - (height / 2) - 10;
            _backGroundImage.Resize(width + 20, height + 20);
            _backGroundImage.MoveTo(_xPos, _yPos);
            _scrollBar.MoveTo(left + _numOfColumnsVisible * COLUMN_WIDTH, top + 40);

            switch (_equipmentType)
            {
                case EquipmentType.ARMOR:
                    {
                        _columnNames[0].SetText("Armor Type");
                        _columnNames[1].SetText("Cost");
                        _columnNames[2].SetText("Space");
                    } break;
                case EquipmentType.COMPUTER:
                    {
                        _columnNames[0].SetText("Computer Type");
                        _columnNames[1].SetText("Cost");
                        _columnNames[2].SetText("Size");
                        _columnNames[3].SetText("Power");
                        _columnNames[4].SetText("Space");
                    } break;
                case EquipmentType.SHIELD:
                    {
                        _columnNames[0].SetText("Shield Type");
                        _columnNames[1].SetText("Cost");
                        _columnNames[2].SetText("Size");
                        _columnNames[3].SetText("Power");
                        _columnNames[4].SetText("Space");
                    } break;
                case EquipmentType.ECM:
                    {
                        _columnNames[0].SetText("ECM Type");
                        _columnNames[1].SetText("Cost");
                        _columnNames[2].SetText("Size");
                        _columnNames[3].SetText("Power");
                        _columnNames[4].SetText("Space");
                    } break;
                case EquipmentType.ENGINE:
                    {
                        _columnNames[0].SetText("Engine Type");
                        _columnNames[1].SetText("Cost");
                        _columnNames[2].SetText("Size");
                        _columnNames[3].SetText("# Required");
                        _columnNames[4].SetText("Space");
                    } break;
                case EquipmentType.MANEUVER:
                    {
                        _columnNames[0].SetText("Maneuver Level");
                        _columnNames[1].SetText("Speed");
                        _columnNames[2].SetText("Cost");
                        _columnNames[3].SetText("Power");
                        _columnNames[4].SetText("Space");
                    } break;
                case EquipmentType.WEAPON:
                    {
                        _columnNames[1].SetText("Damage");
                        _columnNames[2].SetText("Cost");
                        _columnNames[3].SetText("Size");
                        _columnNames[4].SetText("Power");
                        _columnNames[5].SetText("Space");
                        _columnNames[6].SetText("Max Mounts");
                    } break;
            }
        }
Exemple #16
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);
        }
Exemple #17
0
        private void SetControlsAndWindow()
        {
            _columnValues.Clear();
            int    width  = LABEL_WIDTH + _numOfColumnsVisible * COLUMN_WIDTH + (_scrollBarVisible ? 16 : 0);
            int    height = 40 + _maxVisible * 40;
            int    left   = (_middleX - (width / 2));
            int    top    = (_middleY - (height / 2));
            string reason;             //Unused, since at this point we've already initialized at least once, meaning everything is set up correctly

            _columnNames.Clear();
            _columnNames.Add(new BBLabel());
            _columnNames[0].Initialize(left + 5, top + 10, "Name", System.Drawing.Color.White, out reason);
            _columnValues.Add(new BBLabel[_maxVisible]);
            for (int i = 0; i < _maxVisible; i++)
            {
                _buttons[i].MoveTo(left, top + 40 + (i * 40));
                _buttons[i].ResizeButton(LABEL_WIDTH + _numOfColumnsVisible * COLUMN_WIDTH, 40);
                _columnValues[0][i] = new BBLabel();
                _columnValues[0][i].Initialize(left + 5, top + 50 + (i * 40), string.Empty, System.Drawing.Color.White, out reason);
            }
            left += LABEL_WIDTH;
            for (int i = 1; i <= _numOfColumnsVisible; i++)
            {
                _columnNames.Add(new BBLabel());
                _columnNames[i].Initialize(left + ((i - 1) * COLUMN_WIDTH) + 5, top + 10, string.Empty, System.Drawing.Color.White, out reason);
                _columnValues.Add(new BBLabel[_maxVisible]);
                for (int j = 0; j < _maxVisible; j++)
                {
                    _columnValues[i][j] = new BBLabel();
                    _columnValues[i][j].Initialize(left + ((i - 1) * COLUMN_WIDTH) + 5, top + 50 + (j * 40), string.Empty, System.Drawing.Color.White, out reason);
                }
            }
            //Move and resize the window to fit
            _xPos = (_gameMain.ScreenWidth / 2) - (width / 2) - 10;
            _yPos = (_gameMain.ScreenHeight / 2) - (height / 2) - 10;
            _backGroundImage.Resize(width + 20, height + 20);
            _backGroundImage.MoveTo(_xPos, _yPos);
            _scrollBar.MoveTo(left + _numOfColumnsVisible * COLUMN_WIDTH, top + 40);

            switch (_equipmentType)
            {
            case EquipmentType.ARMOR:
            {
                _columnNames[0].SetText("Armor Type");
                _columnNames[1].SetText("Cost");
                _columnNames[2].SetText("Space");
            } break;

            case EquipmentType.COMPUTER:
            {
                _columnNames[0].SetText("Computer Type");
                _columnNames[1].SetText("Cost");
                _columnNames[2].SetText("Size");
                _columnNames[3].SetText("Power");
                _columnNames[4].SetText("Space");
            } break;

            case EquipmentType.SHIELD:
            {
                _columnNames[0].SetText("Shield Type");
                _columnNames[1].SetText("Cost");
                _columnNames[2].SetText("Size");
                _columnNames[3].SetText("Power");
                _columnNames[4].SetText("Space");
            } break;

            case EquipmentType.ECM:
            {
                _columnNames[0].SetText("ECM Type");
                _columnNames[1].SetText("Cost");
                _columnNames[2].SetText("Size");
                _columnNames[3].SetText("Power");
                _columnNames[4].SetText("Space");
            } break;

            case EquipmentType.ENGINE:
            {
                _columnNames[0].SetText("Engine Type");
                _columnNames[1].SetText("Cost");
                _columnNames[2].SetText("Size");
                _columnNames[3].SetText("# Required");
                _columnNames[4].SetText("Space");
            } break;

            case EquipmentType.MANEUVER:
            {
                _columnNames[0].SetText("Maneuver Level");
                _columnNames[1].SetText("Speed");
                _columnNames[2].SetText("Cost");
                _columnNames[3].SetText("Power");
                _columnNames[4].SetText("Space");
            } break;

            case EquipmentType.WEAPON:
            {
                _columnNames[1].SetText("Damage");
                _columnNames[2].SetText("Cost");
                _columnNames[3].SetText("Size");
                _columnNames[4].SetText("Power");
                _columnNames[5].SetText("Space");
                _columnNames[6].SetText("Max Mounts");
            } break;
            }
        }
Exemple #18
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)
        {
            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);
            }

            _fieldsBackground         = new BBStretchableImage();
            _technologyListBackground = new BBStretchableImage();
            if (!_fieldsBackground.Initialize(x + 20, y + 20, 760, 230, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_technologyListBackground.Initialize(x + 20, y + 300, 760, 280, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }

            _techFieldLabels = new BBLabel[6];
            _techNamesBeingResearchedLabels = new BBLabel[6];
            _techProgressLabels             = new BBLabel[6];
            _techSliders     = new BBScrollBar[6];
            _techLockButtons = new BBButton[6];
            for (int i = 0; i < 6; i++)
            {
                _techFieldLabels[i] = new BBLabel();
                _techNamesBeingResearchedLabels[i] = new BBLabel();
                _techProgressLabels[i]             = new BBLabel();
                _techSliders[i]     = new BBScrollBar();
                _techLockButtons[i] = new BBButton();
            }
            _totalResearchPointsLabel = new BBLabel();

            if (!_techFieldLabels[0].Initialize(x + 135, y + 35, "Computers:", System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_techFieldLabels[1].Initialize(x + 135, y + 65, "Construction:", System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_techFieldLabels[2].Initialize(x + 135, y + 95, "Force Fields:", System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_techFieldLabels[3].Initialize(x + 135, y + 125, "Planetology:", System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_techFieldLabels[4].Initialize(x + 135, y + 155, "Propulsion:", System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_techFieldLabels[5].Initialize(x + 135, y + 185, "Weapons:", System.Drawing.Color.White, out reason))
            {
                return(false);
            }

            for (int i = 0; i < 6; i++)
            {
                _techFieldLabels[i].SetAlignment(true);
                if (!_techNamesBeingResearchedLabels[i].Initialize(x + 140, y + 35 + (i * 30), "None", System.Drawing.Color.White, out reason))
                {
                    return(false);
                }
                if (!_techProgressLabels[i].Initialize(x + 545, y + 35 + (i * 30), "N/A", System.Drawing.Color.White, out reason))
                {
                    return(false);
                }
                _techProgressLabels[i].SetAlignment(true);
                if (!_techSliders[i].Initialize(x + 550, y + 35 + (i * 30), 200, 0, 100, true, true, gameMain.Random, out reason))
                {
                    return(false);
                }
                if (!_techLockButtons[i].Initialize("LockBG", "LockFG", string.Empty, ButtonTextAlignment.LEFT, x + 755, y + 35 + (i * 30), 16, 16, gameMain.Random, out reason))
                {
                    return(false);
                }
            }

            if (!_totalResearchPointsLabel.Initialize(x + 765, y + 215, "Total Research Points: 0", System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            _totalResearchPointsLabel.SetAlignment(true);

            _researchedTechnologyDescriptions = new BBTextBox();
            if (!_researchedTechnologyDescriptions.Initialize(x + 30, y + 310, 740, 260, true, true, "TechnologyListDescriptions", gameMain.Random, out reason))
            {
                return(false);
            }

            _techFieldButtons = new BBStretchButton[6];
            for (int i = 0; i < 6; i++)
            {
                _techFieldButtons[i] = new BBStretchButton();
            }

            if (!_techFieldButtons[0].Initialize("Computers", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 20, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_techFieldButtons[1].Initialize("Construction", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 147, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_techFieldButtons[2].Initialize("Force Fields", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 274, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_techFieldButtons[3].Initialize("Planetology", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 401, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_techFieldButtons[4].Initialize("Propulsion", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 528, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_techFieldButtons[5].Initialize("Weapons", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 655, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return(false);
            }

            reason = null;
            return(true);
        }
Exemple #20
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;
        }
        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;
        }
        public bool Initialize(GameMain gameMain, out string reason)
        {
            int x = (gameMain.ScreenWidth / 2) - 533;
            int y = (gameMain.ScreenHeight / 2) - 300;

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

            x += 20;
            y += 20;

            _columnHeaders = new BBStretchButton[8];
            for (int i = 0; i < _columnHeaders.Length; i++)
            {
                _columnHeaders[i] = new BBStretchButton();
            }
            _columnCells = new BBStretchButton[8][];
            for (int i = 0; i < _columnCells.Length; i++)
            {
                _columnCells[i] = new BBStretchButton[13];
                for (int j = 0; j < _columnCells[i].Length; j++)
                {
                    _columnCells[i][j] = new BBStretchButton();
                }
            }

            if (!_columnHeaders[0].Initialize("Planet", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 280, 30, _gameMain.Random, out reason))
            {
                return(false);
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[0][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 280, 30, _gameMain.Random, out reason))
                {
                    return(false);
                }
            }

            x += 280;
            if (!_columnHeaders[1].Initialize("Population", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 90, 30, _gameMain.Random, out reason))
            {
                return(false);
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[1][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 90, 30, _gameMain.Random, out reason))
                {
                    return(false);
                }
            }

            x += 90;
            if (!_columnHeaders[2].Initialize("Buildings", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 90, 30, _gameMain.Random, out reason))
            {
                return(false);
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[2][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 90, 30, _gameMain.Random, out reason))
                {
                    return(false);
                }
            }

            x += 90;
            if (!_columnHeaders[3].Initialize("Bases", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 80, 30, _gameMain.Random, out reason))
            {
                return(false);
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[3][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 80, 30, _gameMain.Random, out reason))
                {
                    return(false);
                }
            }

            x += 80;
            if (!_columnHeaders[4].Initialize("Waste", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 80, 30, _gameMain.Random, out reason))
            {
                return(false);
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[4][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 80, 30, _gameMain.Random, out reason))
                {
                    return(false);
                }
            }

            x += 80;
            if (!_columnHeaders[5].Initialize("Industry", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 80, 30, _gameMain.Random, out reason))
            {
                return(false);
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[5][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 80, 30, _gameMain.Random, out reason))
                {
                    return(false);
                }
            }

            x += 80;
            if (!_columnHeaders[6].Initialize("Constructing", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 250, 30, _gameMain.Random, out reason))
            {
                return(false);
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[6][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 250, 30, _gameMain.Random, out reason))
                {
                    return(false);
                }
            }

            x += 250;
            if (!_columnHeaders[7].Initialize("Notes", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 60, 30, _gameMain.Random, out reason))
            {
                return(false);
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[7][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 60, 30, _gameMain.Random, out reason))
                {
                    return(false);
                }
            }
            x         += 60;
            _scrollBar = new BBScrollBar();
            if (!_scrollBar.Initialize(x, y + 30, 390, 13, 13, false, false, _gameMain.Random, out reason))
            {
                return(false);
            }

            _expensesBackground = new BBStretchableImage();
            _incomeBackground   = new BBStretchableImage();
            _reserves           = new BBStretchableImage();

            _expenseTitle = new BBLabel();
            _incomeTitle  = new BBLabel();

            _expenses      = new BBStretchButton[4];
            _expenseLabels = new BBLabel[4];
            _incomes       = new BBStretchButton[2];
            _incomeLabels  = new BBLabel[2];
            for (int i = 0; i < 4; i++)
            {
                _expenses[i]      = new BBStretchButton();
                _expenseLabels[i] = new BBLabel();
            }
            for (int i = 0; i < 2; i++)
            {
                _incomes[i]      = new BBStretchButton();
                _incomeLabels[i] = new BBLabel();
            }

            x = (gameMain.ScreenWidth / 2) - 513;
            y = (gameMain.ScreenHeight / 2) + 143;

            if (!_expensesBackground.Initialize(x, y, 476, 140, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_expenseTitle.Initialize(0, 0, "Expenses", Color.Gold, "LargeComputerFont", out reason))
            {
                return(false);
            }
            _expenseTitle.MoveTo((int)(x + 238 - _expenseTitle.GetWidth() / 2), y + 5);
            if (!_expenses[0].Initialize("Ships", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 50, 228, 40, _gameMain.Random, out reason))
            {
                return(false);
            }
            _expenses[0].SetTextColor(Color.Orange, Color.Empty);
            if (!_expenseLabels[0].Initialize(x + 228, y + 65, string.Empty, Color.White, out reason))
            {
                return(false);
            }
            _expenseLabels[0].SetAlignment(true);
            if (!_expenses[1].Initialize("Bases", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 90, 228, 40, _gameMain.Random, out reason))
            {
                return(false);
            }
            _expenses[1].SetTextColor(Color.Orange, Color.Empty);
            if (!_expenseLabels[1].Initialize(x + 228, y + 105, string.Empty, Color.White, out reason))
            {
                return(false);
            }
            _expenseLabels[1].SetAlignment(true);
            if (!_expenses[2].Initialize("Spying", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 238, y + 50, 228, 40, _gameMain.Random, out reason))
            {
                return(false);
            }
            _expenses[2].SetTextColor(Color.Orange, Color.Empty);
            if (!_expenseLabels[2].Initialize(x + 456, y + 65, string.Empty, Color.White, out reason))
            {
                return(false);
            }
            _expenseLabels[2].SetAlignment(true);
            if (!_expenses[3].Initialize("Security", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 238, y + 90, 228, 40, _gameMain.Random, out reason))
            {
                return(false);
            }
            _expenses[3].SetTextColor(Color.Orange, Color.Empty);
            if (!_expenseLabels[3].Initialize(x + 456, y + 105, string.Empty, Color.White, out reason))
            {
                return(false);
            }
            _expenseLabels[3].SetAlignment(true);
            x += 476;

            if (!_incomeBackground.Initialize(x, y, 250, 140, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_incomeTitle.Initialize(0, 0, "Incomes", Color.Gold, "LargeComputerFont", out reason))
            {
                return(false);
            }
            if (!_incomes[0].Initialize("Planets", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 50, 230, 40, _gameMain.Random, out reason))
            {
                return(false);
            }
            _incomes[0].SetTextColor(Color.Orange, Color.Empty);
            if (!_incomeLabels[0].Initialize(x + 230, y + 65, string.Empty, Color.White, out reason))
            {
                return(false);
            }
            _incomeLabels[0].SetAlignment(true);
            if (!_incomes[1].Initialize("Trade", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 90, 230, 40, _gameMain.Random, out reason))
            {
                return(false);
            }
            _incomes[1].SetTextColor(Color.Orange, Color.Empty);
            if (!_incomeLabels[1].Initialize(x + 230, y + 105, string.Empty, Color.White, out reason))
            {
                return(false);
            }
            _incomeLabels[1].SetAlignment(true);
            _incomeTitle.MoveTo((int)(x + 125 - _incomeTitle.GetWidth() / 2), y + 5);
            x += 250;

            if (!_reserves.Initialize(x, y, 300, 140, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return(false);
            }
            _reserveSlider  = new BBScrollBar();
            _reservesLabel  = new BBLabel();
            _reservesAmount = new BBLabel();

            _transferSlider   = new BBScrollBar();
            _transferLabel    = new BBLabel();
            _transferAmount   = new BBLabel();
            _transferReserves = new BBStretchButton();

            if (!_reservesLabel.Initialize(x + 10, y + 10, "Reserve:", Color.Orange, out reason))
            {
                return(false);
            }
            if (!_reservesAmount.Initialize(x + 280, y + 10, string.Empty, Color.White, out reason))
            {
                return(false);
            }
            if (!_reserveSlider.Initialize(x + 10, y + 33, 280, 0, 20, true, true, _gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_transferLabel.Initialize(x + 10, y + 51, "Amount to transfer:", Color.Orange, out reason))
            {
                return(false);
            }
            if (!_transferAmount.Initialize(x + 280, y + 51, string.Empty, Color.White, out reason))
            {
                return(false);
            }
            if (!_transferSlider.Initialize(x + 10, y + 72, 280, 0, 200, true, true, _gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_transferReserves.Initialize("Transfer reserves to selected planet", ButtonTextAlignment.CENTER, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 95, 280, 35, _gameMain.Random, out reason))
            {
                return(false);
            }
            _reservesAmount.SetAlignment(true);
            _transferAmount.SetAlignment(true);

            return(true);
        }
Exemple #23
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            int x = (gameMain.ScreenWidth / 2) - 533;
            int y = (gameMain.ScreenHeight / 2) - 300;

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

            x += 20;
            y += 20;

            _columnHeaders = new BBStretchButton[8];
            for (int i = 0; i < _columnHeaders.Length; i++)
            {
                _columnHeaders[i] = new BBStretchButton();
            }
            _columnCells = new BBStretchButton[8][];
            for (int i = 0; i < _columnCells.Length; i++)
            {
                _columnCells[i] = new BBStretchButton[13];
                for (int j = 0; j < _columnCells[i].Length; j++)
                {
                    _columnCells[i][j] = new BBStretchButton();
                }
            }

            if (!_columnHeaders[0].Initialize("Planet", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 280, 30, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[0][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 280, 30, _gameMain.Random, out reason))
                {
                    return false;
                }
            }

            x += 280;
            if (!_columnHeaders[1].Initialize("Population", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 90, 30, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[1][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 90, 30, _gameMain.Random, out reason))
                {
                    return false;
                }
            }

            x += 90;
            if (!_columnHeaders[2].Initialize("Buildings", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 90, 30, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[2][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 90, 30, _gameMain.Random, out reason))
                {
                    return false;
                }
            }

            x += 90;
            if (!_columnHeaders[3].Initialize("Bases", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 80, 30, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[3][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 80, 30, _gameMain.Random, out reason))
                {
                    return false;
                }
            }

            x += 80;
            if (!_columnHeaders[4].Initialize("Waste", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 80, 30, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[4][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 80, 30, _gameMain.Random, out reason))
                {
                    return false;
                }
            }

            x += 80;
            if (!_columnHeaders[5].Initialize("Industry", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 80, 30, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[5][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 80, 30, _gameMain.Random, out reason))
                {
                    return false;
                }
            }

            x += 80;
            if (!_columnHeaders[6].Initialize("Constructing", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 250, 30, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[6][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 250, 30, _gameMain.Random, out reason))
                {
                    return false;
                }
            }

            x += 250;
            if (!_columnHeaders[7].Initialize("Notes", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 60, 30, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[7][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 60, 30, _gameMain.Random, out reason))
                {
                    return false;
                }
            }
            x += 60;
            _scrollBar = new BBScrollBar();
            if (!_scrollBar.Initialize(x, y + 30, 390, 13, 13, false, false, _gameMain.Random, out reason))
            {
                return false;
            }

            _expensesBackground = new BBStretchableImage();
            _incomeBackground = new BBStretchableImage();
            _reserves = new BBStretchableImage();

            _expenseTitle = new BBLabel();
            _incomeTitle = new BBLabel();

            _expenses = new BBStretchButton[4];
            _expenseLabels = new BBLabel[4];
            _incomes = new BBStretchButton[2];
            _incomeLabels = new BBLabel[2];
            for (int i = 0; i < 4; i++)
            {
                _expenses[i] = new BBStretchButton();
                _expenseLabels[i] = new BBLabel();
            }
            for (int i = 0; i < 2; i++)
            {
                _incomes[i] = new BBStretchButton();
                _incomeLabels[i] = new BBLabel();
            }

            x = (gameMain.ScreenWidth / 2) - 513;
            y = (gameMain.ScreenHeight / 2) + 143;

            if (!_expensesBackground.Initialize(x, y, 476, 140, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_expenseTitle.Initialize(0, 0, "Expenses", Color.Gold, "LargeComputerFont", out reason))
            {
                return false;
            }
            _expenseTitle.MoveTo((int)(x + 238 - _expenseTitle.GetWidth() / 2), y + 5);
            if (!_expenses[0].Initialize("Ships", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 50,  228, 40, _gameMain.Random, out reason))
            {
                return false;
            }
            _expenses[0].SetTextColor(Color.Orange, Color.Empty);
            if (!_expenseLabels[0].Initialize(x + 228, y + 65, string.Empty, Color.White, out reason))
            {
                return false;
            }
            _expenseLabels[0].SetAlignment(true);
            if (!_expenses[1].Initialize("Bases", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 90, 228, 40, _gameMain.Random, out reason))
            {
                return false;
            }
            _expenses[1].SetTextColor(Color.Orange, Color.Empty);
            if (!_expenseLabels[1].Initialize(x + 228, y + 105, string.Empty, Color.White, out reason))
            {
                return false;
            }
            _expenseLabels[1].SetAlignment(true);
            if (!_expenses[2].Initialize("Spying", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 238, y + 50, 228, 40, _gameMain.Random, out reason))
            {
                return false;
            }
            _expenses[2].SetTextColor(Color.Orange, Color.Empty);
            if (!_expenseLabels[2].Initialize(x + 456, y + 65, string.Empty, Color.White, out reason))
            {
                return false;
            }
            _expenseLabels[2].SetAlignment(true);
            if (!_expenses[3].Initialize("Security", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 238, y + 90, 228, 40, _gameMain.Random, out reason))
            {
                return false;
            }
            _expenses[3].SetTextColor(Color.Orange, Color.Empty);
            if (!_expenseLabels[3].Initialize(x + 456, y + 105, string.Empty, Color.White, out reason))
            {
                return false;
            }
            _expenseLabels[3].SetAlignment(true);
            x += 476;

            if (!_incomeBackground.Initialize(x, y, 250, 140, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_incomeTitle.Initialize(0, 0, "Incomes", Color.Gold, "LargeComputerFont", out reason))
            {
                return false;
            }
            if (!_incomes[0].Initialize("Planets", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 50, 230, 40, _gameMain.Random, out reason))
            {
                return false;
            }
            _incomes[0].SetTextColor(Color.Orange, Color.Empty);
            if (!_incomeLabels[0].Initialize(x + 230, y + 65, string.Empty, Color.White, out reason))
            {
                return false;
            }
            _incomeLabels[0].SetAlignment(true);
            if (!_incomes[1].Initialize("Trade", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 90, 230, 40, _gameMain.Random, out reason))
            {
                return false;
            }
            _incomes[1].SetTextColor(Color.Orange, Color.Empty);
            if (!_incomeLabels[1].Initialize(x + 230, y + 105, string.Empty, Color.White, out reason))
            {
                return false;
            }
            _incomeLabels[1].SetAlignment(true);
            _incomeTitle.MoveTo((int)(x + 125 - _incomeTitle.GetWidth() / 2), y + 5);
            x += 250;

            if (!_reserves.Initialize(x, y, 300, 140, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }
            _reserveSlider = new BBScrollBar();
            _reservesLabel = new BBLabel();
            _reservesAmount = new BBLabel();

            _transferSlider = new BBScrollBar();
            _transferLabel = new BBLabel();
            _transferAmount = new BBLabel();
            _transferReserves = new BBStretchButton();

            if (!_reservesLabel.Initialize(x + 10, y + 10, "Reserve:", Color.Orange, out reason))
            {
                return false;
            }
            if (!_reservesAmount.Initialize(x + 280, y + 10, string.Empty, Color.White, out reason))
            {
                return false;
            }
            if (!_reserveSlider.Initialize(x + 10, y + 33, 280, 0, 20, true, true, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_transferLabel.Initialize(x + 10, y + 51, "Amount to transfer:", Color.Orange, out reason))
            {
                return false;
            }
            if (!_transferAmount.Initialize(x + 280, y + 51, string.Empty, Color.White, out reason))
            {
                return false;
            }
            if (!_transferSlider.Initialize(x + 10, y + 72, 280, 0, 200, true, true, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_transferReserves.Initialize("Transfer reserves to selected planet", ButtonTextAlignment.CENTER, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 95, 280, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            _reservesAmount.SetAlignment(true);
            _transferAmount.SetAlignment(true);

            return true;
        }
Exemple #24
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            if (!base.Initialize((gameMain.ScreenWidth / 2) - 250, (gameMain.ScreenHeight / 2) - 200, 500, 400, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return(false);
            }

            int x = (gameMain.ScreenWidth / 2) - 150;
            int y = (gameMain.ScreenHeight / 2) - 50;

            _saveGameNamePromptBackground = new BBStretchableImage();
            if (!_saveGameNamePromptBackground.Initialize(x, y, 300, 100, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }
            _saveGameNamePromptInstructionLabel = new BBLabel();
            if (!_saveGameNamePromptInstructionLabel.Initialize(x + 20, y + 10, "Please input name for the save:", Color.White, out reason))
            {
                return(false);
            }
            _saveGameNameField = new BBSingleLineTextBox();
            if (!_saveGameNameField.Initialize(string.Empty, x + 20, y + 40, 250, 40, false, gameMain.Random, out reason))
            {
                return(false);
            }

            _buttons = new BBStretchButton[4];

            _buttons[0] = new BBStretchButton();
            if (!_buttons[0].Initialize("New Game", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 30, _yPos + 350, 200, 35, gameMain.Random, out reason))
            {
                return(false);
            }
            _buttons[1] = new BBStretchButton();
            if (!_buttons[1].Initialize("Save Game", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 270, _yPos + 300, 200, 35, gameMain.Random, out reason))
            {
                return(false);
            }
            _buttons[2] = new BBStretchButton();
            if (!_buttons[2].Initialize("Load Game", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 30, _yPos + 300, 200, 35, gameMain.Random, out reason))
            {
                return(false);
            }
            _buttons[2].Enabled = false;

            _buttons[3] = new BBStretchButton();
            if (!_buttons[3].Initialize("Exit Game", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 270, _yPos + 350, 200, 35, gameMain.Random, out reason))
            {
                return(false);
            }

            _saveGameListBackground = new BBStretchableImage();
            if (!_saveGameListBackground.Initialize(_xPos + 20, _yPos + 20, 460, 325, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }

            _saveGameButtons = new BBInvisibleStretchButton[8];
            for (int i = 0; i < _saveGameButtons.Length; i++)
            {
                _saveGameButtons[i] = new BBInvisibleStretchButton();
                if (!_saveGameButtons[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, _xPos + 30, _yPos + 35 + (i * 32), 420, 32, gameMain.Random, out reason))
                {
                    return(false);
                }
            }

            _scrollBar = new BBScrollBar();
            if (!_scrollBar.Initialize(_xPos + 455, _yPos + 37, 256, _saveGameButtons.Length, _saveGameButtons.Length, false, false, gameMain.Random, out reason))
            {
                return(false);
            }

            _maxVisible = 0;
            _scrollBar.SetEnabledState(false);
            _selectedGame  = -1;
            _files         = new List <FileInfo>();
            _promptShowing = false;

            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;
        }
Exemple #26
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;
        }
Exemple #27
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);
        }
Exemple #28
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            this._gameMain = gameMain;

            _showingSelection      = false;
            _background            = new BBStretchableImage();
            _playerBackground      = new BBStretchableImage();
            _playerInfoBackground  = new BBStretchableImage();
            _playerRaceButton      = new BBStretchButton();
            _playerRaceDescription = new BBTextBox();
            _playerLabels          = new BBLabel[3];
            _playerEmperorName     = new BBSingleLineTextBox();
            _playerHomeworldName   = new BBSingleLineTextBox();
            _AIBackground          = new BBStretchableImage();
            _AIRaceButtons         = new BBStretchButton[5];
            _raceSprites           = new BBSprite[6];
            _playerRaces           = new Race[6];
            _playerColors          = new Color[6];
            _numberOfAILabel       = new BBLabel();
            _numericUpDownAI       = new BBNumericUpDown();
            _busyImage             = new BBStretchableImage();
            _busyText     = new BBLabel();
            _okButton     = new BBStretchButton();
            _cancelButton = new BBStretchButton();

            _difficultyComboBox = new BBComboBox();
            _difficultyLabel    = new BBLabel();

            _nebulaBackground = SpriteManager.GetSprite("TitleNebula", gameMain.Random);

            _playerColors[0] = Color.Blue;
            _playerColors[1] = Color.Red;
            _playerColors[2] = Color.Yellow;
            _playerColors[3] = Color.Green;
            _playerColors[4] = Color.Purple;
            _playerColors[5] = Color.Orange;

            _xPos = (gameMain.ScreenWidth / 2) - 440;
            _yPos = (gameMain.ScreenHeight / 2) - 340;
            if (_nebulaBackground == null)
            {
                reason = "TitleNebula sprite doesn't exist.";
                return(false);
            }
            if (!_background.Initialize(_xPos, _yPos, 880, 680, StretchableImageType.MediumBorder, gameMain.Random, out reason))
            {
                return(false);
            }

            if (!_playerBackground.Initialize(_xPos + 30, _yPos + 30, 820, 170, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_playerInfoBackground.Initialize(_xPos + 40, _yPos + 60, 295, 130, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_playerRaceButton.Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 340, _yPos + 40, 500, 150, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_playerRaceDescription.Initialize(_xPos + 485, _yPos + 51, 345, 130, true, true, "RaceDescriptionTextBox", gameMain.Random, out reason))
            {
                return(false);
            }
            _playerLabels[0] = new BBLabel();
            if (!_playerLabels[0].Initialize(_xPos + 90, _yPos + 36, "Player Race Information", Color.White, out reason))
            {
                return(false);
            }
            _playerLabels[1] = new BBLabel();
            if (!_playerLabels[1].Initialize(_xPos + 45, _yPos + 70, "Emperor Name:", Color.White, out reason))
            {
                return(false);
            }
            if (!_playerEmperorName.Initialize(string.Empty, _xPos + 50, _yPos + 90, 275, 35, false, gameMain.Random, out reason))
            {
                return(false);
            }
            _playerLabels[2] = new BBLabel();
            if (!_playerLabels[2].Initialize(_xPos + 45, _yPos + 125, "Homeworld Name:", Color.White, out reason))
            {
                return(false);
            }
            if (!_playerHomeworldName.Initialize(string.Empty, _xPos + 50, _yPos + 145, 275, 35, false, gameMain.Random, out reason))
            {
                return(false);
            }
            _playerRaceDescription.SetText("A random race will be chosen.  If the Emperor and/or Homeworld name fields are left blank, default race names for those will be used.");
            _randomRaceSprite = SpriteManager.GetSprite("RandomRace", gameMain.Random);
            if (_randomRaceSprite == null)
            {
                reason = "RandomRace sprite does not exist.";
                return(false);
            }

            for (int i = 0; i < _raceSprites.Length; i++)
            {
                _raceSprites[i] = _randomRaceSprite;
            }

            if (!_AIBackground.Initialize(_xPos + 30, _yPos + 205, 820, 220, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_difficultyLabel.Initialize(_xPos + 40, _yPos + 220, "Difficulty Level:", Color.White, out reason))
            {
                return(false);
            }
            List <string> difficultyItems = new List <string>
            {
                "Simple",
                "Easy",
                "Medium",
                "Hard",
                "Impossible"
            };

            if (!_difficultyComboBox.Initialize(difficultyItems, _xPos + 170, _yPos + 215, 200, 35, 5, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_numberOfAILabel.Initialize(_xPos + 730, _yPos + 220, "Number of Computer Players:", Color.White, out reason))
            {
                return(false);
            }
            _numberOfAILabel.SetAlignment(true);
            if (!_numericUpDownAI.Initialize(_xPos + 735, _yPos + 222, 75, 1, 5, 5, gameMain.Random, out reason))
            {
                return(false);
            }
            for (int i = 0; i < _AIRaceButtons.Length; i++)
            {
                _AIRaceButtons[i] = new BBStretchButton();
                if (!_AIRaceButtons[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 40 + (i * 155), _yPos + 260, 150, 150, gameMain.Random, out reason))
                {
                    return(false);
                }
            }

            _galaxyBackground = new BBStretchableImage();
            _galaxyComboBox   = new BBComboBox();

            List <string> items = new List <string>();

            items.Add("Small Galaxy");
            items.Add("Medium Galaxy");
            items.Add("Large Galaxy");
            items.Add("Huge Galaxy");

            if (!_galaxyBackground.Initialize(_xPos + 30, _yPos + 430, 240, 235, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_galaxyComboBox.Initialize(items, _xPos + 30, _yPos + 430, 240, 35, 4, gameMain.Random, out reason))
            {
                return(false);
            }

            _raceSelection = new RaceSelection();
            if (!_raceSelection.Initialize(gameMain, out reason))
            {
                return(false);
            }
            _raceSelection.OnOkClick = OnRaceSelectionOKClick;

            _generatingGalaxy = false;
            if (!_busyImage.Initialize(gameMain.ScreenWidth / 2 - 100, gameMain.ScreenHeight / 2 - 50, 200, 100, StretchableImageType.MediumBorder, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_busyText.Initialize(gameMain.ScreenWidth / 2, gameMain.ScreenHeight / 2, "Generating Galaxy", Color.White, out reason))
            {
                return(false);
            }
            if (!_okButton.Initialize("Start Game", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 660, _yPos + 610, 200, 50, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_cancelButton.Initialize("Main Menu", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 450, _yPos + 610, 200, 50, gameMain.Random, out reason))
            {
                return(false);
            }

            LoadLastSettings();

            reason = null;
            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 #30
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            this._gameMain = gameMain;

            _showingSelection = false;
            _background = new BBStretchableImage();
            _playerBackground = new BBStretchableImage();
            _playerInfoBackground = new BBStretchableImage();
            _playerRaceButton = new BBStretchButton();
            _playerRaceDescription = new BBTextBox();
            _playerLabels = new BBLabel[3];
            _playerEmperorName = new BBSingleLineTextBox();
            _playerHomeworldName = new BBSingleLineTextBox();
            _AIBackground = new BBStretchableImage();
            _AIRaceButtons = new BBStretchButton[5];
            _raceSprites = new BBSprite[6];
            _playerRaces = new Race[6];
            _playerColors = new Color[6];
            _numberOfAILabel = new BBLabel();
            _numericUpDownAI = new BBNumericUpDown();
            _busyImage = new BBStretchableImage();
            _busyText = new BBLabel();
            _okButton = new BBStretchButton();
            _cancelButton = new BBStretchButton();

            _difficultyComboBox = new BBComboBox();
            _difficultyLabel = new BBLabel();

            _nebulaBackground = SpriteManager.GetSprite("TitleNebula", gameMain.Random);

            _playerColors[0] = Color.Blue;
            _playerColors[1] = Color.Red;
            _playerColors[2] = Color.Yellow;
            _playerColors[3] = Color.Green;
            _playerColors[4] = Color.Purple;
            _playerColors[5] = Color.Orange;

            _xPos = (gameMain.ScreenWidth / 2) - 440;
            _yPos = (gameMain.ScreenHeight / 2) - 340;
            if (_nebulaBackground == null)
            {
                reason = "TitleNebula sprite doesn't exist.";
                return false;
            }
            if (!_background.Initialize(_xPos, _yPos, 880, 680, StretchableImageType.MediumBorder, gameMain.Random, out reason))
            {
                return false;
            }

            if (!_playerBackground.Initialize(_xPos + 30, _yPos + 30, 820, 170, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_playerInfoBackground.Initialize(_xPos + 40, _yPos + 60, 295, 130, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_playerRaceButton.Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 340, _yPos + 40, 500, 150, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_playerRaceDescription.Initialize(_xPos + 485, _yPos + 51, 345, 130, true, true, "RaceDescriptionTextBox", gameMain.Random, out reason))
            {
                return false;
            }
            _playerLabels[0] = new BBLabel();
            if (!_playerLabels[0].Initialize(_xPos + 90, _yPos + 36, "Player Race Information", Color.White, out reason))
            {
                return false;
            }
            _playerLabels[1] = new BBLabel();
            if (!_playerLabels[1].Initialize(_xPos + 45, _yPos + 70, "Emperor Name:", Color.White, out reason))
            {
                return false;
            }
            if (!_playerEmperorName.Initialize(string.Empty, _xPos + 50, _yPos + 90, 275, 35, false, gameMain.Random, out reason))
            {
                return false;
            }
            _playerLabels[2] = new BBLabel();
            if (!_playerLabels[2].Initialize(_xPos + 45, _yPos + 125, "Homeworld Name:", Color.White, out reason))
            {
                return false;
            }
            if (!_playerHomeworldName.Initialize(string.Empty, _xPos + 50, _yPos + 145, 275, 35, false, gameMain.Random, out reason))
            {
                return false;
            }
            _playerRaceDescription.SetText("A random race will be chosen.  If the Emperor and/or Homeworld name fields are left blank, default race names for those will be used.");
            _randomRaceSprite = SpriteManager.GetSprite("RandomRace", gameMain.Random);
            if (_randomRaceSprite == null)
            {
                reason = "RandomRace sprite does not exist.";
                return false;
            }

            for (int i = 0; i < _raceSprites.Length; i++)
            {
                _raceSprites[i] = _randomRaceSprite;
            }

            if (!_AIBackground.Initialize(_xPos + 30, _yPos + 205, 820, 220, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_difficultyLabel.Initialize(_xPos + 40, _yPos + 220, "Difficulty Level:", Color.White, out reason))
            {
                return false;
            }
            List<string> difficultyItems = new List<string>
                                            {
                                                "Simple",
                                                "Easy",
                                                "Medium",
                                                "Hard",
                                                "Impossible"
                                            };
            if (!_difficultyComboBox.Initialize(difficultyItems, _xPos + 170, _yPos + 215, 200, 35, 5, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_numberOfAILabel.Initialize(_xPos + 730, _yPos + 220, "Number of Computer Players:", Color.White, out reason))
            {
                return false;
            }
            _numberOfAILabel.SetAlignment(true);
            if (!_numericUpDownAI.Initialize(_xPos + 735, _yPos + 222, 75, 1, 5, 5, gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < _AIRaceButtons.Length; i++)
            {
                _AIRaceButtons[i] = new BBStretchButton();
                if (!_AIRaceButtons[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 40 + (i * 155), _yPos + 260, 150, 150, gameMain.Random, out reason))
                {
                    return false;
                }
            }

            _galaxyBackground = new BBStretchableImage();
            _galaxyComboBox = new BBComboBox();

            List<string> items = new List<string>();
            items.Add("Small Galaxy");
            items.Add("Medium Galaxy");
            items.Add("Large Galaxy");
            items.Add("Huge Galaxy");

            if (!_galaxyBackground.Initialize(_xPos + 30, _yPos + 430, 240, 235, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_galaxyComboBox.Initialize(items, _xPos + 30, _yPos + 430, 240, 35, 4, gameMain.Random, out reason))
            {
                return false;
            }

            _raceSelection = new RaceSelection();
            if (!_raceSelection.Initialize(gameMain, out reason))
            {
                return false;
            }
            _raceSelection.OnOkClick = OnRaceSelectionOKClick;

            _generatingGalaxy = false;
            if (!_busyImage.Initialize(gameMain.ScreenWidth / 2 - 100, gameMain.ScreenHeight / 2 - 50, 200, 100, StretchableImageType.MediumBorder, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_busyText.Initialize(gameMain.ScreenWidth / 2, gameMain.ScreenHeight / 2, "Generating Galaxy", Color.White, out reason))
            {
                return false;
            }
            if (!_okButton.Initialize("Start Game", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 660, _yPos + 610, 200, 50, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_cancelButton.Initialize("Main Menu", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 450, _yPos + 610, 200, 50, gameMain.Random, out reason))
            {
                return false;
            }

            LoadLastSettings();

            reason = null;
            return true;
        }
Exemple #31
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            _gameMain = gameMain;

            _x = (gameMain.ScreenWidth / 2) - 500;
            _y = (gameMain.ScreenHeight / 2) - 305;
            if (!Initialize((gameMain.ScreenWidth / 2) - 520, (gameMain.ScreenHeight / 2) - 320, 1040, 640, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return(false);
            }

            _shipNames = new BBStretchButton[6];
            for (int i = 0; i < _shipNames.Length; i++)
            {
                _shipNames[i] = new BBStretchButton();
                if (!_shipNames[i].Initialize(string.Empty, ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _x + 80 + (150 * i), _y, 150, 40, _gameMain.Random, out reason))
                {
                    return(false);
                }
            }

            _planetBackgrounds = new BBStretchButton[10];
            _planetNames       = new BBLabel[10];
            _statusLabels      = new BBLabel[11];
            _scrollBar         = new BBScrollBar();

            _statusLabels[0] = new BBLabel();
            if (!_statusLabels[0].Initialize(_x, _y + 10, "Status", Color.White, out reason))
            {
                return(false);
            }

            for (int i = 0; i < 10; i++)
            {
                _planetBackgrounds[i] = new BBStretchButton();
                if (!_planetBackgrounds[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _x, _y + 40 + (50 * i), 980, 50, _gameMain.Random, out reason))
                {
                    return(false);
                }
                _planetNames[i] = new BBLabel();
                if (!_planetNames[i].Initialize(_x + 5, _y + 65 + (50 * i), string.Empty, Color.GreenYellow, out reason))
                {
                    return(false);
                }
                _statusLabels[i + 1] = new BBLabel();
                if (!_statusLabels[i + 1].Initialize(_x + 5, _y + 45 + (50 * i), string.Empty, Color.Orange, out reason))
                {
                    return(false);
                }
            }

            _shipAmountLabels = new BBStretchButton[10][];
            for (int i = 0; i < _shipAmountLabels.Length; i++)
            {
                _shipAmountLabels[i] = new BBStretchButton[6];
                for (int j = 0; j < 6; j++)
                {
                    _shipAmountLabels[i][j] = new BBStretchButton();
                    if (!_shipAmountLabels[i][j].Initialize(string.Empty, ButtonTextAlignment.CENTER, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, _x + 80 + (150 * j), _y + 43 + (i * 50), 150, 25, _gameMain.Random, out reason))
                    {
                        return(false);
                    }
                }
            }

            if (!_scrollBar.Initialize(_x + 980, _y + 40, 500, 10, 10, false, false, _gameMain.Random, out reason))
            {
                return(false);
            }

            _maintenanceCostBackground = new BBStretchableImage();
            _maintenanceLabel          = new BBLabel();
            _maintenanceAmountLabel    = new BBLabel();
            _scrapButtons = new BBButton[6];
            for (int i = 0; i < _scrapButtons.Length; i++)
            {
                _scrapButtons[i] = new BBButton();
                if (!_scrapButtons[i].Initialize("ScrapShipBG", "ScrapShipFG", string.Empty, ButtonTextAlignment.LEFT, _x + 112 + (150 * i), _y + 540, 75, 35, gameMain.Random, out reason))
                {
                    return(false);
                }
            }

            if (!_maintenanceCostBackground.Initialize(_x + 220, _y + 577, 280, 35, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_maintenanceLabel.Initialize(_x + 225, _y + 585, "Maintenance Cost:", Color.Orange, out reason))
            {
                return(false);
            }
            if (!_maintenanceAmountLabel.Initialize(_x + 495, _y + 585, string.Empty, Color.White, out reason))
            {
                return(false);
            }
            _maintenanceAmountLabel.SetAlignment(true);

            _viewSpecsButton = new BBStretchButton();
            if (!_viewSpecsButton.Initialize("View Ship Specifications", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _x + 500, _y + 577, 280, 35, gameMain.Random, out reason))
            {
                return(false);
            }

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

            reason = null;
            return(true);
        }
Exemple #32
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            if (!base.Initialize((gameMain.ScreenWidth / 2) - 250, (gameMain.ScreenHeight / 2) - 200, 500, 400, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return false;
            }

            int x = (gameMain.ScreenWidth / 2) - 150;
            int y = (gameMain.ScreenHeight / 2) - 50;
            _saveGameNamePromptBackground = new BBStretchableImage();
            if (!_saveGameNamePromptBackground.Initialize(x, y, 300, 100, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            _saveGameNamePromptInstructionLabel = new BBLabel();
            if (!_saveGameNamePromptInstructionLabel.Initialize(x + 20, y + 10, "Please input name for the save:", Color.White, out reason))
            {
                return false;
            }
            _saveGameNameField = new BBSingleLineTextBox();
            if (!_saveGameNameField.Initialize(string.Empty, x + 20, y + 40, 250, 40, false, gameMain.Random, out reason))
            {
                return false;
            }

            _buttons = new BBStretchButton[4];

            _buttons[0] = new BBStretchButton();
            if (!_buttons[0].Initialize("New Game", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 30, _yPos + 350, 200, 35, gameMain.Random, out reason))
            {
                return false;
            }
            _buttons[1] = new BBStretchButton();
            if (!_buttons[1].Initialize("Save Game", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 270, _yPos + 300, 200, 35, gameMain.Random, out reason))
            {
                return false;
            }
            _buttons[2] = new BBStretchButton();
            if (!_buttons[2].Initialize("Load Game", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 30, _yPos + 300, 200, 35, gameMain.Random, out reason))
            {
                return false;
            }
            _buttons[2].Enabled = false;

            _buttons[3] = new BBStretchButton();
            if (!_buttons[3].Initialize("Exit Game", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 270, _yPos + 350, 200, 35, gameMain.Random, out reason))
            {
                return false;
            }

            _saveGameListBackground = new BBStretchableImage();
            if (!_saveGameListBackground.Initialize(_xPos + 20, _yPos + 20, 460, 325, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }

            _saveGameButtons = new BBInvisibleStretchButton[8];
            for (int i = 0; i < _saveGameButtons.Length; i++)
            {
                _saveGameButtons[i] = new BBInvisibleStretchButton();
                if (!_saveGameButtons[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, _xPos + 30, _yPos + 35 + (i * 32), 420, 32, gameMain.Random, out reason))
                {
                    return false;
                }
            }

            _scrollBar = new BBScrollBar();
            if (!_scrollBar.Initialize(_xPos + 455, _yPos + 37, 256, _saveGameButtons.Length, _saveGameButtons.Length, false, false, gameMain.Random, out reason))
            {
                return false;
            }

            _maxVisible = 0;
            _scrollBar.SetEnabledState(false);
            _selectedGame = -1;
            _files = new List<FileInfo>();
            _promptShowing = false;

            return true;
        }
Exemple #33
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            this._gameMain = gameMain;

            _buttons = new BBButton[4];

            _x = (gameMain.ScreenWidth / 2) - 130;
            _y = (gameMain.ScreenHeight / 2);

            for (int i = 0; i < _buttons.Length; i++)
            {
                _buttons[i] = new BBButton();
            }

            if (!_buttons[0].Initialize("MainButtonBG", "MainButtonFG", "Continue", "LargeComputerFont", ButtonTextAlignment.CENTER, _x, _y, 260, 40, gameMain.Random, out reason, 20, -1))
            {
                return(false);
            }
            if (!_buttons[1].Initialize("MainButtonBG", "MainButtonFG", "New Game", "LargeComputerFont", ButtonTextAlignment.CENTER, _x, _y + 50, 260, 40, gameMain.Random, out reason, 20, -1))
            {
                return(false);
            }
            if (!_buttons[2].Initialize("MainButtonBG", "MainButtonFG", "Load Game", "LargeComputerFont", ButtonTextAlignment.CENTER, _x, _y + 100, 260, 40, gameMain.Random, out reason, 20, -1))
            {
                return(false);
            }
            if (!_buttons[3].Initialize("MainButtonBG", "MainButtonFG", "Exit", "LargeComputerFont", ButtonTextAlignment.CENTER, _x, _y + 150, 260, 40, gameMain.Random, out reason, 20, -1))
            {
                return(false);
            }
            for (int i = 0; i < _buttons.Length; i++)
            {
                _buttons[i].SetTextColor(System.Drawing.Color.Gold, System.Drawing.Color.Black);
            }

            _versionLabel = new BBLabel();
            if (!_versionLabel.Initialize(10, _gameMain.ScreenHeight - 30, "Version 0.59", System.Drawing.Color.White, out reason))
            {
                return(false);
            }

            _background = SpriteManager.GetSprite("MainBackground", gameMain.Random);
            _planet     = SpriteManager.GetSprite("MainPlanetBackground", gameMain.Random);
            _title      = SpriteManager.GetSprite("Title", gameMain.Random);

            _x = (gameMain.ScreenWidth / 2) - 512;
            _y = (gameMain.ScreenHeight / 2) - 300;

            _files = Utility.GetSaveGames(gameMain.GameDataSet.FullName);
            if (_files.Count == 0)
            {
                _buttons[0].Active = false;                 //Disabled Continue and Load buttons since there's no games to load
                _buttons[2].Active = false;
            }

            _loadBackground = new BBStretchableImage();
            if (!_loadBackground.Initialize((gameMain.ScreenWidth / 2) - 225, (gameMain.ScreenHeight / 2) - 175, 450, 350, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }
            _saveGameButtons = new BBInvisibleStretchButton[10];
            for (int i = 0; i < _saveGameButtons.Length; i++)
            {
                _saveGameButtons[i] = new BBInvisibleStretchButton();
                if (!_saveGameButtons[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, (gameMain.ScreenWidth / 2) - 220, (gameMain.ScreenHeight / 2) - 160 + (i * 32), 420, 32, gameMain.Random, out reason))
                {
                    return(false);
                }
            }
            _scrollBar = new BBScrollBar();
            if (!_scrollBar.Initialize((gameMain.ScreenWidth / 2) + 200, (gameMain.ScreenHeight / 2) - 160, 320, 10, 10, false, false, gameMain.Random, out reason))
            {
                return(false);
            }

            _maxVisible = _files.Count > _saveGameButtons.Length ? _saveGameButtons.Length : _files.Count;
            if (_maxVisible < _saveGameButtons.Length)
            {
                //Disable the scrollbar
                _scrollBar.SetEnabledState(false);
            }
            else
            {
                _scrollBar.SetEnabledState(true);
                _scrollBar.SetAmountOfItems(_files.Count);
            }

            RefreshSaves();

            _showingLoadMenu = false;

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

            _buttons = new BBButton[4];

            _x = (gameMain.ScreenWidth / 2) - 130;
            _y = (gameMain.ScreenHeight / 2);

            for (int i = 0; i < _buttons.Length; i++)
            {
                _buttons[i] = new BBButton();
            }

            if (!_buttons[0].Initialize("MainButtonBG", "MainButtonFG", "Continue", "LargeComputerFont", ButtonTextAlignment.CENTER, _x, _y, 260, 40, gameMain.Random, out reason, 20, -1))
            {
                return false;
            }
            if (!_buttons[1].Initialize("MainButtonBG", "MainButtonFG", "New Game", "LargeComputerFont", ButtonTextAlignment.CENTER, _x, _y + 50, 260, 40, gameMain.Random, out reason, 20, -1))
            {
                return false;
            }
            if (!_buttons[2].Initialize("MainButtonBG", "MainButtonFG", "Load Game", "LargeComputerFont", ButtonTextAlignment.CENTER, _x, _y + 100, 260, 40, gameMain.Random, out reason, 20, -1))
            {
                return false;
            }
            if (!_buttons[3].Initialize("MainButtonBG", "MainButtonFG", "Exit", "LargeComputerFont", ButtonTextAlignment.CENTER, _x, _y + 150, 260, 40, gameMain.Random, out reason, 20, -1))
            {
                return false;
            }
            for (int i = 0; i < _buttons.Length; i++)
            {
                _buttons[i].SetTextColor(System.Drawing.Color.Gold, System.Drawing.Color.Black);
            }

            _versionLabel = new BBLabel();
            if (!_versionLabel.Initialize(10, _gameMain.ScreenHeight - 30, "Version 0.59", System.Drawing.Color.White, out reason))
            {
                return false;
            }

            _background = SpriteManager.GetSprite("MainBackground", gameMain.Random);
            _planet = SpriteManager.GetSprite("MainPlanetBackground", gameMain.Random);
            _title = SpriteManager.GetSprite("Title", gameMain.Random);

            _x = (gameMain.ScreenWidth / 2) - 512;
            _y = (gameMain.ScreenHeight / 2) - 300;

            _files = Utility.GetSaveGames(gameMain.GameDataSet.FullName);
            if (_files.Count == 0)
            {
                _buttons[0].Active = false; //Disabled Continue and Load buttons since there's no games to load
                _buttons[2].Active = false;
            }

            _loadBackground = new BBStretchableImage();
            if (!_loadBackground.Initialize((gameMain.ScreenWidth / 2) - 225, (gameMain.ScreenHeight / 2) - 175, 450, 350, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            _saveGameButtons = new BBInvisibleStretchButton[10];
            for (int i = 0; i < _saveGameButtons.Length; i++)
            {
                _saveGameButtons[i] = new BBInvisibleStretchButton();
                if (!_saveGameButtons[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, (gameMain.ScreenWidth / 2) - 220, (gameMain.ScreenHeight / 2) - 160 + (i * 32), 420, 32, gameMain.Random, out reason))
                {
                    return false;
                }
            }
            _scrollBar = new BBScrollBar();
            if (!_scrollBar.Initialize((gameMain.ScreenWidth / 2) + 200, (gameMain.ScreenHeight / 2) - 160, 320, 10, 10, false, false, gameMain.Random, out reason))
            {
                return false;
            }

            _maxVisible = _files.Count > _saveGameButtons.Length ? _saveGameButtons.Length : _files.Count;
            if (_maxVisible < _saveGameButtons.Length)
            {
                //Disable the scrollbar
                _scrollBar.SetEnabledState(false);
            }
            else
            {
                _scrollBar.SetEnabledState(true);
                _scrollBar.SetAmountOfItems(_files.Count);
            }

            RefreshSaves();

            _showingLoadMenu = false;

            reason = null;
            return true;
        }
        public bool Initialize(GameMain gameMain, string name, out string reason)
        {
            _x = (gameMain.ScreenWidth / 2) - 430;
            _y = (gameMain.ScreenHeight / 2) - 300;
            if (!Initialize((gameMain.ScreenWidth / 2) - 450, (gameMain.ScreenHeight / 2) - 320, 900, 640, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return false;
            }
            _shipBackground = new BBStretchableImage(); //Used for sprite preview
            if (!_shipBackground.Initialize(0,0, 170, 170, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            _shipBackgrounds = new BBStretchableImage[6];
            _beamBackgrounds = new BBStretchableImage[6];
            _missileBackgrounds = new BBStretchableImage[6];
            _attackBackgrounds = new BBStretchableImage[6];
            _hitPointsBackgrounds = new BBStretchableImage[6];
            _shieldBackgrounds = new BBStretchableImage[6];
            _galaxySpeedBackgrounds = new BBStretchableImage[6];
            _combatSpeedBackgrounds = new BBStretchableImage[6];
            _weaponsBackgrounds = new BBStretchableImage[6];
            _specialsBackgrounds = new BBStretchableImage[6];
            _scrapButtons = new BBButton[6];
            _shipNameLabels = new BBLabel[6];
            _beamDefLabels = new BBLabel[6];
            _beamDefValueLabels = new BBLabel[6];
            _missileDefLabels = new BBLabel[6];
            _missileDefValueLabels = new BBLabel[6];
            _attackLevelLabels = new BBLabel[6];
            _attackLevelValueLabels = new BBLabel[6];
            _hitPointsLabels = new BBLabel[6];
            _hitPointsValueLabels = new BBLabel[6];
            _shieldLabels = new BBLabel[6];
            _shieldValueLabels = new BBLabel[6];
            _galaxySpeedLabels = new BBLabel[6];
            _galaxySpeedValueLabels = new BBLabel[6];
            _combatSpeedLabels = new BBLabel[6];
            _combatSpeedValueLabels = new BBLabel[6];
            _costLabels = new BBLabel[6];
            _costValueLabels = new BBLabel[6];
            _amountLabels = new BBLabel[6];
            _amountValueLabels = new BBLabel[6];
            _weaponLabels = new BBLabel[6][];
            _specialLabels = new BBLabel[6][];
            for (int i = 0; i < 6; i++)
            {
                _shipBackgrounds[i] = new BBStretchableImage();
                _scrapButtons[i] = new BBButton();
                _shipNameLabels[i] = new BBLabel();
                _beamBackgrounds[i] = new BBStretchableImage();
                _missileBackgrounds[i] = new BBStretchableImage();
                _attackBackgrounds[i] = new BBStretchableImage();
                _hitPointsBackgrounds[i] = new BBStretchableImage();
                _shieldBackgrounds[i] = new BBStretchableImage();
                _galaxySpeedBackgrounds[i] = new BBStretchableImage();
                _combatSpeedBackgrounds[i] = new BBStretchableImage();
                _weaponsBackgrounds[i] = new BBStretchableImage();
                _specialsBackgrounds[i] = new BBStretchableImage();
                _beamDefLabels[i] = new BBLabel();
                _beamDefValueLabels[i] = new BBLabel();
                _missileDefLabels[i] = new BBLabel();
                _missileDefValueLabels[i] = new BBLabel();
                _attackLevelLabels[i] = new BBLabel();
                _attackLevelValueLabels[i] = new BBLabel();
                _hitPointsLabels[i] = new BBLabel();
                _hitPointsValueLabels[i] = new BBLabel();
                _shieldLabels[i] = new BBLabel();
                _shieldValueLabels[i] = new BBLabel();
                _galaxySpeedLabels[i] = new BBLabel();
                _galaxySpeedValueLabels[i] = new BBLabel();
                _combatSpeedLabels[i] = new BBLabel();
                _combatSpeedValueLabels[i] = new BBLabel();
                _costLabels[i] = new BBLabel();
                _costValueLabels[i] = new BBLabel();
                _amountLabels[i] = new BBLabel();
                _amountValueLabels[i] = new BBLabel();
                if (!_shipBackgrounds[i].Initialize(_x, _y + (i * 100), 860, 100, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_shipNameLabels[i].Initialize(_x + 10, _y + 10 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return false;
                }
                if (!_scrapButtons[i].Initialize("ScrapShipBG", "ScrapShipFG", string.Empty, ButtonTextAlignment.LEFT, _x + 250, _y + 5 + (i * 100), 75, 35, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_scrapButtons[i].SetToolTip(name + "ScrapShipToolTip" + i, "Scrap Ship Design", gameMain.ScreenWidth, gameMain.ScreenHeight, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_beamBackgrounds[i].Initialize(_x + 5, _y + 39 + (i * 100), 160, 28, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_beamDefLabels[i].Initialize(_x + 10, _y + 43 + (i * 100), "Beam Defense:", Color.Orange, out reason))
                {
                    return false;
                }
                if (!_beamDefValueLabels[i].Initialize(_x + 155, _y + 43 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return false;
                }
                if (!_missileBackgrounds[i].Initialize(_x + 5, _y + 66 + (i * 100), 160, 28, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_missileDefLabels[i].Initialize(_x + 10, _y + 72 + (i * 100), "Missile Defense:", Color.Orange, out reason))
                {
                    return false;
                }
                if (!_missileDefValueLabels[i].Initialize(_x + 155, _y + 72 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return false;
                }
                if (!_attackBackgrounds[i].Initialize(_x + 165, _y + 39 + (i * 100), 160, 28, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_attackLevelLabels[i].Initialize(_x + 170, _y + 43 + (i * 100), "Attack Level:", Color.Orange, out reason))
                {
                    return false;
                }
                if (!_attackLevelValueLabels[i].Initialize(_x + 315, _y + 43 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return false;
                }
                if (!_hitPointsBackgrounds[i].Initialize(_x + 165, _y + 66 + (i * 100), 160, 28, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_hitPointsLabels[i].Initialize(_x + 170, _y + 72 + (i * 100), "Hit Points:", Color.Orange, out reason))
                {
                    return false;
                }
                if (!_hitPointsValueLabels[i].Initialize(_x + 315, _y + 72 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return false;
                }
                if (!_shieldBackgrounds[i].Initialize(_x + 325, _y + 5 + (i * 100), 140, 35, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_shieldLabels[i].Initialize(_x + 330, _y + 12 + (i * 100), "Shield Level:", Color.Orange, out reason))
                {
                    return false;
                }
                if (!_shieldValueLabels[i].Initialize(_x + 455, _y + 12 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return false;
                }
                if (!_galaxySpeedBackgrounds[i].Initialize(_x + 325, _y + 39 + (i * 100), 140, 28, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_galaxySpeedLabels[i].Initialize(_x + 330, _y + 43 + (i * 100), "Galaxy Speed:", Color.Orange, out reason))
                {
                    return false;
                }
                if (!_galaxySpeedValueLabels[i].Initialize(_x + 455, _y + 43 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return false;
                }
                if (!_combatSpeedBackgrounds[i].Initialize(_x + 325, _y + 66 + (i * 100), 140, 28, StretchableImageType.TinyButtonBG, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_combatSpeedLabels[i].Initialize(_x + 330, _y + 72 + (i * 100), "Combat Speed:", Color.Orange, out reason))
                {
                    return false;
                }
                if (!_combatSpeedValueLabels[i].Initialize(_x + 455, _y + 72 + (i * 100), string.Empty, Color.White, out reason))
                {
                    return false;
                }
                if (!_weaponsBackgrounds[i].Initialize(_x + 470, _y + (i * 100), 200, 100, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_specialsBackgrounds[i].Initialize(_x + 670, _y + (i * 100), 190, 100, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_amountLabels[i].Initialize(_x + 675, _y + (i * 100) + 63, "Amt:", Color.Orange, out reason))
                {
                    return false;
                }
                if (!_amountValueLabels[i].Initialize(_x + 755, _y + (i * 100) + 63, string.Empty, Color.White, out reason))
                {
                    return false;
                }
                if (!_costLabels[i].Initialize(_x + 760, _y + (i * 100) + 63, "Cost: ", Color.Orange, out reason))
                {
                    return false;
                }
                if (!_costValueLabels[i].Initialize(_x + 855, _y + (i * 100) + 63, string.Empty, Color.White, out reason))
                {
                    return false;
                }
                _beamDefValueLabels[i].SetAlignment(true);
                _missileDefValueLabels[i].SetAlignment(true);
                _attackLevelValueLabels[i].SetAlignment(true);
                _hitPointsValueLabels[i].SetAlignment(true);
                _shieldValueLabels[i].SetAlignment(true);
                _galaxySpeedValueLabels[i].SetAlignment(true);
                _combatSpeedValueLabels[i].SetAlignment(true);
                _costValueLabels[i].SetAlignment(true);
                _amountValueLabels[i].SetAlignment(true);
                _weaponLabels[i] = new BBLabel[4];
                for (int j = 0; j < _weaponLabels[i].Length; j++)
                {
                    _weaponLabels[i][j] = new BBLabel();
                    if (!_weaponLabels[i][j].Initialize(_x + 475, _y + 7 + (i * 100 + j * 21), string.Empty, Color.White, out reason))
                    {
                        return false;
                    }
                }
                _specialLabels[i] = new BBLabel[3];
                for (int j = 0; j < _specialLabels[i].Length; j++)
                {
                    _specialLabels[i][j] = new BBLabel();
                    if (!_specialLabels[i][j].Initialize(_x + 675, _y + 7 + (i * 100 + j * 21), string.Empty, Color.White, out reason))
                    {
                        return false;
                    }
                }
            }

            reason = null;
            return true;
        }