Example #1
0
        public void HandleMouseInput()
        {
            if ((isOpened == true || isEnlarged == true) && isMovingRight == false)
            {
                curMouseState = Mouse.GetState();

                if (panelRect.Contains(curMouseState.X, curMouseState.Y) == true)
                {
                    if (curMouseState.RightButton == ButtonState.Pressed && oldMouseState.RightButton == ButtonState.Released)
                    {
                        panelIsFocused = !panelIsFocused;
                    }
                }

                if (panelIsFocused == true)
                {
                    ActionScene ags = (ActionScene)Game.Services.GetService(typeof(ActionScene));
                    ags.blockControls();
                    this.controlsAreBlocked = false;
                    if (curMouseState.ScrollWheelValue < oldMouseState.ScrollWheelValue - 100)
                    {
                        curLevel--;
                    }
                    if (curMouseState.ScrollWheelValue > oldMouseState.ScrollWheelValue + 100)
                    {
                        curLevel++;
                    }
                    HandlemouseWheel();
                }
                else
                {
                    //reset controls
                    curLevel = vChessboard.CurrentLevel;
                    ActionScene ags = (ActionScene)Game.Services.GetService(typeof(ActionScene));
                    ags.unblockControls();
                    for (short y = 0; y < 8; y++)
                    {
                        vChessboard.SetPlaneVisibility(y, true);
                    }
                }
                oldMouseState = curMouseState;
            }
        }