Ejemplo n.º 1
0
        public override void HandleInput(InputState inputState, bool isTopMost, ScreenManager screenManager)
        {
            if (!Enabled)
            {
                currentState = "disabled";
                return;
            }

            if (inputState.IsMouseInRectangle(Bounds))
            {
                //2-按下,1-经过
                currentState = inputState.IsMouseLeftButtonPressed(Bounds) ? "pressed" : "hover";

                //松开按键时立刻引发事件
                if (inputState.IsNewMouseLeftButtonReleased(Bounds))
                {
                    if (OnClick != null) OnClick(this);
                }
            }
            else
            {
                //通常
                currentState = "normal";
            }

            base.HandleInput(inputState, isTopMost, screenManager);
        }
Ejemplo n.º 2
0
        public override void HandleInput(InputState inputState, bool isTopMost, ScreenManager screenManager)
        {
            if (!Enabled) return;

            if (!canInterrupt) return;
            if (!inputState.IsNewMouseLeftButtonReleased(Bounds)) return;

            // we only handle Mouse1
            if (status == TransitionStatus.TransitioningIn) transitionPosition = 1;
            else if (status == TransitionStatus.Shown) status = TransitionStatus.TransitioningOut;
            else if (status == TransitionStatus.TransitioningOut) transitionPosition = 0;

            base.HandleInput(inputState, isTopMost, screenManager);
        }
Ejemplo n.º 3
0
        public override void HandleInput(InputState inputState, bool isTopMost, ScreenManager screenManager)
        {
            hovering = inputState.IsMouseInRectangle(thumbRectangle);

            // 单击
            if (inputState.IsMouseLeftButtonPressed(Bounds) || inputState.IsNewMouseLeftButtonReleased(Bounds))
            {
                if (MoveThumbTo(new Point(inputState.CurrentMouseState.X, inputState.CurrentMouseState.Y)))
                    if (OnDrag != null)
                        OnDrag(this);
            }

            base.HandleInput(inputState, isTopMost, screenManager);
        }
Ejemplo n.º 4
0
 public virtual void HandleInput(InputState inputState, bool isTopMost, ScreenManager screenManager)
 {
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Handle input
 /// </summary>
 public virtual void HandleInput(InputState inputState)
 {
     for (int i = 0; i < controls.Count; i++)
     {
         controls[i].HandleInput(inputState, i == 0, ScreenManager);
     }
 }