Esempio n. 1
0
 private void RefreshRaceDescription()
 {
     if (_whichRaceSelected == null)
     {
         _raceDescription.SetText("A random race will be selected.");
     }
     else
     {
         _raceDescription.SetText(_whichRaceSelected.RaceDescription);
     }
 }
Esempio n. 2
0
        private void RefreshResearchedTechs(TechField whichField)
        {
            for (int i = 0; i < _techFieldButtons.Length; i++)
            {
                _techFieldButtons[i].Selected = false;
            }
            string            techDescriptions = string.Empty;
            List <Technology> researchedTechs  = new List <Technology>();

            switch (whichField)
            {
            case TechField.COMPUTER:
            {
                _techFieldButtons[0].Selected = true;
                researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedComputerTechs;
            } break;

            case TechField.CONSTRUCTION:
            {
                _techFieldButtons[1].Selected = true;
                researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedConstructionTechs;
            } break;

            case TechField.FORCE_FIELD:
            {
                _techFieldButtons[2].Selected = true;
                researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedForceFieldTechs;
            } break;

            case TechField.PLANETOLOGY:
            {
                _techFieldButtons[3].Selected = true;
                researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedPlanetologyTechs;
            } break;

            case TechField.PROPULSION:
            {
                _techFieldButtons[4].Selected = true;
                researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedPropulsionTechs;
            } break;

            case TechField.WEAPON:
            {
                _techFieldButtons[5].Selected = true;
                researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedWeaponTechs;
            } break;
            }
            foreach (var researchedTech in researchedTechs)
            {
                techDescriptions += researchedTech.TechName + " -\r\n" + researchedTech.TechDescription + "\r\n\r\n\r\n";
            }
            _researchedTechnologyDescriptions.SetText(techDescriptions);
            _researchedTechnologyDescriptions.ScrollToBottom();
        }
Esempio n. 3
0
 private void OnRaceSelectionOKClick(int whichPlayer, Race whichRace)
 {
     _showingSelection = false;
     for (int i = 0; i < _playerRaces.Length; i++)
     {
         if (i != whichPlayer && _playerRaces[i] == whichRace)
         {
             _playerRaces[i] = null;
             _raceSprites[i] = _randomRaceSprite;
             if (i == 0)
             {
                 _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.");
             }
             break;
         }
     }
     _playerRaces[whichPlayer] = whichRace;
     if (whichRace == null)
     {
         _raceSprites[whichPlayer] = _randomRaceSprite;
     }
     else
     {
         _raceSprites[whichPlayer] = whichRace.MiniAvatar;
     }
     if (whichPlayer == 0)
     {
         if (whichRace == null)
         {
             _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.");
         }
         else
         {
             _playerRaceDescription.SetText(whichRace.RaceDescription);
         }
     }
 }
Esempio n. 4
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;
        }
Esempio n. 5
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);
        }
Esempio n. 6
0
        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);
            }
        }
Esempio n. 7
0
 private void LoadNextTech()
 {
     //Go in order from Computer, Construction, Force Field, Planetology, Propulsion, to Weapon
     if (_availableTopics.ContainsKey(TechField.COMPUTER))
     {
         _currentTechField = TechField.COMPUTER;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedComputerTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Computer technologies help with increasing number of factories, better scanners, improving your attack and missile defense on ships, and spying efforts benefits from higher computer tech level.");
         }
     }
     else if (_availableTopics.ContainsKey(TechField.CONSTRUCTION))
     {
         _currentTechField = TechField.CONSTRUCTION;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedConstructionTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Construction technologies gives you better armor, cheaper factories, reduced pollution, and higher construction tech levels gives you more room on ships.");
         }
     }
     else if (_availableTopics.ContainsKey(TechField.FORCE_FIELD))
     {
         _currentTechField = TechField.FORCE_FIELD;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedForceFieldTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Force field technologies gives you better shields, as well as planetary shields and nifty special items.");
         }
     }
     else if (_availableTopics.ContainsKey(TechField.PLANETOLOGY))
     {
         _currentTechField = TechField.PLANETOLOGY;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedPlanetologyTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Planetology technologies gives you terraforming and bigger planets, cheaper pollution cleanup, as well as expanding the number of planets you can colonize.  Also includes biological warfare.");
         }
     }
     else if (_availableTopics.ContainsKey(TechField.PROPULSION))
     {
         _currentTechField = TechField.PROPULSION;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedPropulsionTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Propulsion technologies gives you faster engines, expanded range, and powerful special equipment.");
         }
     }
     else if (_availableTopics.ContainsKey(TechField.WEAPON))
     {
         _currentTechField = TechField.WEAPON;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedWeaponTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Weapon technologies gives you weapons. A lot of weapons.");
         }
     }
     if (_availableTopics[_currentTechField].Count > 0)
     {
         if (_availableTopics[_currentTechField].Count > _availableTechsToResearchButtons.Length)
         {
             _maxVisible = _availableTechsToResearchButtons.Length;
             _scrollBar.SetEnabledState(true);
             _scrollBar.SetAmountOfItems(_availableTopics[_currentTechField].Count);
         }
         else
         {
             _maxVisible = _availableTopics[_currentTechField].Count;
             _scrollBar.SetAmountOfItems(_availableTechsToResearchButtons.Length);
             _scrollBar.SetEnabledState(false);
         }
         RefreshTechButtons();
     }
 }