Exemplo n.º 1
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);
            }
        }