代码拉取完成,页面将自动刷新
同步操作将从 liyonghelpme/rongYaoDaLuCode 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
using System;
using System.Runtime.CompilerServices;
using UnityEngine;
[AddComponentMenu("FingerGestures/Toolbox/Swipe")]
public class TBSwipe : TBComponent
{
private FingerGestures.SwipeDirection direction;
public float minVelocity;
public bool swipeDown = true;
public TBComponent.Message swipeDownMessage = new TBComponent.Message("OnSwipeDown", false);
public bool swipeLeft = true;
public TBComponent.Message swipeLeftMessage = new TBComponent.Message("OnSwipeLeft", false);
public TBComponent.Message swipeMessage = new TBComponent.Message("OnSwipe");
public bool swipeRight = true;
public TBComponent.Message swipeRightMessage = new TBComponent.Message("OnSwipeRight", false);
public bool swipeUp = true;
public TBComponent.Message swipeUpMessage = new TBComponent.Message("OnSwipeUp", false);
private float velocity;
public event TBComponent.EventHandler<TBSwipe> OnSwipe;
private TBComponent.Message GetMessageForSwipeDirection(FingerGestures.SwipeDirection direction)
{
if (direction == FingerGestures.SwipeDirection.Left)
{
return this.swipeLeftMessage;
}
if (direction == FingerGestures.SwipeDirection.Right)
{
return this.swipeRightMessage;
}
if (direction == FingerGestures.SwipeDirection.Up)
{
return this.swipeUpMessage;
}
return this.swipeDownMessage;
}
public bool IsValid(FingerGestures.SwipeDirection direction)
{
if (direction == FingerGestures.SwipeDirection.Left)
{
return this.swipeLeft;
}
if (direction == FingerGestures.SwipeDirection.Right)
{
return this.swipeRight;
}
if (direction == FingerGestures.SwipeDirection.Up)
{
return this.swipeUp;
}
return ((direction == FingerGestures.SwipeDirection.Down) && this.swipeDown);
}
public bool RaiseSwipe(int fingerIndex, Vector2 fingerPos, FingerGestures.SwipeDirection direction, float velocity)
{
if (velocity < this.minVelocity)
{
return false;
}
if (!this.IsValid(direction))
{
return false;
}
base.FingerIndex = fingerIndex;
base.FingerPos = fingerPos;
this.Direction = direction;
this.Velocity = velocity;
if (this.OnSwipe != null)
{
this.OnSwipe(this);
}
base.Send(this.swipeMessage);
base.Send(this.GetMessageForSwipeDirection(direction));
return true;
}
public FingerGestures.SwipeDirection Direction
{
get
{
return this.direction;
}
protected set
{
this.direction = value;
}
}
public float Velocity
{
get
{
return this.velocity;
}
protected set
{
this.velocity = value;
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。