Beyond_Beyaan.Screens.WindowInterface.MouseHover C# (CSharp) Метод

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

public MouseHover ( int x, int y, float frameDeltaTime ) : bool
x int
y int
frameDeltaTime float
Результат bool
        public virtual bool MouseHover(int x, int y, float frameDeltaTime)
        {
            if (_moving)
            {
                _xPos = (x - _mouseX) + _origX;
                _yPos = (y - _mouseY) + _origY;

                if (_xPos + _windowWidth > _gameMain.ScreenWidth)
                {
                    _xPos = _gameMain.ScreenWidth - _windowWidth;
                }
                if (_yPos + _windowHeight > _gameMain.ScreenHeight)
                {
                    _yPos = _gameMain.ScreenHeight - _windowHeight;
                }
                if (_xPos < 0)
                {
                    _xPos = 0;
                }
                if (_yPos < 0)
                {
                    _yPos = 0;
                }
                MoveWindow();
                return true;
            }
            if (x >= _xPos && x < _xPos + _windowWidth && y >= _yPos && y < _yPos + _windowHeight)
            {
                //Don't want items behind this window to be highlighted
                return true;
            }
            return false;
        }

Usage Example

Пример #1
0
        public void Update(int x, int y, float frameDeltaTime)
        {
            _pathSprite.Update(frameDeltaTime, _gameMain.Random);
            _gameMain.Galaxy.Update(frameDeltaTime, _gameMain.Random);

            if (_taskBar.MouseHover(x, y, frameDeltaTime))
            {
                return;
            }
            if (_windowShowing != null)
            {
                _windowShowing.MouseHover(x, y, frameDeltaTime);
                return;
            }

            Empire currentEmpire = _gameMain.EmpireManager.CurrentEmpire;

            if (currentEmpire.SelectedSystem != null)
            {
                if (_systemView.MouseHover(x, y, frameDeltaTime))
                {
                    return;
                }
            }
            if (currentEmpire.SelectedFleetGroup != null)
            {
                if (_fleetView.MouseHover(x, y, frameDeltaTime))
                {
                    return;
                }
                if (currentEmpire.SelectedFleetGroup.SelectedFleet.Empire == currentEmpire)
                {
                    Point hoveringPoint = new Point();

                    hoveringPoint.X = (int)((x / _camera.ZoomDistance) + _camera.CameraX);
                    hoveringPoint.Y = (int)((y / _camera.ZoomDistance) + _camera.CameraY);

                    StarSystem selectedSystem = _gameMain.Galaxy.GetStarAtPoint(hoveringPoint);
                    currentEmpire.SelectedFleetGroup.FleetToSplit.SetTentativePath(selectedSystem, currentEmpire.SelectedFleetGroup.FleetToSplit.HasReserveTanks, _gameMain.Galaxy);
                    RefreshETAText();
                }
            }

            _camera.HandleUpdate(frameDeltaTime);
        }