首页 > 移动平台 > 详细

移动端手势双击(OnGUI也可以在移动端响应,但是帧率太低)

时间:2017-08-11 14:31:54      阅读:302      评论:0      收藏:0      [点我收藏+]

void Update()
{
  if (Input.touchCount > 0)//手指数量
  {
    if(Input.GetTouch(0).phase == TouchPhase.Began && Input.GetTouch(0).tapCount == 2)//Input.GetTouch(0)表示手势
    {
    Debug.Log("Gesture DoubleClick");
    }
  }
 }

//以下是几种触摸方式:

namespace UnityEngine
{
  //
  // 摘要:
  // ///
  // Describes phase of a finger touch.
  // ///
  public enum TouchPhase
  {
    //
    // 摘要:
    // ///
    // A finger touched the screen.一根手指触摸屏幕。
    // ///
    Began = 0,
    //
    // 摘要:
    // ///
    // A finger moved on the screen.一根手指在屏幕上移动。
    // ///
    Moved = 1,
    //
    // 摘要:
    // ///
    // A finger is touching the screen but hasn‘t moved.手指在触摸屏幕,但没有移动。
    // ///
    Stationary = 2,
    //
    // 摘要:
    // ///
    // A finger was lifted from the screen. This is the final phase of a touch.一根手指从屏幕上抬了出来。这是触摸的最后阶段。
    // ///
    Ended = 3,
    //
    // 摘要:
    // ///
    // The system cancelled tracking for the touch.系统取消了对触摸的跟踪。
    // ///
    Canceled = 4
  }
}

移动端手势双击(OnGUI也可以在移动端响应,但是帧率太低)

原文:http://www.cnblogs.com/yanghui0702/p/yanghui20170811-02.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!