public override bool MouseUp(int x, int y) { if (_techDescription.MouseUp(x, y)) { return(true); } for (int i = 0; i < _maxVisible; i++) { if (_availableTechsToResearchButtons[i].MouseUp(x, y)) { switch (_currentTechField) { case TechField.COMPUTER: _currentEmpire.TechnologyManager.WhichComputerBeingResearched = _availableTopics[_currentTechField][i + _scrollBar.TopIndex]; break; case TechField.CONSTRUCTION: _currentEmpire.TechnologyManager.WhichConstructionBeingResearched = _availableTopics[_currentTechField][i + _scrollBar.TopIndex]; break; case TechField.FORCE_FIELD: _currentEmpire.TechnologyManager.WhichForceFieldBeingResearched = _availableTopics[_currentTechField][i + _scrollBar.TopIndex]; break; case TechField.PLANETOLOGY: _currentEmpire.TechnologyManager.WhichPlanetologyBeingResearched = _availableTopics[_currentTechField][i + _scrollBar.TopIndex]; break; case TechField.PROPULSION: _currentEmpire.TechnologyManager.WhichPropulsionBeingResearched = _availableTopics[_currentTechField][i + _scrollBar.TopIndex]; break; case TechField.WEAPON: _currentEmpire.TechnologyManager.WhichWeaponBeingResearched = _availableTopics[_currentTechField][i + _scrollBar.TopIndex]; break; } _availableTopics.Remove(_currentTechField); if (_availableTopics.Count > 0) { LoadNextTech(); } else if (Completed != null) { Completed(); } return(true); } } if (_scrollBar.MouseUp(x, y)) { RefreshTechButtons(); return(true); } return(false); }
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)); }
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(); } } }