Unity3D的Easy Touch 的手册最近寻找中文版本,google无果,自己动手。目前暂时只有c# ,javascript原理是一样的。

  

一、Quick Start

  1-Import EasyTouch Package.
    

2-Create an empty gameObject, and name it EasyTouch.(You can choose another name)
  Step 1 & 2 can be replace by the option menu

  
  3-Add the EasyTouch.cs script on the EasyTouch gameObject that you just created.

  添加一个EasyTouch.cs 到你创建的这个物体
  4-Select the EasyTouch gameobject, and verifies that Broadcast messages is set to FALSE in the inspector.

  在检视面板中如下设置:

  

  5-Create a new C# script MyFirstTouch

  
  6-Add these methods

// Subscribe to events
void OnEnable(){
EasyTouch.On_TouchStart += On_TouchStart;
}
// Unsubscribe
void OnDisable(){
EasyTouch.On_TouchStart -= On_TouchStart;
}
// Unsubscribe
void OnDestroy(){
EasyTouch.On_TouchStart -= On_TouchStart;
}
// Touch start event
public void On_TouchStart(Gesture gesture){
Debug.Log( "Touch in " + gesture.position);
}

   7-Create an empty gameObject, and name it Receiver.

  
  8- Add MyFirstTouch script to the gameObject Receiver.

  
  9- Run it in editor, and click on the screen

  This example will do nothing if you run it on your mobile devise, it's just to show you how use EasyTouch events with C#
  

With C# events all script that are subscribed to an event will receive the event

  所有的订阅了这个事件的脚本都会接受到这个事件。

