当前位置: 首页>>代码示例>>C#>>正文


C# FingerGestures类代码示例

本文整理汇总了C#中FingerGestures的典型用法代码示例。如果您正苦于以下问题:C# FingerGestures类的具体用法?C# FingerGestures怎么用?C# FingerGestures使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FingerGestures类属于命名空间,在下文中一共展示了FingerGestures类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSwipeDirectionVector

    public static Vector3 GetSwipeDirectionVector( FingerGestures.SwipeDirection direction )
    {
        switch( direction )
        {
            case FingerGestures.SwipeDirection.Up:
                return Vector3.up;

            case FingerGestures.SwipeDirection.UpperRightDiagonal:
                return 0.5f * ( Vector3.up + Vector3.right );

            case FingerGestures.SwipeDirection.Right:
                return Vector3.right;

            case FingerGestures.SwipeDirection.LowerRightDiagonal:
                return 0.5f * ( Vector3.down + Vector3.right );

            case FingerGestures.SwipeDirection.Down:
                return Vector3.down;

            case FingerGestures.SwipeDirection.LowerLeftDiagonal:
                return 0.5f * ( Vector3.down + Vector3.left );

            case FingerGestures.SwipeDirection.Left:
                return Vector3.left;

            case FingerGestures.SwipeDirection.UpperLeftDiagonal:
                return 0.5f * ( Vector3.up + Vector3.left );
        }

        Debug.LogError( "Unhandled swipe direction: " + direction );
        return Vector3.zero;
    }
开发者ID:SpiritWolf2015,项目名称:DragObj,代码行数:32,代码来源:SwipeParticlesEmitter.cs

示例2: CanBegin

        public override bool CanBegin(Gesture gesture, FingerGestures.IFingerList touches)
        {
            //Debug.Log(
            //    UnityUtils.WithTimestamp("Check if tap for " + this.AnimationName + " can begin: " + gesture + ", touches: " + touches.Count), this);

            if (this.animation == null || !this.animation.IsPlaying(this.AnimationName))
            {
                return false;
            }

            // Just allow tap when touch just began.
            if (touches[0].Phase != FingerGestures.FingerPhase.Begin)
            {
                return false;
            }

            // Check if tap started after threshold.
            AnimationState animationState = this.animation[this.AnimationName];
            if (animationState.time < this.Threshold)
            {
                return false;
            }

            return true;
        }
开发者ID:jixiang111,项目名称:slash-framework,代码行数:25,代码来源:FinishAnimationOnTapBehaviour.cs

示例3: FingerGestures_OnFingerSwipe

 // spin the yellow cube when swipping it
 void FingerGestures_OnFingerSwipe( int fingerIndex, Vector2 startPos, FingerGestures.SwipeDirection direction, float velocity )
 {
     if(direction== FingerGestures.SwipeDirection.Up)
     {
         GameManager.instance.CurrentBlock.RotateBlock();
     }
 }
开发者ID:unigame,项目名称:Unity3Dtetris,代码行数:8,代码来源:TouchScreenGestures.cs

示例4: OnActive

    protected override GestureState OnActive( FingerGestures.IFingerList touches )
    {
        float motion = Input.GetAxis( axis );

        if( Mathf.Abs( motion ) < 0.001f )
        {
            if( resetTime <= Time.time )
            {
                RaiseOnPinchEnd();
                return GestureState.Recognized;
            }

            return GestureState.InProgress;
        }
        else
        {
            resetTime = Time.time + 0.1f;
        }

        Position[0] = Position[1] = Input.mousePosition;

        delta = DeltaScale * motion;

        RaiseOnPinchMove();

        return GestureState.InProgress;
    }
开发者ID:denis1494,项目名称:9-3-4-bit-fish,代码行数:27,代码来源:MousePinchGestureRecognizer.cs

示例5: IsValidDirection

    /// <summary>
    /// Return true if the input direction is supported
    /// </summary>
    public bool IsValidDirection( FingerGestures.SwipeDirection dir )
    {
        if( dir == FingerGestures.SwipeDirection.None )
            return false;

        return ( ( ValidDirections & dir ) == dir );
    }
开发者ID:kreeds,项目名称:TestProjectDemo,代码行数:10,代码来源:SwipeGestureRecognizer.cs

示例6: OnActive

    protected override GestureState OnActive( FingerGestures.IFingerList touches )
    {
        if( touches.Count != RequiredFingerCount )
        {
            // all fingers lifted - fire the tap event
            if( touches.Count == 0 )
            {
                RaiseOnTap();
                return GestureState.Recognized;
            }

            // either lifted off some fingers or added some new ones
            return GestureState.Failed;
        }

        // check if the gesture timed out
        if( MaxDuration > 0 && ElapsedTime > MaxDuration )
            return GestureState.Failed;
        
        // check if finger moved too far from start position
        float sqrDist = Vector3.SqrMagnitude( touches.GetAveragePosition() - StartPosition );
        if( sqrDist >= MoveTolerance * MoveTolerance )
            return GestureState.Failed;
        
        return GestureState.InProgress;
    }
