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


C# FingerGestures.GetAveragePosition方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: OnBegin

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

示例6: OnActive

    protected override GestureState OnActive( FingerGestures.IFingerList touches )
    {
        wasDown = down;
        down = false;

        if( touches.Count == RequiredFingerCount )
        {
            down = true;
            lastDownTime = Time.time;
        }
        else if( touches.Count == 0 )
        {
            down = false;
        }
        else
        {
            // some fingers were lifted off
            if( touches.Count < RequiredFingerCount )
            {
                // give a bit of buffer time to lift-off the remaining fingers
                if( Time.time - lastDownTime > 0.25f )
                    return GestureState.Failed;
            }
            else // fingers were added
            {
                if( !Young( touches ) )
                    return GestureState.Failed;
            }
        }

        if( HasTimedOut() )
        {
            // if we requested unlimited taps and landed at least one, consider this a success
            if( RequiredTaps == 0 && Taps > 0 )
            {
                // if we didn't raise a tap event on each tap, at least raise the event once at the end of the tap sequence
                if( !RaiseEventOnEachTap )
                    RaiseOnTap();

                return GestureState.Recognized;
            }

            // else, timed out
            return GestureState.Failed;
        }

        if( down )
        {
            // check if finger moved too far from start position
            float sqrDist = Vector3.SqrMagnitude( touches.GetAveragePosition() - StartPosition );
            if( sqrDist >= MoveTolerance * MoveTolerance )
                return GestureState.Failed;
        }

        if( wasDown != down )
        {
            // fingers were just released
            if( !down )
            {
                ++taps;
                lastTapTime = Time.time;

                // If the requested tap count has been reached, validate the gesture and stop
                if( RequiredTaps > 0 && taps >= RequiredTaps )
                {
                    RaiseOnTap();
                    return GestureState.Recognized;
                }

                if( RaiseEventOnEachTap )
                    RaiseOnTap();
            }
        }

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

示例7: OnBegin

 protected override void OnBegin( FingerGestures.IFingerList touches )
 {
     Position = touches.GetAveragePosition();
     StartPosition = Position;
     direction = FingerGestures.SwipeDirection.None;
 }
开发者ID:kreeds,项目名称:TestProjectDemo,代码行数:6,代码来源:SwipeGestureRecognizer.cs

示例8: OnActive

    protected override GestureState OnActive( FingerGestures.IFingerList touches )
    {
        if( touches.Count != RequiredFingerCount )
        {
            // fingers were lifted off
            if( touches.Count < RequiredFingerCount )
            {
                if( direction != FingerGestures.SwipeDirection.None )
                {
                    if( OnSwipe != null )
                        OnSwipe( this );

                    return GestureState.Recognized;
                }
            }

            return GestureState.Failed;
        }

        Position = touches.GetAveragePosition();
        Move = Position - StartPosition;

        float distance = Move.magnitude;

        // didnt move far enough
        if( distance < MinDistance )
            return GestureState.InProgress;

        if( ElapsedTime > 0 )
            velocity = distance / ElapsedTime;
        else
            velocity = 0;

        // we're going too slow
        if( velocity < MinVelocity )
            return GestureState.Failed;

        FingerGestures.SwipeDirection newDirection = FingerGestures.GetSwipeDirection( Move.normalized, DirectionTolerance );

        // we went in a bad direction
        if( !IsValidDirection( newDirection ) || ( direction != FingerGestures.SwipeDirection.None && newDirection != direction ) )
            return GestureState.Failed;

        direction = newDirection;
        return GestureState.InProgress;
    }
开发者ID:kreeds,项目名称:TestProjectDemo,代码行数:46,代码来源:SwipeGestureRecognizer.cs

示例9: OnBegin

 protected override void OnBegin( FingerGestures.IFingerList touches )
 {
     Position = touches.GetAveragePosition();
     StartPosition = Position;
     lastTapTime = Time.time;
     startTime = Time.time;
 }
开发者ID:acimbru,项目名称:licenta,代码行数:7,代码来源:TapGestureRecognizer.cs


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