Beispiel #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);
        }
Beispiel #2
0
 public override bool MouseUp(int x, int y)
 {
     if (_okButton.MouseUp(x, y))
     {
         if (OnOkClick != null)
         {
             OnOkClick(_whichPlayerSelecting, _whichRaceSelected);
             return(true);
         }
     }
     if (_raceDescription.MouseUp(x, y))
     {
         return(true);
     }
     for (int i = 0; i < _maxVisible; i++)
     {
         if (_raceButtons[i].MouseUp(x, y))
         {
             if (_raceButtons[i].DoubleClicked)
             {
                 if (OnOkClick != null)
                 {
                     OnOkClick(_whichPlayerSelecting, _whichRaceSelected);
                     return(true);
                 }
             }
             if (i == 0 && _raceScrollBar.TopIndex == 0)
             {
                 _whichRaceSelected = null;
             }
             else
             {
                 _whichRaceSelected = _raceManager.Races[i + _raceScrollBar.TopIndex - 1];
             }
             RefreshRaceDescription();
             RefreshRaceLabels();
             return(true);
         }
     }
     return(base.MouseUp(x, y));
 }
Beispiel #3
0
 public void MouseUp(int x, int y, int whichButton)
 {
     if (whichButton != 1)
     {
         return;
     }
     if (_generatingGalaxy)
     {
         return;
     }
     if (_showingSelection)
     {
         _raceSelection.MouseUp(x, y);
         return;
     }
     _playerEmperorName.MouseUp(x, y);
     _playerHomeworldName.MouseUp(x, y);
     _numericUpDownAI.MouseUp(x, y);
     _difficultyComboBox.MouseUp(x, y);
     if (_playerRaceDescription.MouseUp(x, y))
     {
         return;
     }
     if (_galaxyComboBox.MouseUp(x, y))
     {
         if (!_galaxyComboBox.Dropped)
         {
             //Update galaxy here
             _generatingGalaxy = true;
             _busyText.MoveTo((int)((_gameMain.ScreenWidth / 2) - (_busyText.GetWidth() / 2)), (int)((_gameMain.ScreenHeight / 2) - (_busyText.GetHeight() / 2)));
             _gameMain.Galaxy.OnGenerateComplete += OnGalaxyGenerated;
             string reason;
             if (!_gameMain.Galaxy.GenerateGalaxy((GALAXYTYPE)_galaxyComboBox.SelectedIndex, 1, 1, _gameMain.Random, out reason))
             {
                 _generatingGalaxy = false;
             }
         }
     }
     if (_playerRaceButton.MouseUp(x, y))
     {
         _showingSelection = true;
         _raceSelection.SetCurrentPlayerInfo(0, _playerRaces[0], _playerColors[0]);
     }
     for (int i = 0; i < _numericUpDownAI.Value; i++)
     {
         if (_AIRaceButtons[i].MouseUp(x, y))
         {
             _showingSelection = true;
             _raceSelection.SetCurrentPlayerInfo(i + 1, _playerRaces[i + 1], _playerColors[i + 1]);
         }
     }
     if (_cancelButton.MouseUp(x, y))
     {
         _gameMain.ChangeToScreen(Screen.MainMenu);
     }
     if (_okButton.MouseUp(x, y))
     {
         //See if the galaxy is generated.  If not, generate it now, then proceed to player setup
         if (_gameMain.Galaxy.GetAllStars().Count == 0)
         {
             SetUpGalaxy();
         }
         else
         {
             SetUpEmpiresAndStart();
         }
     }
 }