开发者ID:seenen,项目名称:HerosTechBak_Seenen,代码行数:26,代码来源:TapGestureRecognizer.cs

示例7: OnActive

    protected override GestureState OnActive( FingerGestures.IFingerList touches )
    {
        if( touches.Count != RequiredFingerCount )
        {
            // fingers were lifted off
            if( touches.Count < RequiredFingerCount )
            {
                RaiseOnDragEnd();
                return GestureState.Recognized;
            }

            return GestureState.Failed;
        }

        Position = touches.GetAveragePosition();

        MoveDelta = Position - lastPos;

        if( MoveDelta.sqrMagnitude > 0 )
        {
            RaiseOnDragMove();
            lastPos = Position;
        }

        return GestureState.InProgress;
    }
开发者ID:kreeds,项目名称:TestProjectDemo,代码行数:26,代码来源:DragGestureRecognizer.cs

示例8: SignedAngularGap

    // return signed angle in degrees between current finger position and ref positions
    static float SignedAngularGap( FingerGestures.Finger finger0, FingerGestures.Finger finger1, Vector2 refPos0, Vector2 refPos1 )
    {
        Vector2 curDir = ( finger0.Position - finger1.Position ).normalized;
        Vector2 refDir = ( refPos0 - refPos1 ).normalized;

        // check if we went past the minimum rotation amount treshold
        return Mathf.Rad2Deg * FingerGestures.SignedAngle( refDir, curDir );
    }
开发者ID:seenen,项目名称:HerosTechBak_Seenen,代码行数:9,代码来源:RotationGestureRecognizer.cs

示例9: OnBegin

    protected override void OnBegin( FingerGestures.IFingerList touches )
    {
        Position = touches.GetAveragePosition();
        StartPosition = Position;
        lastTapTime = Time.time;

        //Debuger.Log( this + " OnBegin @ " + StartPosition );
    }
开发者ID:seenen,项目名称:HerosTechBak_Seenen,代码行数:8,代码来源:MultiTapGestureRecognizer.cs

示例10: FingerGestures_OnFingerSwipe

 void FingerGestures_OnFingerSwipe( int fingerIndex, Vector2 startPos, FingerGestures.SwipeDirection direction, float velocity )
 {
     GameObject selection = PickObject( startPos );
     if( selection == swipeObject )
     {
         rootObject.GetComponent<Button>().Swiped(direction.ToString());
     }
 }
开发者ID:Rinal,项目名称:Niam-Niam,代码行数:8,代码来源:SwipeButtons.cs

示例11: OnBegin

 protected override void OnBegin( FingerGestures.IFingerList touches )
 {
     Position = touches.GetAveragePosition();
     StartPosition = Position;
     MoveDelta = Vector2.zero;
     lastPos = Position;
     
     RaiseOnDragBegin();
 }
开发者ID:seenen,项目名称:HerosTechBak_Seenen,代码行数:9,代码来源:DragGestureRecognizer.cs

示例12: CanBegin

    protected override bool CanBegin( FingerGestures.IFingerList touches )
    {
        if( !base.CanBegin( touches ) )
            return false;

        if( touches.GetAverageDistanceFromStart() < MoveTolerance )
            return false;

        return true;
    }
开发者ID:kreeds,项目名称:TestProjectDemo,代码行数:10,代码来源:DragGestureRecognizer.cs

示例13: CanBegin

    protected override bool CanBegin( FingerGestures.IFingerList touches )
    {
        if( !CheckCanBeginDelegate( touches ) )
            return false;

        float motion = Input.GetAxis( axis );
        if( Mathf.Abs( motion ) < 0.0001f )
            return false;

        return true;
    }
开发者ID:denis1494,项目名称:9-3-4-bit-fish,代码行数:11,代码来源:MousePinchGestureRecognizer.cs

示例14: GetMessageForSwipeDirection

    Message GetMessageForSwipeDirection( FingerGestures.SwipeDirection direction )
    {
        if( direction == FingerGestures.SwipeDirection.Left )
            return swipeLeftMessage;

        if( direction == FingerGestures.SwipeDirection.Right )
            return swipeRightMessage;

        if( direction == FingerGestures.SwipeDirection.Up )
            return swipeUpMessage;

        return swipeDownMessage;
    }
开发者ID:seenen,项目名称:HerosTechBak_Seenen,代码行数:13,代码来源:TBSwipe.cs

示例15: OnBegin

    protected override void OnBegin( FingerGestures.IFingerList touches )
    {
        StartPosition[0] = StartPosition[1] = Input.mousePosition;
        Position[0] = Position[1] = Input.mousePosition;

        delta = 0;

        RaiseOnPinchBegin();

        delta = DeltaScale * Input.GetAxis( axis );
        resetTime = Time.time + 0.1f;

        RaiseOnPinchMove();
    }
开发者ID:denis1494,项目名称:9-3-4-bit-fish,代码行数:14,代码来源:MousePinchGestureRecognizer.cs


注:本文中的FingerGestures类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。