private void RefreshETAText() { var currentEmpire = _gameMain.EmpireManager.CurrentEmpire; //Update the ETAs if (currentEmpire.SelectedFleetGroup.SelectedFleet.Empire == currentEmpire) { if (currentEmpire.SelectedFleetGroup.FleetToSplit.TentativeNodes != null) { if ( currentEmpire.SelectedFleetGroup.FleetToSplit.TentativeNodes[ currentEmpire.SelectedFleetGroup.FleetToSplit.TentativeNodes.Count - 1].IsValid) { _tentativeETA.SetText("ETA: " + currentEmpire.SelectedFleetGroup.FleetToSplit.TentativeETA); } else { _tentativeETA.SetText("Out of range"); } } if (currentEmpire.SelectedFleetGroup.SelectedFleet.Empire == currentEmpire) { _travelETA.SetText("ETA: " + currentEmpire.SelectedFleetGroup.SelectedFleet.TravelETA); } } else { _travelETA.SetText("ETA: " + currentEmpire.SelectedFleetGroup.SelectedFleet.TravelToFirstNodeETA); } }
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)); }
private void RefreshTransfer() { var currentEmpire = _gameMain.EmpireManager.CurrentEmpire; float amount = currentEmpire.Reserves; if (amount <= 0.0001) { _transferAmount.SetText("0.0 BC"); _transferSlider.SetEnabledState(false); _transferReserves.Enabled = false; } else { float percentage = _transferSlider.TopIndex / 200.0f; amount *= percentage; _transferAmount.SetText(string.Format("{0:0.0} BC", amount)); _transferSlider.SetEnabledState(true); _transferReserves.Enabled = true; } }
private void RefreshReserves() { var currentEmpire = _gameMain.EmpireManager.CurrentEmpire; _reservesAmount.SetText(currentEmpire.TaxRate == 0 ? string.Format("{0:0.0} BC", currentEmpire.Reserves) : string.Format("{0:0.0} (+{1:0.0}) BC", currentEmpire.Reserves, currentEmpire.TaxExpenses / 2)); var planets = currentEmpire.PlanetManager.Planets; for (int i = 0; i < _maxVisible; i++) { _columnCells[5][i + _scrollBar.TopIndex].SetText(((int)planets[i].ActualProduction).ToString()); } }
public void LoadScreen() { var currentEmpire = _gameMain.EmpireManager.CurrentEmpire; _fleetManager = currentEmpire.FleetManager; var fleets = _fleetManager.GetFleets(); int i; for (i = 0; i < _fleetManager.CurrentDesigns.Count; i++) { _shipNames[i].SetText(_fleetManager.CurrentDesigns[i].Name); _shipNames[i].Enabled = true; if (_fleetManager.CurrentDesigns.Count > 1) { _scrapButtons[i].Active = true; } else { //Only one ship design left _scrapButtons[i].Active = false; } } for (; i < 6; i++) { _shipNames[i].SetText(string.Empty); _shipNames[i].Enabled = false; _scrapButtons[i].Active = false; } _scrollBar.TopIndex = 0; if (fleets.Count > 10) { _maxVisible = 10; _scrollBar.SetEnabledState(true); _scrollBar.SetAmountOfItems(fleets.Count); } else { _maxVisible = fleets.Count; _scrollBar.SetEnabledState(false); _scrollBar.SetAmountOfItems(10); } _maintenanceAmountLabel.SetText(string.Format("{0:0.0} BC", currentEmpire.ShipMaintenance)); Refresh(); }
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 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); } }
private void RefreshFields() { var currentEmpire = _gameMain.EmpireManager.CurrentEmpire; _totalResearchPointsLabel.SetText(string.Format("Total Research Points: {0:0.00}", currentEmpire.ResearchPoints)); if (currentEmpire.TechnologyManager.WhichComputerBeingResearched != null) { _techNamesBeingResearchedLabels[0].SetText(currentEmpire.TechnologyManager.WhichComputerBeingResearched.TechName); } else { _techNamesBeingResearchedLabels[0].SetText("None"); } if (currentEmpire.TechnologyManager.WhichConstructionBeingResearched != null) { _techNamesBeingResearchedLabels[1].SetText(currentEmpire.TechnologyManager.WhichConstructionBeingResearched.TechName); } else { _techNamesBeingResearchedLabels[1].SetText("None"); } if (currentEmpire.TechnologyManager.WhichForceFieldBeingResearched != null) { _techNamesBeingResearchedLabels[2].SetText(currentEmpire.TechnologyManager.WhichForceFieldBeingResearched.TechName); } else { _techNamesBeingResearchedLabels[2].SetText("None"); } if (currentEmpire.TechnologyManager.WhichPlanetologyBeingResearched != null) { _techNamesBeingResearchedLabels[3].SetText(currentEmpire.TechnologyManager.WhichPlanetologyBeingResearched.TechName); } else { _techNamesBeingResearchedLabels[3].SetText("None"); } if (currentEmpire.TechnologyManager.WhichPropulsionBeingResearched != null) { _techNamesBeingResearchedLabels[4].SetText(currentEmpire.TechnologyManager.WhichPropulsionBeingResearched.TechName); } else { _techNamesBeingResearchedLabels[4].SetText("None"); } if (currentEmpire.TechnologyManager.WhichWeaponBeingResearched != null) { _techNamesBeingResearchedLabels[5].SetText(currentEmpire.TechnologyManager.WhichWeaponBeingResearched.TechName); } else { _techNamesBeingResearchedLabels[5].SetText("None"); } RefreshSliders(); RefreshProgressLabels(); RefreshLockedStatus(); RefreshResearchedTechs(TechField.COMPUTER); }
private void RefreshFleet() { _empireNameLabel.SetText(string.Format("{0} Fleet", _selectedFleet.Empire.EmpireRace.RaceName)); _empireNameLabel.MoveTo(_xPos + 150 - (int)(_empireNameLabel.GetWidth() / 2), _yPos + 30 - (int)(_empireNameLabel.GetHeight() / 2)); }