Beispiel #4
0
        public override bool MouseUp(int x, int y)
        {
            int left = (_gameMain.ScreenWidth / 2) - 513;
            int top  = (_gameMain.ScreenHeight / 2) - 250;

            if (x >= left && x < left + 1010 && y >= top && y < top + 390)
            {
                //When clicking a column, that entire row is clicked
                for (int i = 0; i < _maxVisible; i++)
                {
                    _columnCells[0][i].MouseUp(left + 1, y);
                    _columnCells[1][i].MouseUp(left + 281, y);
                    _columnCells[2][i].MouseUp(left + 371, y);
                    _columnCells[3][i].MouseUp(left + 461, y);
                    _columnCells[4][i].MouseUp(left + 541, y);
                    _columnCells[5][i].MouseUp(left + 621, y);
                    _columnCells[6][i].MouseUp(left + 701, y);
                    if (_columnCells[7][i].MouseUp(left + 951, y))
                    {
                        if (_columnCells[7][i].DoubleClicked)
                        {
                            if (CenterToSystem != null)
                            {
                                CenterToSystem(
                                    _gameMain.EmpireManager.CurrentEmpire.PlanetManager.Planets[_selectedRow].System);
                            }
                        }
                        else
                        {
                            _selectedRow = i + _scrollBar.TopIndex;
                            RefreshSelection();
                        }
                    }
                }
            }
            if (_reserveSlider.MouseUp(x, y))
            {
                _gameMain.EmpireManager.CurrentEmpire.TaxRate = _reserveSlider.TopIndex;
                RefreshReserves();
                return(true);
            }
            if (_transferSlider.MouseUp(x, y))
            {
                RefreshTransfer();
                return(true);
            }
            if (_transferReserves.MouseUp(x, y))
            {
                var   empire = _gameMain.EmpireManager.CurrentEmpire;
                var   planet = empire.PlanetManager.Planets[_selectedRow];
                float amount = empire.Reserves * (_transferSlider.TopIndex / 200.0f);
                planet.Reserves         += amount;
                empire.Reserves         -= amount;
                _transferSlider.TopIndex = 0;
                RefreshReserves();
                RefreshTransfer();
                return(true);
            }
            if (!base.MouseUp(x, y))
            {
                if (CloseWindow != null)
                {
                    CloseWindow();
                    return(true);
                }
            }
            return(false);
        }
