예제 #1
0
        public void LoadDesigns()
        {
            _fleetManager = _gameMain.EmpireManager.CurrentEmpire.FleetManager;
            bool moreThanOneDesign = _fleetManager.CurrentDesigns.Count > 1;

            _maxVisible = _fleetManager.CurrentDesigns.Count;
            for (int i = 0; i < _maxVisible; i++)
            {
                if (i < _fleetManager.CurrentDesigns.Count)
                {
                    var shipDesign = _fleetManager.CurrentDesigns[i];
                    //_shipSprites[i] = currentEmpire.EmpireRace.GetShip(shipDesign.Size, shipDesign.WhichStyle);
                    _shipNameLabels[i].SetText(shipDesign.Name);
                    _scrapButtons[i].Active = moreThanOneDesign;
                    _beamDefValueLabels[i].SetText(shipDesign.BeamDefense.ToString());
                    _missileDefValueLabels[i].SetText(shipDesign.MissileDefense.ToString());
                    _attackLevelValueLabels[i].SetText(shipDesign.AttackLevel.ToString());
                    _hitPointsValueLabels[i].SetText(shipDesign.MaxHitPoints.ToString());
                    _shieldValueLabels[i].SetText(shipDesign.ShieldLevel.ToString());
                    _galaxySpeedValueLabels[i].SetText(shipDesign.GalaxySpeed.ToString());
                    _combatSpeedValueLabels[i].SetText(shipDesign.ManeuverSpeed.ToString());
                    _costValueLabels[i].SetText(string.Format("{0:0.0}", shipDesign.Cost));
                    int j = 0;
                    foreach (var weapon in shipDesign.Weapons)
                    {
                        if (weapon.Key != null)
                        {
                            _weaponLabels[i][j].SetText(string.Format("{0:00} {1}", weapon.Value, weapon.Key.DisplayName));
                        }
                        j++;
                    }
                    for (; j < 4; j++)
                    {
                        //Set the rest of unused weapon slots to blank
                        _weaponLabels[i][j].SetText(string.Empty);
                    }
                    for (j = 0; j < 3; j++)
                    {
                        if (shipDesign.Specials[j] != null)
                        {
                            _specialLabels[i][j].SetText(shipDesign.Specials[j].DisplayName);
                        }
                        else
                        {
                            _specialLabels[i][j].SetText(string.Empty);
                        }
                    }
                    _amountValueLabels[i].SetText(_fleetManager.GetShipCount(shipDesign).ToString());
                }
            }
        }
예제 #2
0
 public void LoadDesigns()
 {
     _fleetManager = _gameMain.EmpireManager.CurrentEmpire.FleetManager;
     bool moreThanOneDesign = _fleetManager.CurrentDesigns.Count > 1;
     _maxVisible = _fleetManager.CurrentDesigns.Count;
     for (int i = 0; i < _maxVisible; i++)
     {
         if (i < _fleetManager.CurrentDesigns.Count)
         {
             var shipDesign = _fleetManager.CurrentDesigns[i];
             //_shipSprites[i] = currentEmpire.EmpireRace.GetShip(shipDesign.Size, shipDesign.WhichStyle);
             _shipNameLabels[i].SetText(shipDesign.Name);
             _scrapButtons[i].Active = moreThanOneDesign;
             _beamDefValueLabels[i].SetText(shipDesign.BeamDefense.ToString());
             _missileDefValueLabels[i].SetText(shipDesign.MissileDefense.ToString());
             _attackLevelValueLabels[i].SetText(shipDesign.AttackLevel.ToString());
             _hitPointsValueLabels[i].SetText(shipDesign.MaxHitPoints.ToString());
             _shieldValueLabels[i].SetText(shipDesign.ShieldLevel.ToString());
             _galaxySpeedValueLabels[i].SetText(shipDesign.GalaxySpeed.ToString());
             _combatSpeedValueLabels[i].SetText(shipDesign.ManeuverSpeed.ToString());
             _costValueLabels[i].SetText(string.Format("{0:0.0}", shipDesign.Cost));
             int j = 0;
             foreach (var weapon in shipDesign.Weapons)
             {
                 if (weapon.Key != null)
                 {
                     _weaponLabels[i][j].SetText(string.Format("{0:00} {1}", weapon.Value, weapon.Key.DisplayName));
                 }
                 j++;
             }
             for (; j < 4; j++)
             {
                 //Set the rest of unused weapon slots to blank
                 _weaponLabels[i][j].SetText(string.Empty);
             }
             for (j = 0; j < 3; j++)
             {
                 if (shipDesign.Specials[j] != null)
                 {
                     _specialLabels[i][j].SetText(shipDesign.Specials[j].DisplayName);
                 }
                 else
                 {
                     _specialLabels[i][j].SetText(string.Empty);
                 }
             }
             _amountValueLabels[i].SetText(_fleetManager.GetShipCount(shipDesign).ToString());
         }
     }
 }