zoukankan      html  css  js  c++  java
  • EasyTouch5ForSiki学院

    总结:

    这里面的一些功能,就可以拿来做移动或者PC的很多功能了,这是一个很有用的插件。

    禁用0618错误

    EasyTouch4_x的写法:

    using HedgehogTeam.EasyTouch;

    using System.Collections;

    using System.Collections.Generic;

    using UnityEngine;

    /// <summary>

    /// 有订阅方法,在不用的时候一定要取消订阅

    /// </summary>

    public class EasyTouch4_x : MonoBehaviour

    {

    //在OnEnable中订阅EasyTouch的事件

    private void OnEnable()

        {

            EasyTouch.On_TouchStart += OnTouchStart;

            EasyTouch.On_TouchUp += OnTouchEnd;

            EasyTouch.On_Swipe += OnSwipe;

        }

    //在OnDisable与OnDestroy中取消订阅OnEnable中对应的事件

    private void OnDisable()

        {

            EasyTouch.On_TouchStart -= OnTouchStart;

            EasyTouch.On_TouchUp -= OnTouchEnd;

            EasyTouch.On_Swipe -= OnSwipe;

        }

    private void OnDestroy()

        {

            EasyTouch.On_TouchStart -= OnTouchStart;

            EasyTouch.On_TouchUp -= OnTouchEnd;

            EasyTouch.On_Swipe -= OnSwipe;

        }

    void OnTouchStart(Gesture gesture)//必须包含这个参数Gesture gesture

        {

            Debug.Log("OnTouchStart");

            Debug.Log("StartPosition" + gesture.startPosition);

        }

    void OnTouchEnd(Gesture gesture)

        {

            Debug.Log("OnTouchEnd");

            Debug.Log("ActionTime" + gesture.actionTime);

        }

    void OnSwipe(Gesture gesture)

        {

            Debug.Log("Swip");

            Debug.Log("Type" + gesture.touchType);

        }

    }

    EasyTouch5_x的新写法:

    using System.Collections;

    using System.Collections.Generic;

    using UnityEngine;

    using HedgehogTeam.EasyTouch;

    public class EasyTouch5_x : MonoBehaviour {

    //EasyTouch5.x版本中的新特性可以不用书写订阅事件等一套语句

    private void Update()

        {

    //通过currentGesture获取当前玩家输入的手势

            Gesture currentGesture = EasyTouch.current;

    //当前手势等于这个则执行

    //currentGesture != null是为了防止一开始没有输入时报空指针

    if (currentGesture != null&& EasyTouch.EvtType.On_TouchStart==currentGesture.type)

            {

                OnTouchStart(currentGesture);

            }

    if (currentGesture != null && EasyTouch.EvtType.On_TouchUp == currentGesture.type)

            {

                OnTouchEnd(currentGesture);

            }

    if (currentGesture != null && EasyTouch.EvtType.On_Swipe == currentGesture.type)

            {

                OnSwipe(currentGesture);

            }

        }

    void OnTouchStart(Gesture gesture)//必须包含这个参数Gesture gesture

        {

            Debug.Log("OnTouchStart");

            Debug.Log("StartPosition" + gesture.startPosition);

        }

    void OnTouchEnd(Gesture gesture)

        {

            Debug.Log("OnTouchEnd");

            Debug.Log("ActionTime" + gesture.actionTime);

        }

    void OnSwipe(Gesture gesture)

        {

            Debug.Log("Swip");

            Debug.Log("Type" + gesture.touchType);

        }

    }

    QuickGestureDemo

    有这几个操作:

    缩放Pinch

    这个需要勾选

    5.0的新特性:EasyTouchTrigger

    我爱学习,学习使我快乐。
  • 相关阅读:
    SoapUI 使用笔记
    git 使用笔记(二)
    git 使用笔记(一)
    jquery 拓展
    hdu 1024 Max Sum Plus Plus (DP)
    hdu 2602 Bone Collector (01背包)
    hdu 1688 Sightseeing (最短路径)
    hdu 3191 How Many Paths Are There (次短路径数)
    hdu 2722 Here We Go(relians) Again (最短路径)
    hdu 1596 find the safest road (最短路径)
  • 原文地址:https://www.cnblogs.com/kerven/p/8118239.html
Copyright © 2011-2022 走看看