Beispiel #5
0
 public override bool MouseUp(int x, int y)
 {
     if (!_isOwnedSystem)
     {
         return(base.MouseUp(x, y));
     }
     if (IsTransferring)
     {
         if (_popTransferSlider.MouseUp(x, y))
         {
             _transferLabel.SetText("Moving " + _popTransferSlider.TopIndex + " Population");
             return(true);
         }
         if (_transferToButton.MouseUp(x, y))
         {
             if (TransferSystem != null && TransferSystem.IsValid)
             {
                 if (TransferSystem.StarSystem == _currentSystem)
                 {
                     _currentSystem.Planets[0].TransferSystem = new KeyValuePair <TravelNode, int>(new TravelNode(), 0);
                 }
                 else
                 {
                     _currentSystem.Planets[0].TransferSystem = new KeyValuePair <TravelNode, int>(TransferSystem, _popTransferSlider.TopIndex);
                 }
                 _transferLabel.SetText("Moving " + _currentSystem.Planets[0].TransferSystem.Value + " Pop");
                 _transferLabel.MoveTo(_xPos + 10, _yPos + 440);
                 TransferSystem = null;
                 //Done setting transfer
             }
             IsTransferring = false;
             return(true);
         }
     }
     if (IsRelocating)
     {
         if (_relocateToButton.MouseUp(x, y))
         {
             if (RelocateSystem.IsValid)
             {
                 _currentSystem.Planets[0].RelocateToSystem = RelocateSystem;
                 IsRelocating   = false;
                 RelocateSystem = null;
             }
         }
     }
     if (_name.MouseUp(x, y))
     {
         return(true);
     }
     if (_infrastructureSlider.MouseUp(x, y))
     {
         _currentSystem.Planets[0].SetOutputAmount(OUTPUT_TYPE.INFRASTRUCTURE, _infrastructureSlider.TopIndex, false);
         Refresh();
         return(true);
     }
     if (_researchSlider.MouseUp(x, y))
     {
         _currentSystem.Planets[0].SetOutputAmount(OUTPUT_TYPE.RESEARCH, _researchSlider.TopIndex, false);
         Refresh();
         return(true);
     }
     if (_environmentSlider.MouseUp(x, y))
     {
         _currentSystem.Planets[0].SetOutputAmount(OUTPUT_TYPE.ENVIRONMENT, _environmentSlider.TopIndex, false);
         Refresh();
         return(true);
     }
     if (_defenseSlider.MouseUp(x, y))
     {
         _currentSystem.Planets[0].SetOutputAmount(OUTPUT_TYPE.DEFENSE, _defenseSlider.TopIndex, false);
         Refresh();
         return(true);
     }
     if (_constructionSlider.MouseUp(x, y))
     {
         _currentSystem.Planets[0].SetOutputAmount(OUTPUT_TYPE.CONSTRUCTION, _constructionSlider.TopIndex, false);
         Refresh();
         return(true);
     }
     if (_infrastructureLockButton.MouseUp(x, y))
     {
         _currentSystem.Planets[0].InfrastructureLocked = !_currentSystem.Planets[0].InfrastructureLocked;
         _infrastructureSlider.SetEnabledState(!_currentSystem.Planets[0].InfrastructureLocked);
         _infrastructureLockButton.Selected = _currentSystem.Planets[0].InfrastructureLocked;
         return(true);
     }
     if (_researchLockButton.MouseUp(x, y))
     {
         _currentSystem.Planets[0].ResearchLocked = !_currentSystem.Planets[0].ResearchLocked;
         _researchSlider.SetEnabledState(!_currentSystem.Planets[0].ResearchLocked);
         _researchLockButton.Selected = _currentSystem.Planets[0].ResearchLocked;
         return(true);
     }
     if (_environmentLockButton.MouseUp(x, y))
     {
         _currentSystem.Planets[0].EnvironmentLocked = !_currentSystem.Planets[0].EnvironmentLocked;
         _environmentSlider.SetEnabledState(!_currentSystem.Planets[0].EnvironmentLocked);
         _environmentLockButton.Selected = _currentSystem.Planets[0].EnvironmentLocked;
         return(true);
     }
     if (_defenseLockButton.MouseUp(x, y))
     {
         _currentSystem.Planets[0].DefenseLocked = !_currentSystem.Planets[0].DefenseLocked;
         _defenseSlider.SetEnabledState(!_currentSystem.Planets[0].DefenseLocked);
         _defenseLockButton.Selected = _currentSystem.Planets[0].DefenseLocked;
         return(true);
     }
     if (_constructionLockButton.MouseUp(x, y))
     {
         _currentSystem.Planets[0].ConstructionLocked = !_currentSystem.Planets[0].ConstructionLocked;
         _constructionSlider.SetEnabledState(!_currentSystem.Planets[0].ConstructionLocked);
         _constructionLockButton.Selected = _currentSystem.Planets[0].ConstructionLocked;
         return(true);
     }
     if (_relocateToButton.MouseUp(x, y))
     {
         IsRelocating = true;
         _generalPurposeText.SetText("Select a friendly system to send newly built ships");
         _relocateToButton.Active = false;
         return(true);
     }
     if (_transferToButton.MouseUp(x, y))
     {
         IsTransferring = true;
         _transferLabel.MoveTo(_xPos + 20, _yPos + 370);
         _transferLabel.SetText("Moving 0 Population");
         _popTransferSlider.SetAmountOfItems((int)(_currentSystem.Planets[0].TotalPopulation / 2));
         _generalPurposeText.SetText("Select a colonized planet to send population");
         return(true);
     }
     if (_constructionProjectButton.MouseUp(x, y))
     {
         _currentSystem.Planets[0].ShipBeingBuilt = _currentEmpire.FleetManager.GetNextShipDesign(_currentSystem.Planets[0].ShipBeingBuilt);
         Refresh();
     }
     return(base.MouseUp(x, y));
 }