示例#1
0
        public override bool HandleTouch(Touch.Action action, Touch touch)
        {
            if (action != Touch.Action.Move)
            {
                pressed = action == Touch.Action.Begin || action == Touch.Action.Enter;
                IsDirty = true;
            }

            return(base.HandleTouch(action, touch));
        }
示例#2
0
        public override bool HandleTouch(Touch.Action action, Touch touch)
        {
            if (!Visible)
            {
                return(false);
            }

            if (timeLeft > 1 && action == Touch.Action.Begin)
            {
                timeLeft -= .5f;
            }

            return(true);
        }
示例#3
0
 public override UpdateAction Update(Touch.Action action, Touch touch)
 {
     if (action == Touch.Action.Begin)
     {
         if (Box.Collides(touch.RelativePosition))
         {
             return(UpdateAction.Complete);
         }
         else
         {
             return(UpdateAction.Miss);
         }
     }
     return(UpdateAction.Ignore);
 }
示例#4
0
        public virtual bool HandleTouch(Touch.Action action, Touch touch)
        {
            if (!Visible)
            {
                return(false);
            }
            switch (action)
            {
            case Touch.Action.Begin:
            case Touch.Action.Enter:
                if (!Clicked || multiClick)
                {
                    clickCount++;
                    Click?.Invoke( );
                }
                break;

            case Touch.Action.End:
                if (Clicked)
                {
                    clickCount--;
                    if (!Clicked)
                    {
                        Release?.Invoke( );
                    }
                }
                break;

            case Touch.Action.Leave:
                if (Clicked)
                {
                    clickCount--;
                    if (!Clicked)
                    {
                        Leave?.Invoke( );
                    }
                }
                break;
            }
            return(true);
        }
示例#5
0
        public override bool HandleTouch(Touch.Action action, Touch touch)
        {
            if (active)
            {
                switch (challenges[0].Update(action, touch))
                {
                case UpdateAction.Complete:
                    hitCallback?.Invoke(true, challenges[0].Type);
                    UpdateTarget( );
                    break;

                case UpdateAction.Ignore:
                    break;

                case UpdateAction.Miss:
                    hitCallback?.Invoke(false, challenges[0].Type);
                    break;
                }
            }
            return(true);
        }
示例#6
0
        public override UpdateAction Update(Touch.Action action, Touch touch)
        {
            switch (action)
            {
            case Touch.Action.Begin:
                if (_ScorerBox.Collides(touch.RelativePosition))
                {
                    dragOffset = _ScorerBox.Position - touch.RelativePosition;
                    dragging   = true;
                    IsDirty    = true;
                    return(UpdateAction.Ignore);
                }
                else
                {
                    return(UpdateAction.Miss);
                }

            case Touch.Action.Move:
                if (dragging)
                {
                    _ScorerBox.Position = touch.RelativePosition + dragOffset;
                    IsDirty             = true;
                    Vector2 diff = _GoalBox.Position - _ScorerBox.Position + sizeDiff;
                    _ScorerBox.Rotation = (float)Math.Atan2(diff.Y, diff.X) * 180 / Mathf.PI - 90;
                    if (diff.X * diff.X + diff.Y * diff.Y < collisionThreshold)
                    {
                        return(UpdateAction.Complete);
                    }
                }
                return(UpdateAction.Ignore);

            case Touch.Action.End:
                dragging = false;
                IsDirty  = true;
                return(UpdateAction.Ignore);
            }
            return(UpdateAction.Ignore);
        }
示例#7
0
 public override bool HandleTouch(Touch.Action action, Touch touch)
 {
     return(false);
 }
示例#8
0
 public abstract UpdateAction Update(Touch.Action action, Touch touch);