Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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();
        }