コード例 #1
0
ファイル: Panel2D.cs プロジェクト: samibader/3DChess
        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;
            }
        }