Beyond_Beyaan.Screens.RaceSelection.MouseUp C# (CSharp) Метод

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

public MouseUp ( int x, int y ) : bool
x int
y int
Результат bool
        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);
        }

Usage Example

Пример #1
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();
         }
     }
 }