二、Quick Start with auto-select (C#)

  1-Do steps 1 to 4 of the Quick Start (C#)

   2-Select the EasyTouch gameobject , and add a pickable layers in the Auto-select properties in the inspector

  选择一个层,后面有用

  

  3-Create a sphere and assign it a simple diffuse material

4- Setting the auto-select on the sphere : Assign the same layer that you assign as parameter to the sphere.

给Sphere物体的分配你刚才选择的层(一定要分配同样的,如果不指定,则无效)

   5- Create a new C#

6-Add these methods :

// Subscribe to events
void OnEnable(){
EasyTouch.On_TouchStart += On_TouchStart;
}
// Unsubscribe
void OnDisable(){
EasyTouch.On_TouchStart -= On_TouchStart;
}
// Unsubscribe
void OnDestroy(){
EasyTouch.On_TouchStart -= On_TouchStart;
}
// At the touch beginning
public void On_TouchStart(Gesture gesture){
// Verification that the action on the object
if (gesture.pickObject == gameObject)
gameObject.renderer.material.color = new Color( Random.Range(0.0f,1.0f),
Random.Range(0.0f,1.0f), Random.Range(0.0f,1.0f));
}

7-Add this script to the sphere

 8-Run it in editor mode or in your device. If you touch the sphere or click on it, it will change color.

 

三、Concepts

  Event system
    When you make an action with the touch screen or mouse, EasyTouch raise an event corresponding to the current action. Each event will have a parameter of type Gesture.

    当你在接触屏幕或者使用鼠标的时候,EasyTouch会根据你的当前的行为发出一个时间。每一个Each event都有一个Gesture类型的参数。
    You only have to write the code according to the gesture, as in a motor GUI events.

    你只需要在事件中根据传过来的gesture写你的代码即可。

    Events can be raised in two different ways (look atgeneral properties inspector)

    事件的发出可以通过以下两种方法,我建议第一种。
- Event / Delegate system.
- Unity built-in Sending message system (SendMessage)

    

  Auto-Select

    When you perform an action on the touch screen or mouse, EasyTouch can detect if the action is performed on a gameobject.

    当你接触吗屏幕或者点击鼠标的时候,Easy Touch会检测这个行为是否会作用到某个物体。

    If gameobject is detected, it will be assign to the class memberpickedObject of the Gesture classwhich will be sent with the event.

     With the broadcast message mode(built in unity), the event itself will be sent to this object.
    This setting is enabled by default (Inpsector properties), you just indicate the layers that can be selected.

     这种设置默认是enable的,你只需要制定你选择的层即可。

    

  Warning:
    With Event-Delegate mode, events are sent to all objects that have subscribed to the event, unlike the broadcast mode which sends the object itself.

    由于c#中的事件是群发的,所以你需要检测下自己。
  

    Even if the script that processes an event is attached to a selectable object, you need to test the pickedObject member.

public void On_TouchStart(Gesture gesture){
// Verification
if (gesture.pickObject == gameObject)
gameObject.renderer.material.color = Color.red;
}

三、 Inspector properties

  EasyTouch has different parameters that you can customize with the inspec
all mobile platforms.
  All these properties can be setting with script, look at :EasyTouch Class

  

  General properties

  

  Enable EasyTouch:Enables ou disables EasyTouch
  Enable unity remote: Enables ou disables the support of Unity Remote

  Enable hover extention: To test if a touch is hover a virtual controller (joystick or
member isHoverController of Gesture class passed as parameter is egual to TRUE

  Broadcast messages :
◦ True = The events will be sent with then internal messaging function of Unity (Sen
Use this if you develop in Javascript (you can use in C# too, if you want)
◦ False =The events will be sent with events/Delegate C# system, never use this mod
Javascript
◦ Other receiver : Allows you to direct all messages to a gameobject
◦ Joysticks & buttons :  Enable this if you have joystick or button in your scene

  Enable NGUI compatibility:
  If a touch is hover a NGUI panel , Easytouch doesn't raise any event
◦ NGUICamera: All camera used by NGUI
◦ NGUILayers: all layer used by NGUI

  

  Enable auto-select:Enables or disables the auto-select of game
  

  Add Camera: Bby default EasyTouch will take the camera with the main flag to raycast, but you can add other camera on set GUI to true, it's a camera for your GUI

  Pickable Layers: To set up all layer that EasyTouch must test

  

  
   Stationnary tolerance: Distance below which a finger mouvemenst generate static touch, Act on this value if the tap are not detected correctly. The default value works well on a IPAD2
   Long tap time:Represents the maximum time to generate an event tap, or the minimum time to generate a long tap event

  Swipe tolerance : This value is used to detect the orientation of a gesture swipe or drag. It must be between 0 and 1

0 => Gesture imprecise 不精确
1 => Gesture very precise 精确

  

四、Classes

  Events

  Below is a list of all the events raised by EasyTouch. Look at_C#-Event-Template or _Jave—Event-Template folder on Plugins folder

    下面列出一些常用的事件,具体的可以参考官网http://www.blitz3dfr.com/Doc/ET3/annotated.html

  

    

    

 

    

  

EasyTouch 3.1中文翻译的更多相关文章

  1. 《Entity Framework 6 Recipes》中文翻译系列 目录篇 -持续更新

    为了方便大家的阅读和学习,也是响应网友的建议,在这里为这个系列做一个目录.在目录开始这前,我先来回答之前遇到的几个问题. 1.为什么要学习EF? 这个问题很简单,项目需要.这不像学校,没人强迫你学习! ...

  2. Spark官方文档 - 中文翻译

    Spark官方文档 - 中文翻译 Spark版本:1.6.0 转载请注明出处:http://www.cnblogs.com/BYRans/ 1 概述(Overview) 2 引入Spark(Linki ...

  3. PS网页设计教程——30个优秀的PS网页设计教程的中文翻译教程

    PS网页设计教程--30个优秀的PS网页设计教程的中文翻译教程   作为编码者,美工基础是偏弱的.我们可以参考一些成熟的网页PS教程,提高自身的设计能力.套用一句话,"熟读唐诗三百首,不会作 ...

  4. Spark SQL 官方文档-中文翻译

    Spark SQL 官方文档-中文翻译 Spark版本:Spark 1.5.2 转载请注明出处:http://www.cnblogs.com/BYRans/ 1 概述(Overview) 2 Data ...

  5. Learning Spark: Lightning-Fast Big Data Analysis 中文翻译

    Learning Spark: Lightning-Fast Big Data Analysis 中文翻译行为纯属个人对于Spark的兴趣,仅供学习. 如果我的翻译行为侵犯您的版权,请您告知,我将停止 ...

  6. 苹果App Store审核指南中文翻译(2014.9.1更新)

    转:http://www.cocoachina.com/appstore/20140901/9500.html CocoaChina对<苹果应用商店审核指南>中文翻译最近一次更新时间为20 ...

  7. (转)PK系列之六:该不该读中文翻译的专业书

    本文引用地址:http://blog.sciencenet.cn/blog-2999994-956596.html 此文来自科学网王立新博客,转载请注明出处. 刘新建:这几天在读一本译著:投入产出分析 ...

  8. Umbraco官方技术文档 中文翻译

    Umbraco 官方技术文档中文翻译 http://blog.csdn.net/u014183619/article/details/51919973 http://www.cnblogs.com/m ...

  9. 《Introduction to Tornado》中文翻译计划——第五章:异步Web服务

    http://www.pythoner.com/294.html 本文为<Introduction to Tornado>中文翻译,将在https://github.com/alioth3 ...

随机推荐

  1. 项目中Service层的写法

    截取自项目中的一个service实现类,记录一下: base类 package com.bupt.auth.service.base; import javax.annotation.Resource ...

  2. GNU Binutils工具

    参考<程序员的自我修养---连接.装载与库> 以下内容转贴自 http://www.cnblogs.com/xuxm2007/archive/2013/02/21/2920890.html ...

  3. C语言实现基于投票规则的细胞自动机

    算法介绍 首先我们先看一下“基于投票规则的细胞自动机”的定义: 基于投票规则的细胞自动机,实际上是具有如下限定条件的一种细胞自动机: 状态:0或1: 邻居:中心的3*3邻居: 规则:计数p表示中心的3 ...

  4. Java设计模式之--代理模式学习

    1.代理模式定义 为其他对象提供一种代理以控制对这个对象的访问.代理对象起到中介服务,可以去掉功能服务和增加额外的服务. 其实按照官方的说法可能不太好理解,代理模式就好比我们生活中买票,一般情况下我们 ...

  5. 第一个APP 时钟

    //  ViewController.h //  IOS310803 // //  Created by 张艳锋 on 15/8/3. //  Copyright (c) 2015年 zyf. All ...

  6. 抽象类(abstract)是否可以继承自实体类 ?

    可以. 但是这个实体类必须有无参构造函数(默认的构造函数). 如: public class A { //这个构造函数必须要有(在没有构造函数重载时可以省略,因为运行时会为A添加默认构造函数) pub ...

  7. [笔记] MySql Workbench 导出表结构和数据报错 mysqldump: [ERROR] unknown variable 'delayed-insert=FALSE'

    下午使用MySql Workbench导出数据库表结构,设置完导出选项后执行导出,报如下错误: :: Dumping nacweixindb (tb_app) Running: mysqldump.e ...

  8. Cookie与Session详解

    来源:<PHP核心技术与最佳实践> 列旭松 陈文 著 Cookie与Session详解读书笔记,从概念.操作.应用.注意事项以及区别等几方面详细阐述两者的基础知识,它们都是针对HTTP协议 ...

  9. 例题6-3 Matrix Chain Multiplication ,Uva 442

    这个题思路没有任何问题,但还是做了近三个小时,其中2个多小时调试 得到的经验有以下几点: 一定学会调试,掌握输出中间量的技巧,加强gdb调试的学习 有时候代码不对,得到的结果却是对的(之后总结以下常见 ...

  10. 一路走过的2013,welcome to 2014

    驻入博客园,还是在大学时,至今没写过一篇博客,一直都是在看人家写的博客.2014 年第一天,就从这一天,开启博客之旅,与大家分享好书,分享技术,结交好朋友. 简单,介绍下自己,大三实习,因为热衷于互联 ...