Beyond_Beyaan.Screens.FleetSpecsWindow.LoadDesigns C# (CSharp) Метод

LoadDesigns() публичный Метод

public LoadDesigns ( ) : void
Результат void
        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());
                }
            }
        }

Usage Example

Пример #1
0
        public override bool MouseUp(int x, int y)
        {
            if (_fleetSpecsShowing)
            {
                if (!_fleetSpecsWindow.MouseUp(x, y))
                {
                    _fleetSpecsShowing = false;
                    LoadScreen();
                }
                return(true);
            }
            for (int i = 0; i < _maxVisible; i++)
            {
                if (_planetBackgrounds[i].MouseUp(x, y))
                {
                    SelectFleet(_fleetManager.GetFleets()[i + _scrollBar.TopIndex]);
                    return(true);
                }
            }

            for (int i = 0; i < 6; i++)
            {
                if (_scrapButtons[i].MouseUp(x, y))
                {
                    _gameMain.EmpireManager.CurrentEmpire.FleetManager.ObsoleteShipDesign(_gameMain.EmpireManager.CurrentEmpire.FleetManager.CurrentDesigns[i]);
                    LoadScreen();
                }
            }
            if (_viewSpecsButton.MouseUp(x, y))
            {
                _fleetSpecsShowing = true;
                _fleetSpecsWindow.LoadDesigns();
            }

            if (!base.MouseUp(x, y))
            {
                if (CloseWindow != null)
                {
                    CloseWindow();
                }
                return(true);
            }
            return(false);
        }