private void DrawETA(TravelNode node, bool isTentative) { if (isTentative) { _tentativeETA.MoveTo((int)((node.StarSystem.X - _camera.CameraX) * _camera.ZoomDistance), (int)((node.StarSystem.Y - _camera.CameraY - 32) * _camera.ZoomDistance)); if (node.Angle > 180) { _tentativeETA.SetAlignment(true); } else { _tentativeETA.SetAlignment(false); } _tentativeETA.Draw(); } else { _travelETA.MoveTo((int)((node.StarSystem.X - _camera.CameraX) * _camera.ZoomDistance), (int)((node.StarSystem.Y - _camera.CameraY - 32) * _camera.ZoomDistance)); if (node.Angle > 180) { _travelETA.SetAlignment(true); } else { _travelETA.SetAlignment(false); } _travelETA.Draw(); } }
public void LoadFleetAndSystem(Fleet fleet) { _colonizingFleet = fleet; _starSystem = fleet.AdjacentSystem; _colonyShips = new List <Ship>(); foreach (var ship in _colonizingFleet.OrderedShips) { foreach (var special in ship.Specials) { if (special == null) { continue; } if (special.Technology.Colony >= _starSystem.Planets[0].ColonyRequirement) { _colonyShips.Add(ship); break; } } } //TODO: Add scrollbar to support more than 4 different colony ship designs _maxShips = _colonyShips.Count > 4 ? 4 : _colonyShips.Count; for (int i = 0; i < _maxShips; i++) { _shipButtons[i].SetText(_colonyShips[i].Name + (_colonizingFleet.Ships[_colonyShips[i]] > 1 ? " (" + _colonizingFleet.Ships[_colonyShips[i]] + ")" : string.Empty)); } _shipButtons[0].Selected = true; _systemNameLabel.SetText(_starSystem.Name); _systemNameLabel.MoveTo(_xPos + 300 - (int)(_systemNameLabel.GetWidth() / 2), _yPos + 130 - (int)(_systemNameLabel.GetHeight() / 2)); }
public override void MoveWindow() { base.MoveWindow(); _empireBackground.MoveTo(_xPos + 10, _yPos + 10); _empireNameLabel.MoveTo(_xPos + 150 - (int)(_empireNameLabel.GetWidth() / 2), _yPos + 30 - (int)(_empireNameLabel.GetHeight() / 2)); _previousFleet.MoveTo(_xPos + 18, _yPos + 22); _nextFleet.MoveTo(_xPos + 266, _yPos + 22); for (int i = 0; i < _shipBackground.Length; i++) { _shipBackground[i].MoveTo(_xPos + 10, _yPos + 55 + (i * 55)); _shipLabels[i].MoveTo(_xPos + 15, _yPos + 65 + (i * 55)); _shipSliders[i].MoveTo(_xPos + 15, _yPos + 85 + (i * 55)); } }
public override void MoveWindow() { base.MoveWindow(); _name.MoveTo(_xPos + 10, _yPos + 15); _terrainLabel.MoveTo(_xPos + 55, _yPos + 60); _popLabel.MoveTo(_xPos + 55, _yPos + 80); _infrastructureBackground.MoveTo(_xPos + 10, _yPos + 130); _researchBackground.MoveTo(_xPos + 10, _yPos + 190); _environmentBackground.MoveTo(_xPos + 10, _yPos + 250); _defenseBackground.MoveTo(_xPos + 10, _yPos + 310); _constructionProjectButton.MoveTo(_xPos + 10, _yPos + 370); _productionLabel.MoveTo(_xPos + 55, _yPos + 100); _infrastructureLabel.MoveTo(_xPos + 65, _yPos + 140); _infrastructureSlider.MoveTo(_xPos + 65, _yPos + 160); _infrastructureLockButton.MoveTo(_xPos + 267, _yPos + 160); _researchLabel.MoveTo(_xPos + 65, _yPos + 200); _researchSlider.MoveTo(_xPos + 65, _yPos + 220); _researchLockButton.MoveTo(_xPos + 267, _yPos + 220); _environmentLabel.MoveTo(_xPos + 65, _yPos + 260); _environmentSlider.MoveTo(_xPos + 65, _yPos + 280); _environmentLockButton.MoveTo(_xPos + 267, _yPos + 280); _defenseLabel.MoveTo(_xPos + 65, _yPos + 320); _defenseSlider.MoveTo(_xPos + 65, _yPos + 340); _defenseLockButton.MoveTo(_xPos + 267, _yPos + 340); _constructionLabel.MoveTo(_xPos + 65, _yPos + 380); _constructionSlider.MoveTo(_xPos + 65, _yPos + 400); _constructionLockButton.MoveTo(_xPos + 267, _yPos + 400); if (IsRelocating) { _relocateToButton.MoveTo(_xPos + 215, _yPos + 435); } else { _relocateToButton.MoveTo(_xPos + 130, _yPos + 435); } _transferToButton.MoveTo(_xPos + 215, _yPos + 435); }
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; }
public void MouseUp(int x, int y, int whichButton) { if (whichButton != 1) { return; } if (_generatingGalaxy) { return; } if (_showingSelection) { _raceSelection.MouseUp(x, y); return; } _playerEmperorName.MouseUp(x, y); _playerHomeworldName.MouseUp(x, y); _numericUpDownAI.MouseUp(x, y); _difficultyComboBox.MouseUp(x, y); if (_playerRaceDescription.MouseUp(x, y)) { return; } if (_galaxyComboBox.MouseUp(x, y)) { if (!_galaxyComboBox.Dropped) { //Update galaxy here _generatingGalaxy = true; _busyText.MoveTo((int)((_gameMain.ScreenWidth / 2) - (_busyText.GetWidth() / 2)), (int)((_gameMain.ScreenHeight / 2) - (_busyText.GetHeight() / 2))); _gameMain.Galaxy.OnGenerateComplete += OnGalaxyGenerated; string reason; if (!_gameMain.Galaxy.GenerateGalaxy((GALAXYTYPE)_galaxyComboBox.SelectedIndex, 1, 1, _gameMain.Random, out reason)) { _generatingGalaxy = false; } } } if (_playerRaceButton.MouseUp(x, y)) { _showingSelection = true; _raceSelection.SetCurrentPlayerInfo(0, _playerRaces[0], _playerColors[0]); } for (int i = 0; i < _numericUpDownAI.Value; i++) { if (_AIRaceButtons[i].MouseUp(x, y)) { _showingSelection = true; _raceSelection.SetCurrentPlayerInfo(i + 1, _playerRaces[i + 1], _playerColors[i + 1]); } } if (_cancelButton.MouseUp(x, y)) { _gameMain.ChangeToScreen(Screen.MainMenu); } if (_okButton.MouseUp(x, y)) { //See if the galaxy is generated. If not, generate it now, then proceed to player setup if (_gameMain.Galaxy.GetAllStars().Count == 0) { SetUpGalaxy(); } else { SetUpEmpiresAndStart(); } } }
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); }
public void LoadExploredSystem(StarSystem system) { _informationText.SetText(string.Format("{0} System has been explored", system.Name)); _informationText.MoveTo(_xPos + 200 - (int)(_informationText.GetWidth() / 2), _yPos + 50 - (int)(_informationText.GetHeight() / 2)); }
public void LoadSystem(StarSystem system, Empire currentEmpire) { _currentSystem = system; _currentEmpire = currentEmpire; if (_currentSystem.IsThisSystemExploredByEmpire(_currentEmpire)) { _isExplored = true; var planet = _currentSystem.Planets[0]; _name.SetText(_currentSystem.Name); _isOwnedSystem = _currentSystem.Planets[0].Owner == _currentEmpire; _name.SetTextAttributes(_currentSystem.Planets[0].Owner != null ? _currentSystem.Planets[0].Owner.EmpireColor : System.Drawing.Color.White, System.Drawing.Color.Empty); _popLabel.SetText(planet.Owner != null ? string.Format("{0:0.0}/{1:0} B", planet.TotalPopulation, planet.TotalMaxPopulation - planet.Waste) : string.Format("{0:0} B", planet.TotalMaxPopulation - planet.Waste)); _terrainLabel.SetText(Utility.PlanetTypeToString(_currentSystem.Planets[0].PlanetType)); if (_isOwnedSystem) { _name.SetReadOnly(false); _productionLabel.SetText(string.Format("{0:0.0} ({1:0.0}) Industry", _currentSystem.Planets[0].ActualProduction, _currentSystem.Planets[0].TotalProduction)); _infrastructureLabel.SetText(_currentSystem.Planets[0].InfrastructureStringOutput); _researchLabel.SetText(_currentSystem.Planets[0].ResearchStringOutput); _environmentLabel.SetText(_currentSystem.Planets[0].EnvironmentStringOutput); _defenseLabel.SetText(_currentSystem.Planets[0].DefenseStringOutput); _constructionLabel.SetText(_currentSystem.Planets[0].ConstructionStringOutput); _infrastructureSlider.TopIndex = planet.InfrastructureAmount; _researchSlider.TopIndex = planet.ResearchAmount; _environmentSlider.TopIndex = planet.EnvironmentAmount; _defenseSlider.TopIndex = planet.DefenseAmount; _constructionSlider.TopIndex = planet.ConstructionAmount; _infrastructureLockButton.Selected = planet.InfrastructureLocked; _infrastructureSlider.SetEnabledState(!planet.InfrastructureLocked); _researchLockButton.Selected = planet.ResearchLocked; _researchSlider.SetEnabledState(!planet.ResearchLocked); _environmentLockButton.Selected = planet.EnvironmentLocked; _environmentSlider.SetEnabledState(!planet.EnvironmentLocked); _defenseLockButton.Selected = planet.DefenseLocked; _defenseSlider.SetEnabledState(!planet.DefenseLocked); _constructionLockButton.Selected = planet.ConstructionLocked; _constructionSlider.SetEnabledState(!planet.ConstructionLocked); if (_currentSystem.Planets[0].TransferSystem.Key.StarSystem != null) { _transferLabel.SetText("Moving " + _currentSystem.Planets[0].TransferSystem.Value + " Pop"); _transferLabel.MoveTo(_xPos + 10, _yPos + 440); } else { _transferLabel.SetText(string.Empty); } } else if (_currentSystem.Planets[0].Owner != null) { _generalPurposeText.SetText("Colonized by " + _currentSystem.Planets[0].Owner.EmpireRace.RaceName + " Empire"); _name.SetReadOnly(true); } else { _generalPurposeText.SetText("No colony"); _name.SetReadOnly(true); } } else { _isExplored = false; _name.SetText("Unexplored"); _name.SetTextAttributes(System.Drawing.Color.White, System.Drawing.Color.Empty); _generalPurposeText.SetText(_currentSystem.Description); _popLabel.SetText(string.Empty); _terrainLabel.SetText(string.Empty); _productionLabel.SetText(string.Empty); _infrastructureLabel.SetText(string.Empty); _researchLabel.SetText(string.Empty); _environmentLabel.SetText(string.Empty); _defenseLabel.SetText(string.Empty); _constructionLabel.SetText(string.Empty); _name.SetReadOnly(true); } }