init
9
Assets/EasyTouchBundle/EasyTouch/Plugins/Components.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f610c2b618d1c64ca66f4e0bbe894f7
|
||||
folderAsset: yes
|
||||
timeCreated: 1435661089
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,525 @@
|
||||
/***********************************************
|
||||
EasyTouch V
|
||||
Copyright © 2014-2015 The Hedgehog Team
|
||||
http://www.thehedgehogteam.com/Forum/
|
||||
|
||||
The.Hedgehog.Team@gmail.com
|
||||
|
||||
**********************************************/
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
namespace HedgehogTeam.EasyTouch{
|
||||
[AddComponentMenu("EasyTouch/Trigger")]
|
||||
[System.Serializable]
|
||||
public class EasyTouchTrigger : MonoBehaviour {
|
||||
|
||||
public enum ETTParameter{ None,Gesture, Finger_Id,Touch_Count, Start_Position, Position, Delta_Position, Swipe_Type, Swipe_Length, Swipe_Vector,Delta_Pinch, Twist_Anlge, ActionTime, DeltaTime, PickedObject, PickedUIElement }
|
||||
public enum ETTType {Object3D,UI};
|
||||
|
||||
[System.Serializable]
|
||||
public class EasyTouchReceiver{
|
||||
public bool enable;
|
||||
public ETTType triggerType;
|
||||
public string name;
|
||||
public bool restricted;
|
||||
public GameObject gameObject;
|
||||
public bool otherReceiver;
|
||||
public GameObject gameObjectReceiver;
|
||||
public EasyTouch.EvtType eventName;
|
||||
public string methodName;
|
||||
public ETTParameter parameter;
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
public List<EasyTouchReceiver> receivers = new List<EasyTouchReceiver>();
|
||||
|
||||
#region Monobehaviour Callback
|
||||
void Start(){
|
||||
EasyTouch.SetEnableAutoSelect( true);
|
||||
|
||||
}
|
||||
|
||||
void OnEnable(){
|
||||
SubscribeEasyTouchEvent();
|
||||
}
|
||||
|
||||
void OnDisable(){
|
||||
UnsubscribeEasyTouchEvent();
|
||||
}
|
||||
|
||||
void OnDestroy(){
|
||||
UnsubscribeEasyTouchEvent();
|
||||
}
|
||||
|
||||
private void SubscribeEasyTouchEvent(){
|
||||
|
||||
// Touch
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_Cancel))
|
||||
EasyTouch.On_Cancel += On_Cancel;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_TouchStart))
|
||||
EasyTouch.On_TouchStart += On_TouchStart;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_TouchDown))
|
||||
EasyTouch.On_TouchDown += On_TouchDown;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_TouchUp))
|
||||
EasyTouch.On_TouchUp += On_TouchUp;
|
||||
|
||||
// Tap & long tap
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_SimpleTap))
|
||||
EasyTouch.On_SimpleTap += On_SimpleTap;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_LongTapStart))
|
||||
EasyTouch.On_LongTapStart += On_LongTapStart;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_LongTap))
|
||||
EasyTouch.On_LongTap += On_LongTap;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_LongTapEnd))
|
||||
EasyTouch.On_LongTapEnd += On_LongTapEnd;
|
||||
|
||||
// Double tap
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_DoubleTap))
|
||||
EasyTouch.On_DoubleTap += On_DoubleTap;
|
||||
|
||||
// Drag
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_DragStart))
|
||||
EasyTouch.On_DragStart += On_DragStart;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_Drag))
|
||||
EasyTouch.On_Drag += On_Drag;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_DragEnd))
|
||||
EasyTouch.On_DragEnd += On_DragEnd;
|
||||
|
||||
// Swipe
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_SwipeStart))
|
||||
EasyTouch.On_SwipeStart += On_SwipeStart;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_Swipe))
|
||||
EasyTouch.On_Swipe += On_Swipe;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_SwipeEnd))
|
||||
EasyTouch.On_SwipeEnd += On_SwipeEnd;
|
||||
|
||||
// Tap 2 fingers
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_TouchStart2Fingers))
|
||||
EasyTouch.On_TouchStart2Fingers += On_TouchStart2Fingers;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_TouchDown2Fingers))
|
||||
EasyTouch.On_TouchDown2Fingers += On_TouchDown2Fingers;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_TouchUp2Fingers))
|
||||
EasyTouch.On_TouchUp2Fingers += On_TouchUp2Fingers;
|
||||
|
||||
// Tap & Long tap 2 fingers
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_SimpleTap2Fingers))
|
||||
EasyTouch.On_SimpleTap2Fingers+= On_SimpleTap2Fingers;
|
||||
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_LongTapStart2Fingers))
|
||||
EasyTouch.On_LongTapStart2Fingers += On_LongTapStart2Fingers;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_LongTap2Fingers))
|
||||
EasyTouch.On_LongTap2Fingers += On_LongTap2Fingers;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_LongTapEnd2Fingers))
|
||||
EasyTouch.On_LongTapEnd2Fingers += On_LongTapEnd2Fingers;
|
||||
|
||||
// double tap fingers
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_DoubleTap2Fingers))
|
||||
EasyTouch.On_DoubleTap2Fingers += On_DoubleTap2Fingers;
|
||||
|
||||
// Swipe
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_SwipeStart2Fingers))
|
||||
EasyTouch.On_SwipeStart2Fingers += On_SwipeStart2Fingers;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_Swipe2Fingers))
|
||||
EasyTouch.On_Swipe2Fingers += On_Swipe2Fingers;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_SwipeEnd2Fingers))
|
||||
EasyTouch.On_SwipeEnd2Fingers += On_SwipeEnd2Fingers;
|
||||
|
||||
// Drag
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_DragStart2Fingers))
|
||||
EasyTouch.On_DragStart2Fingers += On_DragStart2Fingers;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_Drag2Fingers))
|
||||
EasyTouch.On_Drag2Fingers += On_Drag2Fingers;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_DragEnd2Fingers))
|
||||
EasyTouch.On_DragEnd2Fingers += On_DragEnd2Fingers;
|
||||
|
||||
// Pinch
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_Pinch))
|
||||
EasyTouch.On_Pinch += On_Pinch;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_PinchIn))
|
||||
EasyTouch.On_PinchIn += On_PinchIn;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_PinchOut))
|
||||
EasyTouch.On_PinchOut += On_PinchOut;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_PinchEnd))
|
||||
EasyTouch.On_PinchEnd += On_PinchEnd;
|
||||
|
||||
// Twist
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_Twist))
|
||||
EasyTouch.On_Twist += On_Twist;
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_TwistEnd))
|
||||
EasyTouch.On_TwistEnd += On_TwistEnd;
|
||||
|
||||
// Unity UI
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_OverUIElement))
|
||||
EasyTouch.On_OverUIElement += On_OverUIElement;
|
||||
|
||||
if (IsRecevier4( EasyTouch.EvtType.On_UIElementTouchUp))
|
||||
EasyTouch.On_UIElementTouchUp += On_UIElementTouchUp;
|
||||
|
||||
}
|
||||
|
||||
private void UnsubscribeEasyTouchEvent(){
|
||||
EasyTouch.On_Cancel -= On_Cancel;
|
||||
EasyTouch.On_TouchStart -= On_TouchStart;
|
||||
EasyTouch.On_TouchDown -= On_TouchDown;
|
||||
EasyTouch.On_TouchUp -= On_TouchUp;
|
||||
|
||||
EasyTouch.On_SimpleTap -= On_SimpleTap;
|
||||
EasyTouch.On_LongTapStart -= On_LongTapStart;
|
||||
EasyTouch.On_LongTap -= On_LongTap;
|
||||
EasyTouch.On_LongTapEnd -= On_LongTapEnd;
|
||||
|
||||
EasyTouch.On_DoubleTap -= On_DoubleTap;
|
||||
|
||||
EasyTouch.On_DragStart -= On_DragStart;
|
||||
EasyTouch.On_Drag -= On_Drag;
|
||||
EasyTouch.On_DragEnd -= On_DragEnd;
|
||||
|
||||
EasyTouch.On_SwipeStart -= On_SwipeStart;
|
||||
EasyTouch.On_Swipe -= On_Swipe;
|
||||
EasyTouch.On_SwipeEnd -= On_SwipeEnd;
|
||||
|
||||
EasyTouch.On_TouchStart2Fingers -= On_TouchStart2Fingers;
|
||||
EasyTouch.On_TouchDown2Fingers -= On_TouchDown2Fingers;
|
||||
EasyTouch.On_TouchUp2Fingers -= On_TouchUp2Fingers;
|
||||
|
||||
EasyTouch.On_SimpleTap2Fingers-= On_SimpleTap2Fingers;
|
||||
EasyTouch.On_LongTapStart2Fingers -= On_LongTapStart2Fingers;
|
||||
EasyTouch.On_LongTap2Fingers -= On_LongTap2Fingers;
|
||||
EasyTouch.On_LongTapEnd2Fingers -= On_LongTapEnd2Fingers;
|
||||
|
||||
EasyTouch.On_DoubleTap2Fingers -= On_DoubleTap2Fingers;
|
||||
|
||||
EasyTouch.On_SwipeStart2Fingers -= On_SwipeStart2Fingers;
|
||||
EasyTouch.On_Swipe2Fingers -= On_Swipe2Fingers;
|
||||
EasyTouch.On_SwipeEnd2Fingers -= On_SwipeEnd2Fingers;
|
||||
|
||||
EasyTouch.On_DragStart2Fingers -= On_DragStart2Fingers;
|
||||
EasyTouch.On_Drag2Fingers -= On_Drag2Fingers;
|
||||
EasyTouch.On_DragEnd2Fingers -= On_DragEnd2Fingers;
|
||||
|
||||
EasyTouch.On_Pinch -= On_Pinch;
|
||||
EasyTouch.On_PinchIn -= On_PinchIn;
|
||||
EasyTouch.On_PinchOut -= On_PinchOut;
|
||||
EasyTouch.On_PinchEnd -= On_PinchEnd;
|
||||
|
||||
EasyTouch.On_Twist -= On_Twist;
|
||||
EasyTouch.On_TwistEnd -= On_TwistEnd;
|
||||
|
||||
EasyTouch.On_OverUIElement += On_OverUIElement;
|
||||
EasyTouch.On_UIElementTouchUp += On_UIElementTouchUp;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region One Finger EasyTouch Callback
|
||||
|
||||
void On_TouchStart (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_TouchStart,gesture);
|
||||
}
|
||||
|
||||
void On_TouchDown (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_TouchDown,gesture);
|
||||
}
|
||||
|
||||
void On_TouchUp (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_TouchUp,gesture);
|
||||
}
|
||||
|
||||
void On_SimpleTap (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_SimpleTap,gesture);
|
||||
}
|
||||
|
||||
void On_DoubleTap (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_DoubleTap,gesture);
|
||||
}
|
||||
|
||||
void On_LongTapStart (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_LongTapStart,gesture);
|
||||
}
|
||||
|
||||
void On_LongTap (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_LongTap,gesture);
|
||||
}
|
||||
|
||||
void On_LongTapEnd (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_LongTapEnd,gesture);
|
||||
}
|
||||
|
||||
void On_SwipeStart (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_SwipeStart,gesture);
|
||||
}
|
||||
|
||||
void On_Swipe (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_Swipe,gesture);
|
||||
}
|
||||
|
||||
void On_SwipeEnd (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_SwipeEnd,gesture);
|
||||
}
|
||||
|
||||
void On_DragStart (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_DragStart,gesture);
|
||||
}
|
||||
|
||||
void On_Drag (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_Drag,gesture);
|
||||
}
|
||||
|
||||
void On_DragEnd (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_DragEnd,gesture);
|
||||
}
|
||||
|
||||
void On_Cancel (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_Cancel,gesture);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Two Finger EasyTouch Callback
|
||||
void On_TouchStart2Fingers (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_TouchStart2Fingers,gesture);
|
||||
}
|
||||
|
||||
void On_TouchDown2Fingers (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_TouchDown2Fingers,gesture);
|
||||
}
|
||||
|
||||
void On_TouchUp2Fingers (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_TouchUp2Fingers,gesture);
|
||||
}
|
||||
|
||||
void On_LongTapStart2Fingers (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_LongTapStart2Fingers,gesture);
|
||||
}
|
||||
|
||||
void On_LongTap2Fingers (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_LongTap2Fingers,gesture);
|
||||
}
|
||||
|
||||
void On_LongTapEnd2Fingers (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_LongTapEnd2Fingers,gesture);
|
||||
}
|
||||
|
||||
void On_DragStart2Fingers (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_DragStart2Fingers,gesture);
|
||||
}
|
||||
|
||||
void On_Drag2Fingers (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_Drag2Fingers,gesture);
|
||||
}
|
||||
|
||||
void On_DragEnd2Fingers (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_DragEnd2Fingers,gesture);
|
||||
}
|
||||
|
||||
void On_SwipeStart2Fingers (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_SwipeStart2Fingers,gesture);
|
||||
}
|
||||
|
||||
void On_Swipe2Fingers (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_Swipe2Fingers,gesture);
|
||||
}
|
||||
|
||||
void On_SwipeEnd2Fingers (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_SwipeEnd2Fingers,gesture);
|
||||
}
|
||||
|
||||
void On_Twist (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_Twist,gesture);
|
||||
}
|
||||
|
||||
void On_TwistEnd (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_TwistEnd,gesture);
|
||||
}
|
||||
|
||||
void On_Pinch (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_Pinch,gesture);
|
||||
}
|
||||
|
||||
void On_PinchOut (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_PinchOut,gesture);
|
||||
}
|
||||
|
||||
void On_PinchIn (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_PinchIn,gesture);
|
||||
}
|
||||
|
||||
void On_PinchEnd (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_PinchEnd,gesture);
|
||||
}
|
||||
|
||||
void On_SimpleTap2Fingers (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_SimpleTap2Fingers,gesture);
|
||||
|
||||
}
|
||||
|
||||
void On_DoubleTap2Fingers (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_DoubleTap2Fingers,gesture);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region UI Event
|
||||
void On_UIElementTouchUp (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_UIElementTouchUp,gesture);
|
||||
}
|
||||
|
||||
void On_OverUIElement (Gesture gesture){
|
||||
TriggerScheduler(EasyTouch.EvtType.On_OverUIElement,gesture);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Method
|
||||
public void AddTrigger(EasyTouch.EvtType ev){
|
||||
EasyTouchReceiver r = new EasyTouchReceiver();
|
||||
r.enable = true;
|
||||
r.restricted = true;
|
||||
r.eventName = ev;
|
||||
r.gameObject =null;
|
||||
r.otherReceiver = false;
|
||||
r.name = "New trigger";
|
||||
receivers.Add( r );
|
||||
|
||||
if (Application.isPlaying){
|
||||
UnsubscribeEasyTouchEvent();
|
||||
SubscribeEasyTouchEvent();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public bool SetTriggerEnable(string triggerName,bool value){
|
||||
|
||||
EasyTouchReceiver r =GetTrigger( triggerName);
|
||||
|
||||
if (r!=null){
|
||||
r.enable = value;
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool GetTriggerEnable(string triggerName){
|
||||
|
||||
EasyTouchReceiver r =GetTrigger( triggerName);
|
||||
|
||||
if (r!=null){
|
||||
return r.enable;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Method
|
||||
private void TriggerScheduler(EasyTouch.EvtType evnt, Gesture gesture){
|
||||
|
||||
foreach( EasyTouchReceiver receiver in receivers){
|
||||
|
||||
if (receiver.enable && receiver.eventName == evnt){
|
||||
if (
|
||||
(receiver.restricted && ( (gesture.pickedObject == gameObject && receiver.triggerType == ETTType.Object3D ) || ( gesture.pickedUIElement == gameObject && receiver.triggerType == ETTType.UI ) ))
|
||||
|
||||
|| (!receiver.restricted && (receiver.gameObject == null || ((receiver.gameObject == gesture.pickedObject && receiver.triggerType == ETTType.Object3D ) || ( gesture.pickedUIElement == receiver.gameObject && receiver.triggerType == ETTType.UI ) ) ))
|
||||
|
||||
){
|
||||
|
||||
GameObject sender = gameObject;
|
||||
if (receiver.otherReceiver && receiver.gameObjectReceiver!=null){
|
||||
sender = receiver.gameObjectReceiver;
|
||||
}
|
||||
switch (receiver.parameter){
|
||||
case ETTParameter.None:
|
||||
sender.SendMessage( receiver.methodName,SendMessageOptions.DontRequireReceiver);
|
||||
break;
|
||||
case ETTParameter.ActionTime:
|
||||
sender.SendMessage( receiver.methodName,gesture.actionTime,SendMessageOptions.DontRequireReceiver);
|
||||
break;
|
||||
case ETTParameter.Delta_Pinch:
|
||||
sender.SendMessage( receiver.methodName,gesture.deltaPinch,SendMessageOptions.DontRequireReceiver);
|
||||
break;
|
||||
case ETTParameter.Delta_Position:
|
||||
sender.SendMessage( receiver.methodName,gesture.deltaPosition,SendMessageOptions.DontRequireReceiver);
|
||||
break;
|
||||
case ETTParameter.DeltaTime:
|
||||
sender.SendMessage( receiver.methodName,gesture.deltaTime,SendMessageOptions.DontRequireReceiver);
|
||||
break;
|
||||
case ETTParameter.Finger_Id:
|
||||
sender.SendMessage( receiver.methodName,gesture.fingerIndex,SendMessageOptions.DontRequireReceiver);
|
||||
break;
|
||||
case ETTParameter.Gesture:
|
||||
sender.SendMessage( receiver.methodName,gesture,SendMessageOptions.DontRequireReceiver);
|
||||
break;
|
||||
case ETTParameter.PickedObject:
|
||||
if (gesture.pickedObject!=null){
|
||||
sender.SendMessage( receiver.methodName,gesture.pickedObject,SendMessageOptions.DontRequireReceiver);
|
||||
}
|
||||
break;
|
||||
case ETTParameter.PickedUIElement:
|
||||
if (gesture.pickedUIElement!=null){
|
||||
sender.SendMessage( receiver.methodName,gesture.pickedObject,SendMessageOptions.DontRequireReceiver);
|
||||
}
|
||||
break;
|
||||
case ETTParameter.Position:
|
||||
sender.SendMessage( receiver.methodName,gesture.position,SendMessageOptions.DontRequireReceiver);
|
||||
break;
|
||||
case ETTParameter.Start_Position:
|
||||
sender.SendMessage( receiver.methodName,gesture.startPosition,SendMessageOptions.DontRequireReceiver);
|
||||
break;
|
||||
case ETTParameter.Swipe_Length:
|
||||
sender.SendMessage( receiver.methodName,gesture.swipeLength,SendMessageOptions.DontRequireReceiver);
|
||||
break;
|
||||
case ETTParameter.Swipe_Type:
|
||||
sender.SendMessage( receiver.methodName,gesture.swipe,SendMessageOptions.DontRequireReceiver);
|
||||
break;
|
||||
case ETTParameter.Swipe_Vector:
|
||||
sender.SendMessage( receiver.methodName,gesture.swipeVector,SendMessageOptions.DontRequireReceiver);
|
||||
break;
|
||||
case ETTParameter.Touch_Count:
|
||||
sender.SendMessage( receiver.methodName,gesture.touchCount,SendMessageOptions.DontRequireReceiver);
|
||||
break;
|
||||
case ETTParameter.Twist_Anlge:
|
||||
sender.SendMessage( receiver.methodName,gesture.twistAngle,SendMessageOptions.DontRequireReceiver);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsRecevier4(EasyTouch.EvtType evnt){
|
||||
|
||||
int result = receivers.FindIndex(
|
||||
delegate(EasyTouchTrigger.EasyTouchReceiver e){
|
||||
return e.eventName == evnt;
|
||||
}
|
||||
);
|
||||
|
||||
if (result>-1){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private EasyTouchReceiver GetTrigger(string triggerName){
|
||||
EasyTouchTrigger.EasyTouchReceiver t = receivers.Find(
|
||||
delegate(EasyTouchTrigger.EasyTouchReceiver n){
|
||||
return n.name == triggerName;
|
||||
}
|
||||
);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8c8100645ce3444a84b9f5e0164ad76
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 61719e5cd5d2e754280e0dd736d759ec, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
258
Assets/EasyTouchBundle/EasyTouch/Plugins/Components/QuickBase.cs
Normal file
@@ -0,0 +1,258 @@
|
||||
/***********************************************
|
||||
EasyTouch V
|
||||
Copyright © 2014-2015 The Hedgehog Team
|
||||
http://www.thehedgehogteam.com/Forum/
|
||||
|
||||
The.Hedgehog.Team@gmail.com
|
||||
|
||||
**********************************************/
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace HedgehogTeam.EasyTouch{
|
||||
public class QuickBase : MonoBehaviour {
|
||||
|
||||
#region enumeration
|
||||
protected enum GameObjectType { Auto,Obj_3D,Obj_2D,UI};
|
||||
|
||||
public enum DirectAction {None,Rotate, RotateLocal,Translate, TranslateLocal, Scale};
|
||||
public enum AffectedAxesAction {X,Y,Z,XY,XZ,YZ,XYZ};
|
||||
#endregion
|
||||
|
||||
#region Members
|
||||
public string quickActionName;
|
||||
|
||||
// Touch management
|
||||
public bool isMultiTouch = false;
|
||||
public bool is2Finger = false;
|
||||
public bool isOnTouch=false;
|
||||
public bool enablePickOverUI = false;
|
||||
public bool resetPhysic = false;
|
||||
|
||||
// simple Action
|
||||
public DirectAction directAction;
|
||||
public AffectedAxesAction axesAction;
|
||||
public float sensibility = 1;
|
||||
public CharacterController directCharacterController;
|
||||
public bool inverseAxisValue = false;
|
||||
|
||||
|
||||
protected Rigidbody cachedRigidBody;
|
||||
protected bool isKinematic;
|
||||
|
||||
protected Rigidbody2D cachedRigidBody2D;
|
||||
protected bool isKinematic2D;
|
||||
|
||||
// internal management
|
||||
protected GameObjectType realType;
|
||||
protected int fingerIndex =-1;
|
||||
#endregion
|
||||
|
||||
#region Monobehavior Callback
|
||||
void Awake(){
|
||||
cachedRigidBody = GetComponent<Rigidbody>();
|
||||
if (cachedRigidBody){
|
||||
isKinematic = cachedRigidBody.isKinematic;
|
||||
}
|
||||
|
||||
cachedRigidBody2D = GetComponent<Rigidbody2D>();
|
||||
if (cachedRigidBody2D){
|
||||
isKinematic2D = cachedRigidBody2D.isKinematic;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public virtual void Start(){
|
||||
|
||||
EasyTouch.SetEnableAutoSelect( true);
|
||||
|
||||
realType = GameObjectType.Obj_3D;
|
||||
|
||||
if (GetComponent<Collider>()){
|
||||
realType = GameObjectType.Obj_3D;
|
||||
}
|
||||
else if (GetComponent<Collider2D>()){
|
||||
realType = GameObjectType.Obj_2D;
|
||||
}
|
||||
else if (GetComponent<CanvasRenderer>()){
|
||||
realType = GameObjectType.UI;
|
||||
}
|
||||
|
||||
|
||||
switch (realType){
|
||||
|
||||
case GameObjectType.Obj_3D:
|
||||
LayerMask mask = EasyTouch.Get3DPickableLayer();
|
||||
mask = mask | 1<<gameObject.layer;
|
||||
EasyTouch.Set3DPickableLayer( mask);
|
||||
break;
|
||||
//2D
|
||||
case GameObjectType.Obj_2D:
|
||||
EasyTouch.SetEnable2DCollider( true);
|
||||
mask = EasyTouch.Get2DPickableLayer();
|
||||
mask = mask | 1<<gameObject.layer;
|
||||
EasyTouch.Set2DPickableLayer( mask);
|
||||
break;
|
||||
// UI
|
||||
case GameObjectType.UI:
|
||||
EasyTouch.instance.enableUIMode = true;
|
||||
EasyTouch.SetUICompatibily( false);
|
||||
break;
|
||||
}
|
||||
|
||||
if (enablePickOverUI){
|
||||
EasyTouch.instance.enableUIMode = true;
|
||||
EasyTouch.SetUICompatibily( false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public virtual void OnEnable(){
|
||||
//QuickTouchManager.instance.RegisterQuickAction( this);
|
||||
}
|
||||
|
||||
public virtual void OnDisable(){
|
||||
//if (QuickTouchManager._instance){
|
||||
// QuickTouchManager.instance.UnregisterQuickAction( this);
|
||||
//}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Protected Methods
|
||||
protected Vector3 GetInfluencedAxis(){
|
||||
|
||||
Vector3 axis = Vector3.zero;
|
||||
|
||||
switch(axesAction){
|
||||
case AffectedAxesAction.X:
|
||||
axis = new Vector3(1,0,0);
|
||||
break;
|
||||
case AffectedAxesAction.Y:
|
||||
axis = new Vector3(0,1,0);
|
||||
break;
|
||||
case AffectedAxesAction.Z:
|
||||
axis = new Vector3(0,0,1);
|
||||
break;
|
||||
case AffectedAxesAction.XY:
|
||||
axis = new Vector3(1,1,0);
|
||||
break;
|
||||
case AffectedAxesAction.XYZ:
|
||||
axis = new Vector3(1,1,1);
|
||||
break;
|
||||
case AffectedAxesAction.XZ:
|
||||
axis = new Vector3(1,0,1);
|
||||
break;
|
||||
case AffectedAxesAction.YZ:
|
||||
axis = new Vector3(0,1,1);
|
||||
break;
|
||||
}
|
||||
|
||||
return axis;
|
||||
}
|
||||
|
||||
protected void DoDirectAction(float value){
|
||||
|
||||
|
||||
Vector3 localAxis = GetInfluencedAxis();
|
||||
|
||||
switch ( directAction){
|
||||
// Rotate
|
||||
case DirectAction.Rotate:
|
||||
transform.Rotate( localAxis * value, Space.World);
|
||||
break;
|
||||
// Rotate Local
|
||||
case DirectAction.RotateLocal:
|
||||
transform.Rotate( localAxis * value,Space.Self);
|
||||
break;
|
||||
// Translate
|
||||
case DirectAction.Translate:
|
||||
if ( directCharacterController==null){
|
||||
transform.Translate(localAxis * value,Space.World);
|
||||
}
|
||||
else{
|
||||
Vector3 direction = localAxis * value;
|
||||
directCharacterController.Move( direction );
|
||||
}
|
||||
break;
|
||||
|
||||
// Translate local
|
||||
case DirectAction.TranslateLocal:
|
||||
if ( directCharacterController==null){
|
||||
transform.Translate(localAxis * value,Space.Self);
|
||||
}
|
||||
else{
|
||||
Vector3 direction = directCharacterController.transform.TransformDirection(localAxis) * value;
|
||||
directCharacterController.Move( direction );
|
||||
}
|
||||
break;
|
||||
// Scale
|
||||
case DirectAction.Scale:
|
||||
transform.localScale += localAxis * value;
|
||||
break;
|
||||
|
||||
/*
|
||||
// Force
|
||||
case DirectAction.Force:
|
||||
if (directRigidBody!=null){
|
||||
directRigidBody.AddForce( localAxis * axisValue * speed);
|
||||
}
|
||||
break;
|
||||
// Relative force
|
||||
case DirectAction.RelativeForce:
|
||||
if (directRigidBody!=null){
|
||||
directRigidBody.AddRelativeForce( localAxis * axisValue * speed);
|
||||
}
|
||||
break;
|
||||
// Torque
|
||||
case DirectAction.Torque:
|
||||
if (directRigidBody!=null){
|
||||
directRigidBody.AddTorque(localAxis * axisValue * speed);
|
||||
}
|
||||
|
||||
break;
|
||||
// Relative torque
|
||||
case DirectAction.RelativeTorque:
|
||||
if (directRigidBody!=null){
|
||||
directRigidBody.AddRelativeTorque(localAxis * axisValue * speed);
|
||||
}
|
||||
break;*/
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public void EnabledQuickComponent(string quickActionName){
|
||||
|
||||
QuickBase[] quickBases = GetComponents<QuickBase>();
|
||||
foreach( QuickBase qb in quickBases){
|
||||
if (qb.quickActionName == quickActionName){
|
||||
qb.enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void DisabledQuickComponent(string quickActionName){
|
||||
|
||||
QuickBase[] quickBases = GetComponents<QuickBase>();
|
||||
foreach( QuickBase qb in quickBases){
|
||||
if (qb.quickActionName == quickActionName){
|
||||
qb.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void DisabledAllSwipeExcepted(string quickActionName){
|
||||
|
||||
QuickSwipe[] swipes = FindObjectsOfType(typeof(QuickSwipe)) as QuickSwipe[];
|
||||
foreach( QuickSwipe swipe in swipes){
|
||||
if (swipe.quickActionName != quickActionName || ( swipe.quickActionName == quickActionName && swipe.gameObject != gameObject)){
|
||||
swipe.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d28476965576224d90d72d674d604cf
|
||||
timeCreated: 1450162043
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
243
Assets/EasyTouchBundle/EasyTouch/Plugins/Components/QuickDrag.cs
Normal file
@@ -0,0 +1,243 @@
|
||||
/***********************************************
|
||||
EasyTouch V
|
||||
Copyright © 2014-2015 The Hedgehog Team
|
||||
http://www.thehedgehogteam.com/Forum/
|
||||
|
||||
The.Hedgehog.Team@gmail.com
|
||||
|
||||
**********************************************/
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using HedgehogTeam.EasyTouch;
|
||||
|
||||
namespace HedgehogTeam.EasyTouch{
|
||||
[AddComponentMenu("EasyTouch/Quick Drag")]
|
||||
public class QuickDrag: QuickBase {
|
||||
|
||||
#region Events
|
||||
[System.Serializable] public class OnDragStart : UnityEvent<Gesture>{}
|
||||
[System.Serializable] public class OnDrag : UnityEvent<Gesture>{}
|
||||
[System.Serializable] public class OnDragEnd : UnityEvent<Gesture>{}
|
||||
|
||||
[SerializeField]
|
||||
public OnDragStart onDragStart;
|
||||
[SerializeField]
|
||||
public OnDrag onDrag;
|
||||
[SerializeField]
|
||||
public OnDragEnd onDragEnd;
|
||||
#endregion
|
||||
|
||||
#region Members
|
||||
public bool isStopOncollisionEnter = false;
|
||||
|
||||
private Vector3 deltaPosition;
|
||||
private bool isOnDrag = false;
|
||||
private Gesture lastGesture;
|
||||
#endregion
|
||||
|
||||
#region Monobehaviour CallBack
|
||||
public QuickDrag(){
|
||||
quickActionName = "QuickDrag"+ System.Guid.NewGuid().ToString().Substring(0,7);
|
||||
axesAction = AffectedAxesAction.XY;
|
||||
}
|
||||
|
||||
public override void OnEnable(){
|
||||
base.OnEnable();
|
||||
EasyTouch.On_TouchStart += On_TouchStart;
|
||||
EasyTouch.On_TouchDown += On_TouchDown;
|
||||
EasyTouch.On_TouchUp += On_TouchUp;
|
||||
EasyTouch.On_Drag += On_Drag;
|
||||
EasyTouch.On_DragStart += On_DragStart;
|
||||
EasyTouch.On_DragEnd += On_DragEnd;
|
||||
}
|
||||
|
||||
public override void OnDisable(){
|
||||
base.OnDisable();
|
||||
UnsubscribeEvent();
|
||||
}
|
||||
|
||||
void OnDestroy(){
|
||||
UnsubscribeEvent();
|
||||
}
|
||||
|
||||
void UnsubscribeEvent(){
|
||||
EasyTouch.On_TouchStart -= On_TouchStart;
|
||||
EasyTouch.On_TouchDown -= On_TouchDown;
|
||||
EasyTouch.On_TouchUp -= On_TouchUp;
|
||||
EasyTouch.On_Drag -= On_Drag;
|
||||
EasyTouch.On_DragStart -= On_DragStart;
|
||||
EasyTouch.On_DragEnd -= On_DragEnd;
|
||||
}
|
||||
|
||||
void OnCollisionEnter(){
|
||||
if (isStopOncollisionEnter && isOnDrag){
|
||||
StopDrag();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region EasyTouch Event
|
||||
void On_TouchStart (Gesture gesture){
|
||||
|
||||
if ( realType == GameObjectType.UI){
|
||||
if (gesture.isOverGui ){
|
||||
if ((gesture.pickedUIElement == gameObject || gesture.pickedUIElement.transform.IsChildOf( transform)) && fingerIndex==-1){
|
||||
|
||||
fingerIndex = gesture.fingerIndex;
|
||||
transform.SetAsLastSibling();
|
||||
onDragStart.Invoke(gesture);
|
||||
|
||||
isOnDrag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void On_TouchDown (Gesture gesture){
|
||||
|
||||
if (isOnDrag && fingerIndex == gesture.fingerIndex && realType == GameObjectType.UI){
|
||||
if (gesture.isOverGui ){
|
||||
if ((gesture.pickedUIElement == gameObject || gesture.pickedUIElement.transform.IsChildOf( transform)) ){
|
||||
transform.position += (Vector3)gesture.deltaPosition;
|
||||
|
||||
if (gesture.deltaPosition != Vector2.zero){
|
||||
onDrag.Invoke(gesture);
|
||||
}
|
||||
lastGesture = gesture;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void On_TouchUp (Gesture gesture){
|
||||
|
||||
if (fingerIndex == gesture.fingerIndex && realType == GameObjectType.UI){
|
||||
lastGesture = gesture;
|
||||
StopDrag();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// At the drag beginning
|
||||
void On_DragStart( Gesture gesture){
|
||||
|
||||
if (realType != GameObjectType.UI){
|
||||
|
||||
if ((!enablePickOverUI && gesture.pickedUIElement == null) || enablePickOverUI){
|
||||
if (gesture.pickedObject == gameObject && !isOnDrag){
|
||||
|
||||
isOnDrag = true;
|
||||
|
||||
fingerIndex = gesture.fingerIndex;
|
||||
|
||||
// the world coordinate from touch
|
||||
Vector3 position = gesture.GetTouchToWorldPoint(gesture.pickedObject.transform.position);
|
||||
deltaPosition = position - transform.position;
|
||||
|
||||
//
|
||||
if (resetPhysic){
|
||||
if (cachedRigidBody){
|
||||
cachedRigidBody.isKinematic = true;
|
||||
}
|
||||
|
||||
if (cachedRigidBody2D){
|
||||
cachedRigidBody2D.isKinematic = true;
|
||||
}
|
||||
}
|
||||
|
||||
onDragStart.Invoke(gesture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// During the drag
|
||||
void On_Drag(Gesture gesture){
|
||||
|
||||
if (fingerIndex == gesture.fingerIndex){
|
||||
if (realType == GameObjectType.Obj_2D || realType == GameObjectType.Obj_3D){
|
||||
|
||||
// Verification that the action on the object
|
||||
if (gesture.pickedObject == gameObject && fingerIndex == gesture.fingerIndex){
|
||||
|
||||
// the world coordinate from touch
|
||||
Vector3 position = gesture.GetTouchToWorldPoint(gesture.pickedObject.transform.position)-deltaPosition;
|
||||
transform.position = GetPositionAxes( position);
|
||||
|
||||
if (gesture.deltaPosition != Vector2.zero){
|
||||
onDrag.Invoke(gesture);
|
||||
|
||||
}
|
||||
lastGesture = gesture;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// End of drag
|
||||
void On_DragEnd(Gesture gesture){
|
||||
|
||||
if (fingerIndex == gesture.fingerIndex){
|
||||
lastGesture = gesture;
|
||||
StopDrag();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Method
|
||||
private Vector3 GetPositionAxes(Vector3 position){
|
||||
|
||||
Vector3 axes = position;
|
||||
|
||||
switch (axesAction){
|
||||
case AffectedAxesAction.X:
|
||||
axes = new Vector3(position.x,transform.position.y,transform.position.z);
|
||||
break;
|
||||
case AffectedAxesAction.Y:
|
||||
axes = new Vector3(transform.position.x,position.y,transform.position.z);
|
||||
break;
|
||||
case AffectedAxesAction.Z:
|
||||
axes = new Vector3(transform.position.x,transform.position.y,position.z);
|
||||
break;
|
||||
case AffectedAxesAction.XY:
|
||||
axes = new Vector3(position.x,position.y,transform.position.z);
|
||||
break;
|
||||
case AffectedAxesAction.XZ:
|
||||
axes = new Vector3(position.x,transform.position.y,position.z);
|
||||
break;
|
||||
case AffectedAxesAction.YZ:
|
||||
axes = new Vector3(transform.position.x,position.y,position.z);
|
||||
break;
|
||||
}
|
||||
|
||||
return axes;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Method
|
||||
public void StopDrag(){
|
||||
|
||||
fingerIndex = -1;
|
||||
|
||||
if (resetPhysic){
|
||||
if (cachedRigidBody){
|
||||
cachedRigidBody.isKinematic = isKinematic;
|
||||
}
|
||||
|
||||
if (cachedRigidBody2D){
|
||||
cachedRigidBody2D.isKinematic = isKinematic2D;
|
||||
}
|
||||
}
|
||||
isOnDrag = false;
|
||||
|
||||
onDragEnd.Invoke(lastGesture);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7961076ef9aef0341b2c9f8a38bfbc71
|
||||
timeCreated: 1452768029
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 61719e5cd5d2e754280e0dd736d759ec, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,142 @@
|
||||
/***********************************************
|
||||
EasyTouch V
|
||||
Copyright © 2014-2015 The Hedgehog Team
|
||||
http://www.thehedgehogteam.com/Forum/
|
||||
|
||||
The.Hedgehog.Team@gmail.com
|
||||
|
||||
**********************************************/
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace HedgehogTeam.EasyTouch{
|
||||
[AddComponentMenu("EasyTouch/Quick Enter-Over-Exit")]
|
||||
public class QuickEnterOverExist : QuickBase {
|
||||
|
||||
#region Event
|
||||
[System.Serializable] public class OnTouchEnter : UnityEvent<Gesture>{}
|
||||
[System.Serializable] public class OnTouchOver : UnityEvent<Gesture>{}
|
||||
[System.Serializable] public class OnTouchExit : UnityEvent<Gesture>{}
|
||||
|
||||
[SerializeField]
|
||||
public OnTouchEnter onTouchEnter;
|
||||
[SerializeField]
|
||||
public OnTouchOver onTouchOver;
|
||||
[SerializeField]
|
||||
public OnTouchExit onTouchExit;
|
||||
#endregion
|
||||
|
||||
#region Members
|
||||
private bool[] fingerOver = new bool[100];
|
||||
#endregion
|
||||
|
||||
#region MonoBehaviour callback
|
||||
public QuickEnterOverExist(){
|
||||
quickActionName = "QuickEnterOverExit"+ System.Guid.NewGuid().ToString().Substring(0,7);
|
||||
}
|
||||
|
||||
void Awake(){
|
||||
|
||||
for (int i=0;i<100;i++){
|
||||
fingerOver[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnEnable(){
|
||||
base.OnEnable();
|
||||
EasyTouch.On_TouchDown += On_TouchDown;
|
||||
EasyTouch.On_TouchUp += On_TouchUp;
|
||||
}
|
||||
|
||||
public override void OnDisable(){
|
||||
base.OnDisable();
|
||||
UnsubscribeEvent();
|
||||
}
|
||||
|
||||
void OnDestroy(){
|
||||
UnsubscribeEvent();
|
||||
}
|
||||
|
||||
void UnsubscribeEvent(){
|
||||
EasyTouch.On_TouchDown -= On_TouchDown;
|
||||
EasyTouch.On_TouchUp -= On_TouchUp;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region EasyTouch Event
|
||||
void On_TouchDown (Gesture gesture){
|
||||
|
||||
if (realType != GameObjectType.UI){
|
||||
if ((!enablePickOverUI && gesture.GetCurrentFirstPickedUIElement() == null) || enablePickOverUI){
|
||||
|
||||
if ( gesture.GetCurrentPickedObject()== gameObject){
|
||||
if (!fingerOver[gesture.fingerIndex] && ((!isOnTouch && !isMultiTouch) || isMultiTouch)){
|
||||
fingerOver[gesture.fingerIndex] = true;
|
||||
onTouchEnter.Invoke( gesture);
|
||||
isOnTouch = true;
|
||||
}
|
||||
else if (fingerOver[gesture.fingerIndex]){
|
||||
onTouchOver.Invoke(gesture);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (fingerOver[gesture.fingerIndex]){
|
||||
fingerOver[gesture.fingerIndex] = false;
|
||||
onTouchExit.Invoke(gesture);
|
||||
if (!isMultiTouch){
|
||||
isOnTouch = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if ( gesture.GetCurrentPickedObject()== gameObject && (!enablePickOverUI && gesture.GetCurrentFirstPickedUIElement() != null)){
|
||||
if (fingerOver[gesture.fingerIndex]){
|
||||
fingerOver[gesture.fingerIndex] = false;
|
||||
onTouchExit.Invoke(gesture);
|
||||
if (!isMultiTouch){
|
||||
isOnTouch = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if ( gesture.GetCurrentFirstPickedUIElement()== gameObject){
|
||||
if (!fingerOver[gesture.fingerIndex] && ((!isOnTouch && !isMultiTouch) || isMultiTouch)){
|
||||
fingerOver[gesture.fingerIndex] = true;
|
||||
onTouchEnter.Invoke( gesture);
|
||||
isOnTouch = true;
|
||||
}
|
||||
else if (fingerOver[gesture.fingerIndex]){
|
||||
onTouchOver.Invoke(gesture);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (fingerOver[gesture.fingerIndex]){
|
||||
fingerOver[gesture.fingerIndex] = false;
|
||||
onTouchExit.Invoke(gesture);
|
||||
if (!isMultiTouch){
|
||||
isOnTouch = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void On_TouchUp (Gesture gesture){
|
||||
|
||||
if (fingerOver[gesture.fingerIndex]){
|
||||
fingerOver[gesture.fingerIndex] = false;
|
||||
onTouchExit.Invoke(gesture);
|
||||
if (!isMultiTouch){
|
||||
isOnTouch = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9b7affbfb3c1534484689f270420489
|
||||
timeCreated: 1450162323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 61719e5cd5d2e754280e0dd736d759ec, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,125 @@
|
||||
/***********************************************
|
||||
EasyTouch V
|
||||
Copyright © 2014-2015 The Hedgehog Team
|
||||
http://www.thehedgehogteam.com/Forum/
|
||||
|
||||
The.Hedgehog.Team@gmail.com
|
||||
|
||||
**********************************************/
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace HedgehogTeam.EasyTouch{
|
||||
[AddComponentMenu("EasyTouch/Quick LongTap")]
|
||||
public class QuickLongTap : QuickBase {
|
||||
|
||||
#region Events
|
||||
[System.Serializable] public class OnLongTap : UnityEvent<Gesture>{}
|
||||
|
||||
[SerializeField]
|
||||
public OnLongTap onLongTap;
|
||||
#endregion
|
||||
|
||||
#region Enumeration
|
||||
public enum ActionTriggering {Start,InProgress,End};
|
||||
#endregion
|
||||
|
||||
#region Members
|
||||
public ActionTriggering actionTriggering;
|
||||
private Gesture currentGesture;
|
||||
#endregion
|
||||
|
||||
public QuickLongTap(){
|
||||
quickActionName = "QuickLongTap"+ System.Guid.NewGuid().ToString().Substring(0,7);
|
||||
}
|
||||
|
||||
void Update(){
|
||||
currentGesture = EasyTouch.current;
|
||||
|
||||
if (currentGesture != null)
|
||||
{
|
||||
|
||||
if (!is2Finger)
|
||||
{
|
||||
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_TouchStart && fingerIndex == -1 && IsOverMe(currentGesture))
|
||||
{
|
||||
fingerIndex = currentGesture.fingerIndex;
|
||||
}
|
||||
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_LongTapStart && actionTriggering == ActionTriggering.Start)
|
||||
{
|
||||
if (currentGesture.fingerIndex == fingerIndex || isMultiTouch)
|
||||
{
|
||||
|
||||
DoAction(currentGesture);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_LongTap && actionTriggering == ActionTriggering.InProgress)
|
||||
{
|
||||
if (currentGesture.fingerIndex == fingerIndex || isMultiTouch)
|
||||
{
|
||||
DoAction(currentGesture);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_LongTapEnd && actionTriggering == ActionTriggering.End)
|
||||
{
|
||||
if (currentGesture.fingerIndex == fingerIndex || isMultiTouch)
|
||||
{
|
||||
DoAction(currentGesture);
|
||||
fingerIndex = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_LongTapStart2Fingers && actionTriggering == ActionTriggering.Start)
|
||||
{
|
||||
DoAction(currentGesture);
|
||||
}
|
||||
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_LongTap2Fingers && actionTriggering == ActionTriggering.InProgress)
|
||||
{
|
||||
DoAction(currentGesture);
|
||||
}
|
||||
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_LongTapEnd2Fingers && actionTriggering == ActionTriggering.End)
|
||||
{
|
||||
DoAction(currentGesture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DoAction(Gesture gesture){
|
||||
if (IsOverMe(gesture)){
|
||||
onLongTap.Invoke( gesture);
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsOverMe(Gesture gesture){
|
||||
bool returnValue = false;
|
||||
|
||||
if ( realType == GameObjectType.UI){
|
||||
if (gesture.isOverGui ){
|
||||
if ((gesture.pickedUIElement == gameObject || gesture.pickedUIElement.transform.IsChildOf( transform))){
|
||||
returnValue = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if ((!enablePickOverUI && gesture.pickedUIElement == null) || enablePickOverUI){
|
||||
if (EasyTouch.GetGameObjectAt( gesture.position,is2Finger) == gameObject){
|
||||
returnValue = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96373da5010ca9442a11456032621dc3
|
||||
timeCreated: 1452769950
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 61719e5cd5d2e754280e0dd736d759ec, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,139 @@
|
||||
/***********************************************
|
||||
EasyTouch V
|
||||
Copyright © 2014-2015 The Hedgehog Team
|
||||
http://www.thehedgehogteam.com/Forum/
|
||||
|
||||
The.Hedgehog.Team@gmail.com
|
||||
|
||||
**********************************************/
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace HedgehogTeam.EasyTouch{
|
||||
[AddComponentMenu("EasyTouch/Quick Pinch")]
|
||||
public class QuickPinch : QuickBase {
|
||||
|
||||
#region Events
|
||||
[System.Serializable] public class OnPinchAction : UnityEvent<Gesture>{}
|
||||
|
||||
[SerializeField]
|
||||
public OnPinchAction onPinchAction;
|
||||
#endregion
|
||||
|
||||
#region enumeration
|
||||
public enum ActionTiggering {InProgress,End};
|
||||
public enum ActionPinchDirection {All, PinchIn, PinchOut};
|
||||
#endregion
|
||||
|
||||
#region Members
|
||||
public bool isGestureOnMe = false;
|
||||
public ActionTiggering actionTriggering;
|
||||
public ActionPinchDirection pinchDirection;
|
||||
private float axisActionValue = 0;
|
||||
public bool enableSimpleAction = false;
|
||||
#endregion
|
||||
|
||||
#region MonoBehaviour callback
|
||||
public QuickPinch(){
|
||||
quickActionName = "QuickPinch"+ System.Guid.NewGuid().ToString().Substring(0,7);
|
||||
}
|
||||
|
||||
public override void OnEnable(){
|
||||
EasyTouch.On_Pinch += On_Pinch;
|
||||
EasyTouch.On_PinchIn += On_PinchIn;
|
||||
EasyTouch.On_PinchOut += On_PinchOut;
|
||||
EasyTouch.On_PinchEnd += On_PichEnd;
|
||||
}
|
||||
|
||||
public override void OnDisable(){
|
||||
UnsubscribeEvent();
|
||||
}
|
||||
|
||||
void OnDestroy(){
|
||||
UnsubscribeEvent();
|
||||
}
|
||||
|
||||
void UnsubscribeEvent(){
|
||||
EasyTouch.On_Pinch -= On_Pinch;
|
||||
EasyTouch.On_PinchIn -= On_PinchIn;
|
||||
EasyTouch.On_PinchOut -= On_PinchOut;
|
||||
EasyTouch.On_PinchEnd -= On_PichEnd;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region EasyTouch event
|
||||
void On_Pinch (Gesture gesture){
|
||||
|
||||
if (actionTriggering == ActionTiggering.InProgress && pinchDirection == ActionPinchDirection.All){
|
||||
DoAction( gesture);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void On_PinchIn (Gesture gesture){
|
||||
|
||||
if (actionTriggering == ActionTiggering.InProgress & pinchDirection == ActionPinchDirection.PinchIn){
|
||||
DoAction( gesture);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void On_PinchOut (Gesture gesture){
|
||||
|
||||
if (actionTriggering == ActionTiggering.InProgress & pinchDirection == ActionPinchDirection.PinchOut){
|
||||
DoAction( gesture);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void On_PichEnd (Gesture gesture){
|
||||
|
||||
if (actionTriggering == ActionTiggering.End){
|
||||
DoAction( gesture);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private method
|
||||
void DoAction(Gesture gesture){
|
||||
|
||||
axisActionValue = gesture.deltaPinch * sensibility * Time.deltaTime;
|
||||
|
||||
if (isGestureOnMe){
|
||||
if ( realType == GameObjectType.UI){
|
||||
if (gesture.isOverGui ){
|
||||
if ((gesture.pickedUIElement == gameObject || gesture.pickedUIElement.transform.IsChildOf( transform))){
|
||||
onPinchAction.Invoke(gesture);
|
||||
if (enableSimpleAction){
|
||||
DoDirectAction( axisActionValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if ((!enablePickOverUI && gesture.pickedUIElement == null) || enablePickOverUI){
|
||||
if (gesture.GetCurrentPickedObject(true) == gameObject){
|
||||
onPinchAction.Invoke(gesture);
|
||||
if (enableSimpleAction){
|
||||
DoDirectAction( axisActionValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if ((!enablePickOverUI && gesture.pickedUIElement == null) || enablePickOverUI){
|
||||
onPinchAction.Invoke(gesture);
|
||||
if (enableSimpleAction){
|
||||
DoDirectAction( axisActionValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82a53e7679dd5fe4a97e230b88ebc585
|
||||
timeCreated: 1450353100
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 61719e5cd5d2e754280e0dd736d759ec, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,223 @@
|
||||
/***********************************************
|
||||
EasyTouch V
|
||||
Copyright © 2014-2015 The Hedgehog Team
|
||||
http://www.thehedgehogteam.com/Forum/
|
||||
|
||||
The.Hedgehog.Team@gmail.com
|
||||
|
||||
**********************************************/
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace HedgehogTeam.EasyTouch{
|
||||
[AddComponentMenu("EasyTouch/Quick Swipe")]
|
||||
public class QuickSwipe : QuickBase {
|
||||
|
||||
#region Events
|
||||
[System.Serializable] public class OnSwipeAction : UnityEvent<Gesture>{}
|
||||
|
||||
[SerializeField]
|
||||
public OnSwipeAction onSwipeAction;
|
||||
#endregion
|
||||
|
||||
#region enumeration
|
||||
public enum ActionTriggering {InProgress,End}
|
||||
public enum SwipeDirection {Vertical, Horizontal, DiagonalRight,DiagonalLeft,Up,UpRight, Right,DownRight,Down,DownLeft, Left,UpLeft,All};
|
||||
#endregion
|
||||
|
||||
#region Members
|
||||
public bool allowSwipeStartOverMe = true;
|
||||
public ActionTriggering actionTriggering;
|
||||
public SwipeDirection swipeDirection = SwipeDirection.All;
|
||||
private float axisActionValue = 0;
|
||||
public bool enableSimpleAction = false;
|
||||
#endregion
|
||||
|
||||
#region MonoBehaviour callback
|
||||
public QuickSwipe(){
|
||||
quickActionName = "QuickSwipe" + System.Guid.NewGuid().ToString().Substring(0,7);
|
||||
}
|
||||
|
||||
public override void OnEnable(){
|
||||
base.OnEnable();
|
||||
EasyTouch.On_Drag += On_Drag;
|
||||
EasyTouch.On_Swipe += On_Swipe;
|
||||
EasyTouch.On_DragEnd += On_DragEnd;
|
||||
EasyTouch.On_SwipeEnd += On_SwipeEnd;
|
||||
}
|
||||
|
||||
public override void OnDisable(){
|
||||
base.OnDisable();
|
||||
UnsubscribeEvent();
|
||||
}
|
||||
|
||||
void OnDestroy(){
|
||||
UnsubscribeEvent();
|
||||
}
|
||||
|
||||
void UnsubscribeEvent(){
|
||||
EasyTouch.On_Drag -= On_Drag;
|
||||
EasyTouch.On_Swipe -= On_Swipe;
|
||||
EasyTouch.On_DragEnd -= On_DragEnd;
|
||||
EasyTouch.On_SwipeEnd -= On_SwipeEnd;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region EasyTouch Event
|
||||
void On_Swipe (Gesture gesture){
|
||||
|
||||
if (gesture.touchCount ==1 && ((gesture.pickedObject != gameObject && !allowSwipeStartOverMe) || allowSwipeStartOverMe)){
|
||||
fingerIndex = gesture.fingerIndex;
|
||||
if (actionTriggering == ActionTriggering.InProgress){
|
||||
if (isRightDirection(gesture)){
|
||||
onSwipeAction.Invoke( gesture);
|
||||
if (enableSimpleAction){
|
||||
DoAction(gesture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void On_SwipeEnd (Gesture gesture){
|
||||
if (actionTriggering == ActionTriggering.End && isRightDirection(gesture) ){
|
||||
onSwipeAction.Invoke( gesture);
|
||||
if (enableSimpleAction){
|
||||
DoAction(gesture);
|
||||
}
|
||||
}
|
||||
|
||||
if (fingerIndex == gesture.fingerIndex){
|
||||
fingerIndex =-1;
|
||||
}
|
||||
}
|
||||
|
||||
void On_DragEnd (Gesture gesture){
|
||||
if (gesture.pickedObject == gameObject && allowSwipeStartOverMe){
|
||||
On_SwipeEnd( gesture);
|
||||
}
|
||||
}
|
||||
|
||||
void On_Drag (Gesture gesture){
|
||||
if (gesture.pickedObject == gameObject && allowSwipeStartOverMe){
|
||||
On_Swipe( gesture);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private methods
|
||||
bool isRightDirection(Gesture gesture){
|
||||
float coef = -1;
|
||||
if ( inverseAxisValue){
|
||||
coef = 1;
|
||||
}
|
||||
|
||||
axisActionValue = 0;
|
||||
switch (swipeDirection){
|
||||
case SwipeDirection.All:
|
||||
axisActionValue = gesture.deltaPosition.magnitude*coef;
|
||||
return true;
|
||||
case SwipeDirection.Horizontal:
|
||||
if (gesture.swipe == EasyTouch.SwipeDirection.Left || gesture.swipe == EasyTouch.SwipeDirection.Right){
|
||||
axisActionValue = gesture.deltaPosition.x *coef;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SwipeDirection.Vertical:
|
||||
if (gesture.swipe == EasyTouch.SwipeDirection.Up || gesture.swipe == EasyTouch.SwipeDirection.Down){
|
||||
axisActionValue = gesture.deltaPosition.y*coef;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SwipeDirection.DiagonalLeft:
|
||||
if (gesture.swipe == EasyTouch.SwipeDirection.UpLeft || gesture.swipe == EasyTouch.SwipeDirection.DownRight){
|
||||
axisActionValue = gesture.deltaPosition.magnitude*coef;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SwipeDirection.DiagonalRight:
|
||||
if (gesture.swipe == EasyTouch.SwipeDirection.UpRight || gesture.swipe == EasyTouch.SwipeDirection.DownLeft){
|
||||
axisActionValue = gesture.deltaPosition.magnitude*coef;
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case SwipeDirection.Left:
|
||||
if (gesture.swipe == EasyTouch.SwipeDirection.Left){
|
||||
axisActionValue = gesture.deltaPosition.x*coef;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SwipeDirection.Right:
|
||||
if (gesture.swipe == EasyTouch.SwipeDirection.Right){
|
||||
axisActionValue = gesture.deltaPosition.x*coef;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SwipeDirection.DownLeft:
|
||||
if (gesture.swipe == EasyTouch.SwipeDirection.DownLeft){
|
||||
axisActionValue = gesture.deltaPosition.magnitude*coef;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SwipeDirection.DownRight:
|
||||
if (gesture.swipe == EasyTouch.SwipeDirection.DownRight){
|
||||
|
||||
axisActionValue = gesture.deltaPosition.magnitude*coef;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SwipeDirection.UpLeft:
|
||||
if (gesture.swipe == EasyTouch.SwipeDirection.UpLeft){
|
||||
|
||||
axisActionValue = gesture.deltaPosition.magnitude*coef;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SwipeDirection.UpRight:
|
||||
if (gesture.swipe == EasyTouch.SwipeDirection.UpRight){
|
||||
axisActionValue = gesture.deltaPosition.magnitude*coef;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SwipeDirection.Up:
|
||||
if (gesture.swipe == EasyTouch.SwipeDirection.Up){
|
||||
axisActionValue = gesture.deltaPosition.y*coef;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SwipeDirection.Down:
|
||||
if (gesture.swipe == EasyTouch.SwipeDirection.Down){
|
||||
axisActionValue = gesture.deltaPosition.y*coef;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
axisActionValue = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
void DoAction(Gesture gesture){
|
||||
|
||||
switch (directAction){
|
||||
case DirectAction.Rotate:
|
||||
case DirectAction.RotateLocal:
|
||||
axisActionValue *= sensibility;
|
||||
break;
|
||||
case DirectAction.Translate:
|
||||
case DirectAction.TranslateLocal:
|
||||
case DirectAction.Scale:
|
||||
axisActionValue /= Screen.dpi;
|
||||
axisActionValue *= sensibility;
|
||||
break;
|
||||
}
|
||||
|
||||
DoDirectAction( axisActionValue);
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df757cf29e57b9449a27cd9dc4a9404a
|
||||
timeCreated: 1450163203
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 61719e5cd5d2e754280e0dd736d759ec, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,91 @@
|
||||
/***********************************************
|
||||
EasyTouch V
|
||||
Copyright © 2014-2015 The Hedgehog Team
|
||||
http://www.thehedgehogteam.com/Forum/
|
||||
|
||||
The.Hedgehog.Team@gmail.com
|
||||
|
||||
**********************************************/
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace HedgehogTeam.EasyTouch{
|
||||
[AddComponentMenu("EasyTouch/Quick Tap")]
|
||||
public class QuickTap : QuickBase {
|
||||
|
||||
#region Events
|
||||
[System.Serializable] public class OnTap : UnityEvent<Gesture>{}
|
||||
|
||||
[SerializeField]
|
||||
public OnTap onTap;
|
||||
#endregion
|
||||
|
||||
#region Enumeration
|
||||
public enum ActionTriggering {Simple_Tap,Double_Tap};
|
||||
#endregion
|
||||
|
||||
#region Members
|
||||
public ActionTriggering actionTriggering;
|
||||
private Gesture currentGesture;
|
||||
#endregion
|
||||
|
||||
#region Monobehavior CallBack
|
||||
public QuickTap(){
|
||||
quickActionName = "QuickTap"+ System.Guid.NewGuid().ToString().Substring(0,7);
|
||||
}
|
||||
|
||||
void Update(){
|
||||
currentGesture = EasyTouch.current;
|
||||
|
||||
if (currentGesture != null)
|
||||
{
|
||||
if (!is2Finger)
|
||||
{
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_DoubleTap && actionTriggering == ActionTriggering.Double_Tap)
|
||||
{
|
||||
DoAction(currentGesture);
|
||||
}
|
||||
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_SimpleTap && actionTriggering == ActionTriggering.Simple_Tap)
|
||||
{
|
||||
DoAction(currentGesture);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_DoubleTap2Fingers && actionTriggering == ActionTriggering.Double_Tap)
|
||||
{
|
||||
DoAction(currentGesture);
|
||||
}
|
||||
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_SimpleTap2Fingers && actionTriggering == ActionTriggering.Simple_Tap)
|
||||
{
|
||||
DoAction(currentGesture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
void DoAction(Gesture gesture){
|
||||
if ( realType == GameObjectType.UI){
|
||||
if (gesture.isOverGui ){
|
||||
if ((gesture.pickedUIElement == gameObject || gesture.pickedUIElement.transform.IsChildOf( transform))){
|
||||
onTap.Invoke( gesture);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if ((!enablePickOverUI && gesture.pickedUIElement == null) || enablePickOverUI){
|
||||
if (EasyTouch.GetGameObjectAt( gesture.position,is2Finger) == gameObject){
|
||||
onTap.Invoke( gesture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9c933eb8b407754a8f98425dfaa784f
|
||||
timeCreated: 1452768366
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 61719e5cd5d2e754280e0dd736d759ec, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,131 @@
|
||||
/***********************************************
|
||||
EasyTouch V
|
||||
Copyright © 2014-2015 The Hedgehog Team
|
||||
http://www.thehedgehogteam.com/Forum/
|
||||
|
||||
The.Hedgehog.Team@gmail.com
|
||||
|
||||
**********************************************/
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace HedgehogTeam.EasyTouch{
|
||||
[AddComponentMenu("EasyTouch/Quick Touch")]
|
||||
public class QuickTouch : QuickBase {
|
||||
|
||||
#region Events
|
||||
[System.Serializable] public class OnTouch : UnityEvent<Gesture>{}
|
||||
[System.Serializable] public class OnTouchNotOverMe : UnityEvent<Gesture>{}
|
||||
|
||||
[SerializeField]
|
||||
public OnTouch onTouch;
|
||||
public OnTouchNotOverMe onTouchNotOverMe;
|
||||
#endregion
|
||||
|
||||
#region Enumeration
|
||||
public enum ActionTriggering {Start,Down,Up};
|
||||
#endregion
|
||||
|
||||
#region Members
|
||||
public ActionTriggering actionTriggering;
|
||||
private Gesture currentGesture;
|
||||
#endregion
|
||||
|
||||
#region Monobehavior CallBack
|
||||
public QuickTouch(){
|
||||
quickActionName = "QuickTouch"+ System.Guid.NewGuid().ToString().Substring(0,7);
|
||||
}
|
||||
#endregion
|
||||
|
||||
void Update(){
|
||||
currentGesture = EasyTouch.current;
|
||||
|
||||
if (!is2Finger && currentGesture!=null)
|
||||
{
|
||||
|
||||
// GetIndex at touch start
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_TouchStart && fingerIndex == -1 && IsOverMe(currentGesture)){
|
||||
fingerIndex = currentGesture.fingerIndex;
|
||||
}
|
||||
|
||||
// start
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_TouchStart && actionTriggering == ActionTriggering.Start){
|
||||
if (currentGesture.fingerIndex == fingerIndex || isMultiTouch){
|
||||
DoAction( currentGesture);
|
||||
}
|
||||
}
|
||||
|
||||
// Down
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_TouchDown && actionTriggering == ActionTriggering.Down){
|
||||
if (currentGesture.fingerIndex == fingerIndex || isMultiTouch){
|
||||
DoAction( currentGesture);
|
||||
}
|
||||
}
|
||||
|
||||
// Up
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_TouchUp){
|
||||
if ( actionTriggering == ActionTriggering.Up){
|
||||
if (currentGesture.fingerIndex == fingerIndex || isMultiTouch){
|
||||
if (IsOverMe(currentGesture)){
|
||||
onTouch.Invoke( currentGesture);
|
||||
}
|
||||
else{
|
||||
onTouchNotOverMe.Invoke( currentGesture);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (currentGesture.fingerIndex == fingerIndex){ fingerIndex =-1;}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (currentGesture != null){
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_TouchStart2Fingers && actionTriggering == ActionTriggering.Start) {
|
||||
DoAction(currentGesture);
|
||||
}
|
||||
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_TouchDown2Fingers && actionTriggering == ActionTriggering.Down) {
|
||||
DoAction(currentGesture);
|
||||
}
|
||||
|
||||
if (currentGesture.type == EasyTouch.EvtType.On_TouchUp2Fingers && actionTriggering == ActionTriggering.Up) {
|
||||
DoAction(currentGesture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Private method
|
||||
void DoAction(Gesture gesture){
|
||||
if (IsOverMe(gesture)){
|
||||
onTouch.Invoke( gesture);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private bool IsOverMe(Gesture gesture){
|
||||
bool returnValue = false;
|
||||
|
||||
if ( realType == GameObjectType.UI){
|
||||
if (gesture.isOverGui ){
|
||||
if ((gesture.pickedUIElement == gameObject || gesture.pickedUIElement.transform.IsChildOf( transform))){
|
||||
returnValue = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if ((!enablePickOverUI && gesture.pickedUIElement == null) || enablePickOverUI){
|
||||
if (EasyTouch.GetGameObjectAt( gesture.position,is2Finger) == gameObject){
|
||||
|
||||
returnValue = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5145c5785e18ed6459cb766ecf988d1a
|
||||
timeCreated: 1450164574
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 61719e5cd5d2e754280e0dd736d759ec, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,152 @@
|
||||
/***********************************************
|
||||
EasyTouch V
|
||||
Copyright © 2014-2015 The Hedgehog Team
|
||||
http://www.thehedgehogteam.com/Forum/
|
||||
|
||||
The.Hedgehog.Team@gmail.com
|
||||
|
||||
**********************************************/
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace HedgehogTeam.EasyTouch{
|
||||
[AddComponentMenu("EasyTouch/Quick Twist")]
|
||||
public class QuickTwist : QuickBase {
|
||||
|
||||
#region Events
|
||||
[System.Serializable] public class OnTwistAction : UnityEvent<Gesture>{}
|
||||
|
||||
[SerializeField]
|
||||
public OnTwistAction onTwistAction;
|
||||
#endregion
|
||||
|
||||
#region enumeration
|
||||
public enum ActionTiggering {InProgress,End};
|
||||
public enum ActionRotationDirection {All, Clockwise, Counterclockwise};
|
||||
#endregion
|
||||
|
||||
#region Members
|
||||
public bool isGestureOnMe = false;
|
||||
public ActionTiggering actionTriggering;
|
||||
public ActionRotationDirection rotationDirection;
|
||||
private float axisActionValue = 0;
|
||||
public bool enableSimpleAction = false;
|
||||
#endregion
|
||||
|
||||
#region MonoBehaviour callback
|
||||
public QuickTwist(){
|
||||
quickActionName = "QuickTwist"+ System.Guid.NewGuid().ToString().Substring(0,7);
|
||||
}
|
||||
|
||||
public override void OnEnable(){
|
||||
EasyTouch.On_Twist += On_Twist;
|
||||
EasyTouch.On_TwistEnd += On_TwistEnd;
|
||||
}
|
||||
|
||||
public override void OnDisable(){
|
||||
UnsubscribeEvent();
|
||||
}
|
||||
|
||||
void OnDestroy(){
|
||||
UnsubscribeEvent();
|
||||
}
|
||||
|
||||
void UnsubscribeEvent(){
|
||||
EasyTouch.On_Twist -= On_Twist;
|
||||
EasyTouch.On_TwistEnd -= On_TwistEnd;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region EasyTouch event
|
||||
void On_Twist (Gesture gesture){
|
||||
|
||||
if (actionTriggering == ActionTiggering.InProgress){
|
||||
|
||||
if (IsRightRotation(gesture)){
|
||||
DoAction( gesture);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void On_TwistEnd (Gesture gesture){
|
||||
|
||||
if (actionTriggering == ActionTiggering.End){
|
||||
if (IsRightRotation(gesture)){
|
||||
DoAction( gesture);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private method
|
||||
bool IsRightRotation(Gesture gesture){
|
||||
|
||||
axisActionValue =0;
|
||||
float coef = 1;
|
||||
if ( inverseAxisValue){
|
||||
coef = -1;
|
||||
}
|
||||
|
||||
switch (rotationDirection){
|
||||
case ActionRotationDirection.All:
|
||||
axisActionValue = gesture.twistAngle * sensibility * coef;
|
||||
return true;
|
||||
|
||||
case ActionRotationDirection.Clockwise:
|
||||
if (gesture.twistAngle<0){
|
||||
axisActionValue = gesture.twistAngle * sensibility* coef;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case ActionRotationDirection.Counterclockwise:
|
||||
if (gesture.twistAngle>0){
|
||||
axisActionValue = gesture.twistAngle * sensibility* coef;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void DoAction(Gesture gesture){
|
||||
|
||||
if (isGestureOnMe){
|
||||
if ( realType == GameObjectType.UI){
|
||||
if (gesture.isOverGui ){
|
||||
if ((gesture.pickedUIElement == gameObject || gesture.pickedUIElement.transform.IsChildOf( transform))){
|
||||
onTwistAction.Invoke(gesture);
|
||||
if (enableSimpleAction){
|
||||
DoDirectAction( axisActionValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
if ((!enablePickOverUI && gesture.pickedUIElement == null) || enablePickOverUI){
|
||||
if (gesture.GetCurrentPickedObject( true) == gameObject){
|
||||
onTwistAction.Invoke(gesture);
|
||||
if (enableSimpleAction){
|
||||
DoDirectAction( axisActionValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if ((!enablePickOverUI && gesture.pickedUIElement == null) || enablePickOverUI){
|
||||
onTwistAction.Invoke(gesture);
|
||||
if (enableSimpleAction){
|
||||
DoDirectAction( axisActionValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f38cfe9733704674da647859a90a3734
|
||||
timeCreated: 1450252691
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 61719e5cd5d2e754280e0dd736d759ec, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/EasyTouchBundle/EasyTouch/Plugins/Editor.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 120ecfbfbf21dd042bd7a4989263f1dc
|
||||
folderAsset: yes
|
||||
timeCreated: 1435661089
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,237 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using HedgehogTeam.EasyTouch;
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
using UnityEditor.SceneManagement;
|
||||
#endif
|
||||
|
||||
[CustomEditor(typeof(EasyTouch))]
|
||||
public class EasyTouchInspector : UnityEditor.Editor {
|
||||
|
||||
|
||||
public override void OnInspectorGUI(){
|
||||
|
||||
EasyTouch t = (EasyTouch)target;
|
||||
|
||||
#region General properties
|
||||
EditorGUILayout.Space();
|
||||
t.enable = HTGuiTools.Toggle("Enable EasyTouch", t.enable,true);
|
||||
|
||||
t.enableRemote = HTGuiTools.Toggle("Enable Unity Remote", t.enableRemote,true);
|
||||
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Gui propertie
|
||||
t.showGuiInspector = HTGuiTools.BeginFoldOut( "GUI compatibilty",t.showGuiInspector);
|
||||
if (t.showGuiInspector){
|
||||
HTGuiTools.BeginGroup();{
|
||||
// UGUI
|
||||
|
||||
EditorGUILayout.Space();
|
||||
t.allowUIDetection = HTGuiTools.Toggle("Enable Unity UI detection",t.allowUIDetection,true);
|
||||
if (t.allowUIDetection ){
|
||||
EditorGUI.indentLevel++;
|
||||
t.enableUIMode = HTGuiTools.Toggle("Unity UI compatibilty", t.enableUIMode,true);
|
||||
t.autoUpdatePickedUI = HTGuiTools.Toggle("Auto update picked Unity UI", t.autoUpdatePickedUI,true);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
// NGUI
|
||||
t.enabledNGuiMode = HTGuiTools.Toggle("Enable NGUI compatibilty", t.enabledNGuiMode,true);
|
||||
|
||||
if (t.enabledNGuiMode){
|
||||
|
||||
//EditorGUI.indentLevel++;
|
||||
HTGuiTools.BeginGroup(5);
|
||||
{
|
||||
// layers
|
||||
serializedObject.Update();
|
||||
SerializedProperty layers = serializedObject.FindProperty("nGUILayers");
|
||||
EditorGUILayout.PropertyField( layers,false);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
// Camera
|
||||
|
||||
if (HTGuiTools.Button("Add camera",Color.green,100, false)){
|
||||
t.nGUICameras.Add( null);
|
||||
}
|
||||
|
||||
for (int i=0;i< t.nGUICameras.Count;i++){
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (HTGuiTools.Button("X",Color.red,19)){
|
||||
t.nGUICameras.RemoveAt(i);
|
||||
i--;
|
||||
}
|
||||
else{
|
||||
t.nGUICameras[i] = (Camera)EditorGUILayout.ObjectField("",t.nGUICameras[i],typeof(Camera),true);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
}HTGuiTools.EndGroup();
|
||||
//EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
}HTGuiTools.EndGroup();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Auto selection properties
|
||||
t.showSelectInspector = HTGuiTools.BeginFoldOut( "Automatic selection",t.showSelectInspector);
|
||||
if (t.showSelectInspector){
|
||||
HTGuiTools.BeginGroup();{
|
||||
t.autoSelect = HTGuiTools.Toggle("Enable auto-select",t.autoSelect,true);
|
||||
if (t.autoSelect){
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
// 3d layer
|
||||
serializedObject.Update();
|
||||
SerializedProperty layers = serializedObject.FindProperty("pickableLayers3D");
|
||||
EditorGUILayout.PropertyField( layers,true);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
|
||||
t.autoUpdatePickedObject = HTGuiTools.Toggle( "Auto update picked gameobject",t.autoUpdatePickedObject,true);
|
||||
EditorGUILayout.Space();
|
||||
|
||||
//2D
|
||||
t.enable2D = HTGuiTools.Toggle("Enable 2D collider",t.enable2D,true);
|
||||
if (t.enable2D){
|
||||
serializedObject.Update();
|
||||
layers = serializedObject.FindProperty("pickableLayers2D");
|
||||
EditorGUILayout.PropertyField( layers,true);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
|
||||
// Camera
|
||||
GUILayout.Space(5f);
|
||||
HTGuiTools.BeginGroup(5);
|
||||
{
|
||||
if (HTGuiTools.Button( "Add Camera",Color.green,100)){
|
||||
t.touchCameras.Add(new ECamera(null,false));
|
||||
}
|
||||
for (int i=0;i< t.touchCameras.Count;i++){
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (HTGuiTools.Button("X",Color.red,19)){
|
||||
t.touchCameras.RemoveAt(i);
|
||||
i--;
|
||||
}
|
||||
if (i>=0){
|
||||
t.touchCameras[i].camera = (Camera)EditorGUILayout.ObjectField("",t.touchCameras[i].camera,typeof(Camera),true,GUILayout.MinWidth(150));
|
||||
t.touchCameras[i].guiCamera = EditorGUILayout.ToggleLeft("Gui",t.touchCameras[i].guiCamera,GUILayout.Width(50));
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
}HTGuiTools.EndGroup();
|
||||
}
|
||||
}HTGuiTools.EndGroup();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region General gesture properties
|
||||
t.showGestureInspector = HTGuiTools.BeginFoldOut("General gesture properties",t.showGestureInspector);
|
||||
if (t.showGestureInspector){
|
||||
HTGuiTools.BeginGroup();{
|
||||
t.gesturePriority =(EasyTouch.GesturePriority) EditorGUILayout.EnumPopup("Priority to",t.gesturePriority );
|
||||
t.StationaryTolerance = EditorGUILayout.FloatField("Stationary tolerance",t.StationaryTolerance);
|
||||
t.longTapTime = EditorGUILayout.FloatField("Long tap time",t.longTapTime);
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
t.doubleTapDetection = (EasyTouch.DoubleTapDetection) EditorGUILayout.EnumPopup("Double tap detection",t.doubleTapDetection);
|
||||
if (t.doubleTapDetection == EasyTouch.DoubleTapDetection.ByTime){
|
||||
t.doubleTapTime = EditorGUILayout.Slider("Double tap time",t.doubleTapTime,0.15f,0.4f);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
t.swipeTolerance = EditorGUILayout.FloatField("Swipe tolerance",t.swipeTolerance);
|
||||
t.alwaysSendSwipe = EditorGUILayout.Toggle("always sent swipe event",t.alwaysSendSwipe);
|
||||
|
||||
}HTGuiTools.EndGroup();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 2 fingers gesture
|
||||
t.showTwoFingerInspector = HTGuiTools.BeginFoldOut("Two fingers gesture properties",t.showTwoFingerInspector);
|
||||
if (t.showTwoFingerInspector){
|
||||
HTGuiTools.BeginGroup();{
|
||||
t.enable2FingersGesture = HTGuiTools.Toggle("2 fingers gesture",t.enable2FingersGesture,true);
|
||||
|
||||
if (t.enable2FingersGesture){
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
t.twoFingerPickMethod = (EasyTouch.TwoFingerPickMethod)EditorGUILayout.EnumPopup("Pick method",t.twoFingerPickMethod);
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
|
||||
t.enable2FingersSwipe = HTGuiTools.Toggle("Enable swipe & drag",t.enable2FingersSwipe,true);
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
|
||||
t.enablePinch = HTGuiTools.Toggle("Enable Pinch",t.enablePinch,true);
|
||||
if (t.enablePinch){
|
||||
t.minPinchLength = EditorGUILayout.FloatField("Min pinch length",t.minPinchLength);
|
||||
}
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
|
||||
t.enableTwist = HTGuiTools.Toggle("Enable twist",t.enableTwist,true);
|
||||
if (t.enableTwist){
|
||||
t.minTwistAngle = EditorGUILayout.FloatField("Min twist angle",t.minTwistAngle);
|
||||
}
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}HTGuiTools.EndGroup();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Second Finger simulation
|
||||
t.showSecondFingerInspector = HTGuiTools.BeginFoldOut("Second finger simulation", t.showSecondFingerInspector);
|
||||
if (t.showSecondFingerInspector){
|
||||
HTGuiTools.BeginGroup();{
|
||||
t.enableSimulation = HTGuiTools.Toggle("Enable simulation",t.enableSimulation,true );
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
if (t.enableSimulation){
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
if (t.secondFingerTexture==null){
|
||||
t.secondFingerTexture =Resources.Load("secondFinger") as Texture;
|
||||
}
|
||||
|
||||
t.secondFingerTexture = (Texture)EditorGUILayout.ObjectField("Texture",t.secondFingerTexture,typeof(Texture),true);
|
||||
EditorGUILayout.HelpBox("Change the keys settings for a fash compilation, or if you want to change the keys",MessageType.Info);
|
||||
t.twistKey = (KeyCode)EditorGUILayout.EnumPopup( "Twist & pinch key", t.twistKey);
|
||||
t.swipeKey = (KeyCode)EditorGUILayout.EnumPopup( "Swipe key", t.swipeKey);
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}HTGuiTools.EndGroup();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
if (GUI.changed){
|
||||
EditorUtility.SetDirty(target);
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
EditorSceneManager.MarkSceneDirty( EditorSceneManager.GetActiveScene());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8dd4aa16173f5604085d778e85702c2e
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,93 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections;
|
||||
using UnityEngine.EventSystems;
|
||||
using HedgehogTeam.EasyTouch;
|
||||
|
||||
public static class EasyTouchMenu{
|
||||
|
||||
[MenuItem ("GameObject/EasyTouch/EasyTouch", false, 0)]
|
||||
static void AddEasyTouch(){
|
||||
|
||||
Selection.activeObject = EasyTouch.instance.gameObject;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
[MenuItem ("Window/GameAnalytics/Folder Structure/Revert to original", false, 601)]
|
||||
static void RevertFolders ()
|
||||
{
|
||||
if (!Directory.Exists(Application.dataPath + "/Plugins/GameAnalytics/"))
|
||||
{
|
||||
Debug.LogWarning("Folder structure incompatible, are you already using original folder structure, or have you manually changed the folder structure?");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Directory.Exists(Application.dataPath + "/GameAnalytics/"))
|
||||
AssetDatabase.CreateFolder("Assets", "GameAnalytics");
|
||||
if (!Directory.Exists(Application.dataPath + "/GameAnalytics/Plugins"))
|
||||
AssetDatabase.CreateFolder("Assets/GameAnalytics", "Plugins");
|
||||
|
||||
AssetDatabase.MoveAsset("Assets/Plugins/GameAnalytics/Android", "Assets/GameAnalytics/Plugins/Android");
|
||||
AssetDatabase.MoveAsset("Assets/Plugins/GameAnalytics/Components", "Assets/GameAnalytics/Plugins/Components");
|
||||
AssetDatabase.MoveAsset("Assets/Plugins/GameAnalytics/Examples", "Assets/GameAnalytics/Plugins/Examples");
|
||||
AssetDatabase.MoveAsset("Assets/Plugins/GameAnalytics/Framework", "Assets/GameAnalytics/Plugins/Framework");
|
||||
AssetDatabase.MoveAsset("Assets/Plugins/GameAnalytics/iOS", "Assets/GameAnalytics/Plugins/iOS");
|
||||
AssetDatabase.MoveAsset("Assets/Plugins/GameAnalytics/Playmaker", "Assets/GameAnalytics/Plugins/Playmaker");
|
||||
AssetDatabase.MoveAsset("Assets/Plugins/GameAnalytics/WebPlayer", "Assets/GameAnalytics/Plugins/WebPlayer");
|
||||
|
||||
AssetDatabase.MoveAsset("Assets/Editor/GameAnalytics", "Assets/GameAnalytics/Editor");
|
||||
|
||||
AssetDatabase.DeleteAsset("Assets/Plugins/GameAnalytics");
|
||||
AssetDatabase.DeleteAsset("Assets/Editor/GameAnalytics");
|
||||
|
||||
Debug.Log("Project must be reloaded when reverting folder structure.");
|
||||
EditorApplication.OpenProject(Application.dataPath.Remove(Application.dataPath.Length - "Assets".Length, "Assets".Length));
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
#if true
|
||||
|
||||
#endif*/
|
||||
|
||||
/*
|
||||
[MenuItem ("Window/Easy Touch/Folder Structure/Switch to JS", false, 100)]
|
||||
static void JsFolders(){
|
||||
// EasyTouch is here
|
||||
if (!Directory.Exists(Application.dataPath + "/EasyTouchBundle/EasyTouch/Plugins/")){
|
||||
Debug.LogWarning("Folder structure incompatible, did you already switch to JS folder structure, or have you manually changed the folder structure?");
|
||||
return;
|
||||
}
|
||||
|
||||
// Create Structure
|
||||
if (!Directory.Exists(Application.dataPath + "/Plugins/"))
|
||||
AssetDatabase.CreateFolder("Assets", "Plugins");
|
||||
if (!Directory.Exists(Application.dataPath + "/Plugins/EasyTouch"))
|
||||
AssetDatabase.CreateFolder("Assets/Plugins", "EasyTouch");
|
||||
|
||||
AssetDatabase.MoveAsset("Assets/EasyTouchBundle/EasyTouch/Plugins/Components","Assets/Plugins/EasyTouch/Components");
|
||||
AssetDatabase.MoveAsset("Assets/EasyTouchBundle/EasyTouch/Plugins/Engine","Assets/Plugins/EasyTouch/Engine");
|
||||
|
||||
// Refresh database
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
[MenuItem ("Window/EasyTouch/Folder Structure/Revert to original", false, 200)]
|
||||
static void CFolders(){
|
||||
|
||||
if (!Directory.Exists(Application.dataPath + "/Plugins/EasyTouch/")){
|
||||
Debug.LogWarning("Folder structure incompatible, are you already using original folder structure, or have you manually changed the folder structure?");
|
||||
return;
|
||||
}
|
||||
|
||||
AssetDatabase.MoveAsset("Assets/Plugins/EasyTouch/Components","Assets/EasyTouchBundle/EasyTouch/Plugins/Components");
|
||||
AssetDatabase.MoveAsset("Assets/Plugins/EasyTouch/Engine","Assets/EasyTouchBundle/EasyTouch/Plugins/Engine");
|
||||
|
||||
AssetDatabase.DeleteAsset("Assets/Plugins/EasyTouch");
|
||||
|
||||
Debug.Log("Project must be reloaded when reverting folder structure.");
|
||||
EditorApplication.OpenProject(Application.dataPath.Remove(Application.dataPath.Length - "Assets".Length, "Assets".Length));
|
||||
}*/
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: febc228cacb117e4ca61d1754161d7be
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,199 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using HedgehogTeam.EasyTouch;
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
using UnityEditor.SceneManagement;
|
||||
#endif
|
||||
|
||||
[CustomEditor(typeof(EasyTouchTrigger))]
|
||||
public class EasyTouchTriggerInspector : UnityEditor.Editor {
|
||||
|
||||
public override void OnInspectorGUI(){
|
||||
|
||||
EasyTouchTrigger t = (EasyTouchTrigger)target;
|
||||
|
||||
string[] eventNames = Enum.GetNames( typeof(EasyTouch.EvtType) ) ;
|
||||
eventNames[0] = "Add new event";
|
||||
|
||||
#region Event properties
|
||||
GUILayout.Space(5f);
|
||||
for (int i=1;i<eventNames.Length;i++){
|
||||
|
||||
EasyTouch.EvtType ev = (EasyTouch.EvtType)Enum.Parse( typeof(EasyTouch.EvtType), eventNames[i]);
|
||||
int result = t.receivers.FindIndex(
|
||||
delegate(EasyTouchTrigger.EasyTouchReceiver e){
|
||||
return e.eventName == ev;
|
||||
}
|
||||
);
|
||||
|
||||
if (result>-1){
|
||||
TriggerInspector( ev,t);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Add Event
|
||||
GUI.backgroundColor = Color.green;
|
||||
int index = EditorGUILayout.Popup("", 0, eventNames,"Button");
|
||||
GUI.backgroundColor = Color.white;
|
||||
|
||||
if (index!=0){
|
||||
//AddEvent((EasyTouch.EventName)Enum.Parse( typeof(EasyTouch.EventName), eventNames[index]),t );
|
||||
t.AddTrigger( (EasyTouch.EvtType)Enum.Parse( typeof(EasyTouch.EvtType), eventNames[index]));
|
||||
EditorPrefs.SetBool( eventNames[index], true);
|
||||
}
|
||||
#endregion
|
||||
|
||||
if (GUI.changed){
|
||||
EditorUtility.SetDirty(t);
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
EditorSceneManager.MarkSceneDirty( EditorSceneManager.GetActiveScene());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private void TriggerInspector(EasyTouch.EvtType ev, EasyTouchTrigger t){
|
||||
|
||||
bool folding = EditorPrefs.GetBool( ev.ToString() );
|
||||
folding = HTGuiTools.BeginFoldOut( ev.ToString(),folding,false);
|
||||
EditorPrefs.SetBool( ev.ToString(), folding);
|
||||
|
||||
if (folding){
|
||||
HTGuiTools.BeginGroup();
|
||||
|
||||
int i=0;
|
||||
while (i<t.receivers.Count){
|
||||
|
||||
if (t.receivers[i].eventName == ev){
|
||||
GUI.color = new Color(0.8f,0.8f,0.8f,1);
|
||||
HTGuiTools.BeginGroup(5);
|
||||
GUI.color = Color.white;
|
||||
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
t.receivers[i].enable = HTGuiTools.Toggle("Enable",t.receivers[i].enable,55,true);
|
||||
t.receivers[i].name = EditorGUILayout.TextField("",t.receivers[i].name, GUILayout.MinWidth(130));
|
||||
|
||||
// Delete
|
||||
GUILayout.FlexibleSpace();
|
||||
if (HTGuiTools.Button("X",Color.red,19)){
|
||||
t.receivers[i] = null;
|
||||
t.receivers.RemoveAt( i );
|
||||
EditorGUILayout.EndHorizontal();
|
||||
return;
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
// Restriced
|
||||
//t.receivers[i].restricted = HTGuiTools.Toggle("Restricted to gameobject",t.receivers[i].restricted,true);
|
||||
|
||||
t.receivers[i].triggerType = (EasyTouchTrigger.ETTType)EditorGUILayout.EnumPopup("Testing on",t.receivers[i].triggerType );
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
t.receivers[i].restricted = EditorGUILayout.Toggle("",t.receivers[i].restricted ,(GUIStyle)"Radio" ,GUILayout.Width(15));
|
||||
EditorGUILayout.LabelField("Only if on me (requiered a collider)");
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
t.receivers[i].restricted = !EditorGUILayout.Toggle("",!t.receivers[i].restricted ,(GUIStyle)"Radio",GUILayout.Width(15));
|
||||
EditorGUILayout.LabelField("All the time, or other object");
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (!t.receivers[i].restricted){
|
||||
t.receivers[i].gameObject = (GameObject)EditorGUILayout.ObjectField("Other object",t.receivers[i].gameObject,typeof(GameObject),true);
|
||||
}
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.receivers[i].otherReceiver = HTGuiTools.Toggle("Other receiver",t.receivers[i].otherReceiver,true);
|
||||
if (t.receivers[i].otherReceiver){
|
||||
t.receivers[i].gameObjectReceiver = (GameObject)EditorGUILayout.ObjectField("Receiver",t.receivers[i].gameObjectReceiver,typeof(GameObject),true);
|
||||
}
|
||||
|
||||
// Method Name
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
t.receivers[i].methodName = EditorGUILayout.TextField("Method name",t.receivers[i].methodName);
|
||||
|
||||
// Methode helper
|
||||
string[] mNames = null;
|
||||
if (!t.receivers[i].otherReceiver || (t.receivers[i].otherReceiver && t.receivers[i].gameObjectReceiver == null) ){
|
||||
mNames = GetMethod( t.gameObject);
|
||||
}
|
||||
else if ( t.receivers[i].otherReceiver && t.receivers[i].gameObjectReceiver != null){
|
||||
mNames = GetMethod( t.receivers[i].gameObjectReceiver);
|
||||
}
|
||||
|
||||
int index = EditorGUILayout.Popup("", -1, mNames,"Button",GUILayout.Width(20));
|
||||
if (index>-1){
|
||||
t.receivers[i].methodName = mNames[index];
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
|
||||
// Parameter
|
||||
t.receivers[i].parameter = (EasyTouchTrigger.ETTParameter) EditorGUILayout.EnumPopup("Parameter to send",t.receivers[i].parameter);
|
||||
|
||||
HTGuiTools.EndGroup();
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else{
|
||||
HTGuiTools.BeginGroup();
|
||||
}
|
||||
HTGuiTools.EndGroup(false);
|
||||
|
||||
if (!GUILayout.Toggle(true,"+","ObjectPickerTab")){
|
||||
t.AddTrigger( ev);
|
||||
}
|
||||
|
||||
GUILayout.Space(5f);
|
||||
|
||||
}
|
||||
|
||||
private void AddEvent(EasyTouch.EvtType ev, EasyTouchTrigger t){
|
||||
EasyTouchTrigger.EasyTouchReceiver r = new EasyTouchTrigger.EasyTouchReceiver();
|
||||
r.enable = true;
|
||||
r.restricted = true;
|
||||
r.eventName = ev;
|
||||
r.gameObject = t.gameObject;
|
||||
t.receivers.Add( r );
|
||||
|
||||
}
|
||||
|
||||
private string[] GetMethod(GameObject obj){
|
||||
|
||||
List<string> methodName = new List<string>();
|
||||
|
||||
Component[] allComponents = obj.GetComponents<Component>();
|
||||
|
||||
if (allComponents.Length>0){
|
||||
foreach( Component comp in allComponents){
|
||||
if (comp!=null){
|
||||
if (comp.GetType().IsSubclassOf( typeof(MonoBehaviour))){
|
||||
MethodInfo[] methodInfos = comp.GetType().GetMethods();
|
||||
foreach( MethodInfo methodInfo in methodInfos){
|
||||
if ((methodInfo.DeclaringType.Namespace == null) || (!methodInfo.DeclaringType.Namespace.Contains("Unity") && !methodInfo.DeclaringType.Namespace.Contains("System"))){
|
||||
if (methodInfo.IsPublic){
|
||||
methodName.Add( methodInfo.Name );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
return methodName.ToArray();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c805d42d461a3ee41a947ec0f9e12636
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,203 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System;
|
||||
|
||||
[InitializeOnLoad]
|
||||
public class EasyTouchWelcomeScreen : EditorWindow {
|
||||
|
||||
private const string VERSION = "5.0.0";
|
||||
private const string PLAYMAKERADDONVERSION = "1.0,0";
|
||||
private const string SUPPORTURL = "http://www.thehedgehogteam.com/Forum/";
|
||||
private const string OFFICIALTOPIC = "http://forum.unity3d.com/threads/released-easy-touch.135192/";
|
||||
private const float width = 500;
|
||||
private const float height = 440;
|
||||
|
||||
private const string PREFSHOWATSTARTUP = "EasyTouch.ShowWelcomeScreen";
|
||||
|
||||
private static bool showAtStartup;
|
||||
private static GUIStyle imgHeader;
|
||||
private static bool interfaceInitialized;
|
||||
private static Texture supportIcon;
|
||||
private static Texture cIcon;
|
||||
private static Texture jsIcon;
|
||||
private static Texture playmakerIcon;
|
||||
private static Texture topicIcon;
|
||||
|
||||
|
||||
[MenuItem("Tools/Easy Touch/Welcome Screen", false, 0)]
|
||||
[MenuItem("Window/Easy Touch/Welcome Screen", false, 0)]
|
||||
public static void OpenWelcomeWindow(){
|
||||
GetWindow<EasyTouchWelcomeScreen>(true);
|
||||
}
|
||||
|
||||
[MenuItem ("Tools/Easy Touch/Folder Structure/Switch to JS", false, 100)]
|
||||
public static void JsFolders(){
|
||||
// EasyTouch is here
|
||||
if (!Directory.Exists(Application.dataPath + "/EasyTouchBundle/EasyTouch/Plugins/")){
|
||||
Debug.LogWarning("Folder structure incompatible, did you already switch to JS folder structure, or have you manually changed the folder structure?");
|
||||
return;
|
||||
}
|
||||
|
||||
// Create Structure
|
||||
if (!Directory.Exists(Application.dataPath + "/Plugins/"))
|
||||
AssetDatabase.CreateFolder("Assets", "Plugins");
|
||||
if (!Directory.Exists(Application.dataPath + "/Plugins/EasyTouch"))
|
||||
AssetDatabase.CreateFolder("Assets/Plugins", "EasyTouch");
|
||||
|
||||
AssetDatabase.MoveAsset("Assets/EasyTouchBundle/EasyTouch/Plugins/Components","Assets/Plugins/EasyTouch/Components");
|
||||
AssetDatabase.MoveAsset("Assets/EasyTouchBundle/EasyTouch/Plugins/Engine","Assets/Plugins/EasyTouch/Engine");
|
||||
|
||||
// Refresh database
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
[MenuItem ("Tools/Easy Touch/Folder Structure/Revert to original", false, 200)]
|
||||
public static void CFolders(){
|
||||
|
||||
if (!Directory.Exists(Application.dataPath + "/Plugins/EasyTouch/")){
|
||||
Debug.LogWarning("Folder structure incompatible, are you already using original folder structure, or have you manually changed the folder structure?");
|
||||
return;
|
||||
}
|
||||
|
||||
AssetDatabase.MoveAsset("Assets/Plugins/EasyTouch/Components","Assets/EasyTouchBundle/EasyTouch/Plugins/Components");
|
||||
AssetDatabase.MoveAsset("Assets/Plugins/EasyTouch/Engine","Assets/EasyTouchBundle/EasyTouch/Plugins/Engine");
|
||||
|
||||
AssetDatabase.DeleteAsset("Assets/Plugins/EasyTouch");
|
||||
|
||||
Debug.Log("Project must be reloaded when reverting folder structure.");
|
||||
EditorApplication.OpenProject(Application.dataPath.Remove(Application.dataPath.Length - "Assets".Length, "Assets".Length));
|
||||
}
|
||||
|
||||
static EasyTouchWelcomeScreen(){
|
||||
EditorApplication.playmodeStateChanged -= OnPlayModeChanged;
|
||||
EditorApplication.playmodeStateChanged += OnPlayModeChanged;
|
||||
|
||||
showAtStartup = EditorPrefs.GetBool(PREFSHOWATSTARTUP, true);
|
||||
|
||||
if (showAtStartup){
|
||||
EditorApplication.update -= OpenAtStartup;
|
||||
EditorApplication.update += OpenAtStartup;
|
||||
}
|
||||
}
|
||||
|
||||
static void OpenAtStartup(){
|
||||
OpenWelcomeWindow();
|
||||
EditorApplication.update -= OpenAtStartup;
|
||||
}
|
||||
|
||||
static void OnPlayModeChanged(){
|
||||
EditorApplication.update -= OpenAtStartup;
|
||||
EditorApplication.playmodeStateChanged -= OnPlayModeChanged;
|
||||
}
|
||||
|
||||
void OnEnable(){
|
||||
titleContent = new GUIContent("Welcome To Easy Touch");
|
||||
|
||||
maxSize = new Vector2(width, height);
|
||||
minSize = maxSize;
|
||||
}
|
||||
|
||||
public void OnGUI(){
|
||||
|
||||
InitInterface();
|
||||
GUI.Box(new Rect(0, 0, width, 60), "", imgHeader);
|
||||
GUI.Label( new Rect(width-90,45,200,20),new GUIContent("Version : " +VERSION));
|
||||
GUILayoutUtility.GetRect(position.width, 64);
|
||||
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
if (Button(playmakerIcon,"Install PlayMaker add-on","Requires PlayMaker 1.8 or higher.")){
|
||||
InstallPlayMakerAddOn();
|
||||
}
|
||||
|
||||
if (Button(jsIcon,"Switch to JS","Switch Easy Touch folder structure to be used with Java Script.")){
|
||||
JsFolders();
|
||||
}
|
||||
|
||||
if (Button(cIcon,"Revert to original","Revert Easy Touch folder structure to original (C#).")){
|
||||
CFolders();
|
||||
}
|
||||
|
||||
if (Button(supportIcon,"Community Forum","You need your invoice number to register, if you are a new user.")){
|
||||
Application.OpenURL(SUPPORTURL);
|
||||
}
|
||||
|
||||
if (Button(supportIcon,"Official topic","Official topic on Unity Forum.",3)){
|
||||
Application.OpenURL(OFFICIALTOPIC);
|
||||
}
|
||||
|
||||
bool show = GUILayout.Toggle(showAtStartup, "Show at startup");
|
||||
if (show != showAtStartup){
|
||||
showAtStartup = show;
|
||||
EditorPrefs.SetBool(PREFSHOWATSTARTUP, showAtStartup);
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
|
||||
}
|
||||
|
||||
void InitInterface(){
|
||||
|
||||
if (!interfaceInitialized){
|
||||
imgHeader = new GUIStyle();
|
||||
imgHeader.normal.background = (Texture2D)Resources.Load("EasyTouchWelcome");
|
||||
imgHeader.normal.textColor = Color.white;
|
||||
|
||||
supportIcon = (Texture)Resources.Load("btn_Support") as Texture;
|
||||
playmakerIcon = (Texture)Resources.Load("btn_PlayMaker") as Texture;
|
||||
cIcon = (Texture)Resources.Load("btn_cs") as Texture;
|
||||
jsIcon = (Texture)Resources.Load("btn_js") as Texture;
|
||||
|
||||
interfaceInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool Button(Texture texture, string heading, string body, int space=10){
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
GUILayout.Space(54);
|
||||
GUILayout.Box(texture, GUIStyle.none, GUILayout.MaxWidth(48));
|
||||
GUILayout.Space(10);
|
||||
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Space(1);
|
||||
GUILayout.Label(heading, EditorStyles.boldLabel);
|
||||
GUILayout.Label(body);
|
||||
GUILayout.EndVertical();
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
var rect = GUILayoutUtility.GetLastRect();
|
||||
EditorGUIUtility.AddCursorRect(rect, MouseCursor.Link);
|
||||
|
||||
bool returnValue = false;
|
||||
if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition)){
|
||||
returnValue = true;
|
||||
}
|
||||
|
||||
GUILayout.Space(space);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
private void InstallPlayMakerAddOn(){
|
||||
|
||||
string package = "Assets/EasyTouchBundle/Install/PlayMakerAddOn.unitypackage";
|
||||
|
||||
try
|
||||
{
|
||||
AssetDatabase.ImportPackage(package, true);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Debug.LogError("Failed to import package: " + package);
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d92488c9dd498a84eacbd541c4bf40d2
|
||||
timeCreated: 1451128532
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,62 @@
|
||||
// EasyTouch library is copyright (c) of Hedgehog Team
|
||||
// Please send feedback or bug reports to the.hedgehog.team@gmail.com
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
using HedgehogTeam.EasyTouch;
|
||||
|
||||
[InitializeOnLoad]
|
||||
public class EasytouchHierachyCallBack{
|
||||
|
||||
private static readonly EditorApplication.HierarchyWindowItemCallback hiearchyItemCallback;
|
||||
private static Texture2D hierarchyIcon;
|
||||
private static Texture2D HierarchyIcon {
|
||||
get {
|
||||
if (EasytouchHierachyCallBack.hierarchyIcon==null){
|
||||
EasytouchHierachyCallBack.hierarchyIcon = (Texture2D)Resources.Load( "EasyTouch_Icon");
|
||||
}
|
||||
return EasytouchHierachyCallBack.hierarchyIcon;
|
||||
}
|
||||
}
|
||||
|
||||
private static Texture2D hierarchyEventIcon;
|
||||
private static Texture2D HierarchyEventIcon {
|
||||
get {
|
||||
if (EasytouchHierachyCallBack.hierarchyEventIcon==null){
|
||||
EasytouchHierachyCallBack.hierarchyEventIcon = (Texture2D)Resources.Load( "EasyTouchTrigger_Icon");
|
||||
}
|
||||
return EasytouchHierachyCallBack.hierarchyEventIcon;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// constructor
|
||||
static EasytouchHierachyCallBack()
|
||||
{
|
||||
EasytouchHierachyCallBack.hiearchyItemCallback = new EditorApplication.HierarchyWindowItemCallback(EasytouchHierachyCallBack.DrawHierarchyIcon);
|
||||
EditorApplication.hierarchyWindowItemOnGUI = (EditorApplication.HierarchyWindowItemCallback)Delegate.Combine(EditorApplication.hierarchyWindowItemOnGUI, EasytouchHierachyCallBack.hiearchyItemCallback);
|
||||
|
||||
}
|
||||
|
||||
private static void DrawHierarchyIcon(int instanceID, Rect selectionRect)
|
||||
{
|
||||
GameObject gameObject = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
|
||||
|
||||
if (gameObject != null){
|
||||
Rect rect = new Rect(selectionRect.x + selectionRect.width - 16f, selectionRect.y, 16f, 16f);
|
||||
if ( gameObject.GetComponent<EasyTouch>() != null){
|
||||
GUI.DrawTexture( rect,EasytouchHierachyCallBack.HierarchyIcon);
|
||||
}
|
||||
else if (gameObject.GetComponent<QuickBase>() != null){
|
||||
GUI.DrawTexture( rect,EasytouchHierachyCallBack.HierarchyEventIcon);
|
||||
}
|
||||
#if FALSE
|
||||
else if (gameObject.GetComponent<EasyTouchSceneProxy>() != null){
|
||||
GUI.DrawTexture( rect,EasytouchHierachyCallBack.HierarchyIcon);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6e29b830398aee4baf62ac78801cce1
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
188
Assets/EasyTouchBundle/EasyTouch/Plugins/Editor/HTGuiTools.cs
Normal file
@@ -0,0 +1,188 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
|
||||
public class HTGuiTools{
|
||||
|
||||
private static Texture2D gradientTexture;
|
||||
|
||||
#region Widget
|
||||
public static bool BeginFoldOut(string text,bool foldOut, bool endSpace=true){
|
||||
|
||||
text = "<b><size=11>" + text + "</size></b>";
|
||||
if (foldOut){
|
||||
text = "\u25BC " + text;
|
||||
}
|
||||
else{
|
||||
text = "\u25BA " + text;
|
||||
}
|
||||
|
||||
if ( !GUILayout.Toggle(true,text,"dragtab")){
|
||||
foldOut=!foldOut;
|
||||
}
|
||||
|
||||
if (!foldOut && endSpace)GUILayout.Space(5f);
|
||||
|
||||
return foldOut;
|
||||
}
|
||||
|
||||
public static void BeginGroup(int padding=0){
|
||||
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(padding);
|
||||
//EditorGUILayout.BeginHorizontal("As TextArea", GUILayout.MinHeight(10f));
|
||||
EditorGUILayout.BeginHorizontal("TextArea", GUILayout.MinHeight(10f));
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Space(2f);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void EndGroup(bool endSpace = true){
|
||||
GUILayout.Space(3f);
|
||||
GUILayout.EndVertical();
|
||||
EditorGUILayout.EndHorizontal();
|
||||
GUILayout.Space(3f);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
if (endSpace){
|
||||
GUILayout.Space(10f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static bool Toggle(string text, bool value,bool leftToggle=false){
|
||||
|
||||
//if (value) GUI.backgroundColor = Color.green; else GUI.backgroundColor = Color.red;
|
||||
|
||||
if (leftToggle){
|
||||
value = EditorGUILayout.ToggleLeft(text,value);
|
||||
}
|
||||
else{
|
||||
value = EditorGUILayout.Toggle(text,value);
|
||||
}
|
||||
|
||||
//GUI.backgroundColor = Color.white;
|
||||
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
public static bool Toggle (string text, bool value,int width,bool leftToggle=false){
|
||||
|
||||
if (value) GUI.backgroundColor = Color.green; else GUI.backgroundColor = Color.red;
|
||||
|
||||
if (leftToggle){
|
||||
value = EditorGUILayout.ToggleLeft(text,value,GUILayout.Width( width));
|
||||
}
|
||||
else{
|
||||
value = EditorGUILayout.Toggle(text,value,GUILayout.Width( width));
|
||||
}
|
||||
|
||||
GUI.backgroundColor = Color.white;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static public bool Button(string label,Color color,int width, bool leftAligment=false, int height=0){
|
||||
|
||||
GUI.backgroundColor = color;
|
||||
GUIStyle buttonStyle = new GUIStyle("Button");
|
||||
|
||||
if (leftAligment)
|
||||
buttonStyle.alignment = TextAnchor.MiddleLeft;
|
||||
|
||||
if (height==0){
|
||||
if (GUILayout.Button( label,buttonStyle,GUILayout.Width(width))){
|
||||
GUI.backgroundColor = Color.white;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (GUILayout.Button( label,buttonStyle,GUILayout.Width(width),GUILayout.Height(height))){
|
||||
GUI.backgroundColor = Color.white;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
GUI.backgroundColor = Color.white;
|
||||
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 2d effect
|
||||
public static void DrawSeparatorLine(int padding=0){
|
||||
|
||||
EditorGUILayout.Space();
|
||||
DrawLine(Color.gray, padding);
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
private static void DrawLine(Color color,int padding=0){
|
||||
|
||||
GUILayout.Space(10);
|
||||
Rect lastRect = GUILayoutUtility.GetLastRect();
|
||||
|
||||
GUI.color = color;
|
||||
GUI.DrawTexture(new Rect(padding, lastRect.yMax -lastRect.height/2f, Screen.width, 1f), EditorGUIUtility.whiteTexture);
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Texture
|
||||
private static Rect DrawGradient(int padding, int width, int height=35){
|
||||
|
||||
GUILayout.Space(height);
|
||||
Rect lastRect = GUILayoutUtility.GetLastRect();
|
||||
lastRect.yMin = lastRect.yMin + 7;
|
||||
lastRect.yMax = lastRect.yMax - 7;
|
||||
lastRect.width = Screen.width;
|
||||
|
||||
GUI.DrawTexture(new Rect(padding,lastRect.yMin+1,width, lastRect.yMax- lastRect.yMin), GetGradientTexture());
|
||||
|
||||
return lastRect;
|
||||
}
|
||||
|
||||
private static Texture2D GetGradientTexture(){
|
||||
|
||||
if (gradientTexture==null){
|
||||
gradientTexture = CreateGradientTexture();
|
||||
}
|
||||
return gradientTexture;
|
||||
|
||||
}
|
||||
|
||||
private static Texture2D CreateGradientTexture(){
|
||||
|
||||
int height =18;
|
||||
|
||||
Texture2D myTexture = new Texture2D(1, height);
|
||||
myTexture.hideFlags = HideFlags.HideInInspector;
|
||||
myTexture.hideFlags = HideFlags.DontSave;
|
||||
myTexture.filterMode = FilterMode.Bilinear;
|
||||
|
||||
Color startColor= new Color(0.4f,0.4f,0.4f);
|
||||
Color endColor= new Color(0.6f,0.6f,0.6f);
|
||||
|
||||
float stepR = (endColor.r - startColor.r)/18f;
|
||||
float stepG = (endColor.g - startColor.g)/18f;
|
||||
float stepB = (endColor.b - startColor.b)/18f;
|
||||
|
||||
Color pixColor = startColor;
|
||||
|
||||
for (int i = 1; i < height-1; i++)
|
||||
{
|
||||
pixColor = new Color(pixColor.r + stepR,pixColor.g + stepG , pixColor.b + stepB);
|
||||
myTexture.SetPixel(0, i, pixColor);
|
||||
}
|
||||
|
||||
myTexture.SetPixel(0, 0, new Color(0,0,0));
|
||||
myTexture.SetPixel(0, 17, new Color(1,1,1));
|
||||
|
||||
myTexture.Apply();
|
||||
|
||||
return myTexture;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e63e92782febb546b01ef0a99394021
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,55 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using HedgehogTeam.EasyTouch;
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
using UnityEditor.SceneManagement;
|
||||
#endif
|
||||
|
||||
[CustomEditor(typeof(QuickDrag))]
|
||||
public class QuickDragInspector : UnityEditor.Editor {
|
||||
|
||||
public override void OnInspectorGUI(){
|
||||
|
||||
QuickDrag t = (QuickDrag)target;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.quickActionName = EditorGUILayout.TextField("Quick name",t.quickActionName);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.axesAction = (QuickBase.AffectedAxesAction) EditorGUILayout.EnumPopup("Allow on the axes",t.axesAction);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.enablePickOverUI = EditorGUILayout.ToggleLeft("Allow pick over UI element",t.enablePickOverUI);
|
||||
t.isStopOncollisionEnter = EditorGUILayout.ToggleLeft("Stop drag on collision enter",t.isStopOncollisionEnter);
|
||||
t.resetPhysic = EditorGUILayout.ToggleLeft("Reset physic on drag",t.resetPhysic);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
serializedObject.Update();
|
||||
SerializedProperty start = serializedObject.FindProperty("onDragStart");
|
||||
EditorGUILayout.PropertyField(start, true, null);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
serializedObject.Update();
|
||||
SerializedProperty drag = serializedObject.FindProperty("onDrag");
|
||||
EditorGUILayout.PropertyField(drag, true, null);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
serializedObject.Update();
|
||||
SerializedProperty end = serializedObject.FindProperty("onDragEnd");
|
||||
EditorGUILayout.PropertyField(end, true, null);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (GUI.changed){
|
||||
EditorUtility.SetDirty(t);
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
EditorSceneManager.MarkSceneDirty( EditorSceneManager.GetActiveScene());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90d40bf8ecbb8e54fa449fff98f7c89c
|
||||
timeCreated: 1450091481
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,49 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using HedgehogTeam.EasyTouch;
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
using UnityEditor.SceneManagement;
|
||||
#endif
|
||||
|
||||
[CustomEditor(typeof(QuickEnterOverExist))]
|
||||
public class QuickEnterExitInspector : UnityEditor.Editor {
|
||||
|
||||
public override void OnInspectorGUI(){
|
||||
|
||||
QuickEnterOverExist t = (QuickEnterOverExist)target;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.quickActionName = EditorGUILayout.TextField("Quick name",t.quickActionName);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.isMultiTouch = EditorGUILayout.ToggleLeft("Allow multi-touches",t.isMultiTouch);
|
||||
t.enablePickOverUI = EditorGUILayout.ToggleLeft("Allow over UI element",t.enablePickOverUI);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
serializedObject.Update();
|
||||
SerializedProperty enter = serializedObject.FindProperty("onTouchEnter");
|
||||
EditorGUILayout.PropertyField(enter, true, null);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
serializedObject.Update();
|
||||
SerializedProperty over = serializedObject.FindProperty("onTouchOver");
|
||||
EditorGUILayout.PropertyField(over, true, null);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
serializedObject.Update();
|
||||
SerializedProperty exit = serializedObject.FindProperty("onTouchExit");
|
||||
EditorGUILayout.PropertyField(exit, true, null);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (GUI.changed){
|
||||
EditorUtility.SetDirty(t);
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
EditorSceneManager.MarkSceneDirty( EditorSceneManager.GetActiveScene());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 963a6fd84b5553a49a198120ed07763a
|
||||
timeCreated: 1450161932
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,44 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using HedgehogTeam.EasyTouch;
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
using UnityEditor.SceneManagement;
|
||||
#endif
|
||||
|
||||
[CustomEditor(typeof(QuickLongTap))]
|
||||
public class QuickLongTapInspector : UnityEditor.Editor {
|
||||
|
||||
public override void OnInspectorGUI(){
|
||||
|
||||
QuickLongTap t = (QuickLongTap)target;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.quickActionName = EditorGUILayout.TextField("Name",t.quickActionName);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.is2Finger = EditorGUILayout.Toggle("2 fingers gesture",t.is2Finger);
|
||||
t.actionTriggering = (QuickLongTap.ActionTriggering)EditorGUILayout.EnumPopup("Action triggering",t.actionTriggering);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
if (!t.is2Finger){
|
||||
t.isMultiTouch = EditorGUILayout.ToggleLeft("Allow multi-touch",t.isMultiTouch);
|
||||
}
|
||||
t.enablePickOverUI = EditorGUILayout.ToggleLeft("Allow over UI Element",t.enablePickOverUI);
|
||||
|
||||
serializedObject.Update();
|
||||
SerializedProperty touch = serializedObject.FindProperty("onLongTap");
|
||||
EditorGUILayout.PropertyField(touch, true, null);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (GUI.changed){
|
||||
EditorUtility.SetDirty(t);
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
EditorSceneManager.MarkSceneDirty( EditorSceneManager.GetActiveScene());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dfe87ecedc3ffc64cbf16271e67e7db9
|
||||
timeCreated: 1452769249
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,58 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using HedgehogTeam.EasyTouch;
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
using UnityEditor.SceneManagement;
|
||||
#endif
|
||||
|
||||
[CustomEditor(typeof(QuickPinch))]
|
||||
public class QuickPinchInspector : UnityEditor.Editor {
|
||||
|
||||
public override void OnInspectorGUI(){
|
||||
|
||||
QuickPinch t = (QuickPinch)target;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.quickActionName = EditorGUILayout.TextField("Quick name",t.quickActionName);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.isGestureOnMe = EditorGUILayout.ToggleLeft("Gesture over me", t.isGestureOnMe);
|
||||
t.enablePickOverUI = EditorGUILayout.ToggleLeft("Allow over UI Element",t.enablePickOverUI);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.actionTriggering = (QuickPinch.ActionTiggering)EditorGUILayout.EnumPopup("Triggering",t.actionTriggering);
|
||||
t.pinchDirection = (QuickPinch.ActionPinchDirection)EditorGUILayout.EnumPopup("Pinch direction",t.pinchDirection);
|
||||
//t.rotationDirection = (QuickTwist.ActionRotationDirection)EditorGUILayout.EnumPopup("Twist direction",t.rotationDirection);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
if (t.actionTriggering == QuickPinch.ActionTiggering.InProgress){
|
||||
t.enableSimpleAction = EditorGUILayout.Toggle("Enable simple action",t.enableSimpleAction);
|
||||
if (t.enableSimpleAction){
|
||||
EditorGUI.indentLevel++;
|
||||
t.directAction = (QuickSwipe.DirectAction) EditorGUILayout.EnumPopup("Action",t.directAction);
|
||||
t.axesAction = (QuickSwipe.AffectedAxesAction)EditorGUILayout.EnumPopup("Affected axes",t.axesAction);
|
||||
t.sensibility = EditorGUILayout.FloatField("Sensibility",t.sensibility);
|
||||
t.inverseAxisValue = EditorGUILayout.Toggle("Inverse axis",t.inverseAxisValue);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
serializedObject.Update();
|
||||
SerializedProperty pinchAction = serializedObject.FindProperty("onPinchAction");
|
||||
EditorGUILayout.PropertyField(pinchAction, true, null);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (GUI.changed){
|
||||
EditorUtility.SetDirty(t);
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
EditorSceneManager.MarkSceneDirty( EditorSceneManager.GetActiveScene());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e225b198a1829584097e5fceee345264
|
||||
timeCreated: 1450353509
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,57 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using HedgehogTeam.EasyTouch;
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
using UnityEditor.SceneManagement;
|
||||
#endif
|
||||
|
||||
[CustomEditor(typeof(QuickSwipe))]
|
||||
public class QuickSwipeInspector : UnityEditor.Editor {
|
||||
|
||||
public override void OnInspectorGUI(){
|
||||
|
||||
QuickSwipe t = (QuickSwipe)target;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.quickActionName = EditorGUILayout.TextField("Quick name",t.quickActionName);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.allowSwipeStartOverMe = EditorGUILayout.ToggleLeft("Allow swipe start over me",t.allowSwipeStartOverMe);
|
||||
t.enablePickOverUI = EditorGUILayout.ToggleLeft("Allow over UI Element",t.enablePickOverUI);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.actionTriggering = (QuickSwipe.ActionTriggering)EditorGUILayout.EnumPopup("Triggering",t.actionTriggering);
|
||||
t.swipeDirection = (QuickSwipe.SwipeDirection)EditorGUILayout.EnumPopup("Swipe direction",t.swipeDirection);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
if (t.actionTriggering == QuickSwipe.ActionTriggering.InProgress){
|
||||
t.enableSimpleAction = EditorGUILayout.Toggle("Enable simple action",t.enableSimpleAction);
|
||||
if (t.enableSimpleAction){
|
||||
EditorGUI.indentLevel++;
|
||||
t.directAction = (QuickSwipe.DirectAction) EditorGUILayout.EnumPopup("Action",t.directAction);
|
||||
t.axesAction = (QuickSwipe.AffectedAxesAction)EditorGUILayout.EnumPopup("Affected axes",t.axesAction);
|
||||
t.sensibility = EditorGUILayout.FloatField("Sensibility",t.sensibility);
|
||||
t.inverseAxisValue = EditorGUILayout.Toggle("Inverse axis",t.inverseAxisValue);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
serializedObject.Update();
|
||||
SerializedProperty swipeAction = serializedObject.FindProperty("onSwipeAction");
|
||||
EditorGUILayout.PropertyField(swipeAction, true, null);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (GUI.changed){
|
||||
EditorUtility.SetDirty(t);
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
EditorSceneManager.MarkSceneDirty( EditorSceneManager.GetActiveScene());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29f3f85edd767f34da2094756988511f
|
||||
timeCreated: 1450163065
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,41 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using HedgehogTeam.EasyTouch;
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
using UnityEditor.SceneManagement;
|
||||
#endif
|
||||
|
||||
[CustomEditor(typeof(QuickTap))]
|
||||
public class QuickTapInspector : UnityEditor.Editor {
|
||||
|
||||
public override void OnInspectorGUI(){
|
||||
|
||||
QuickTap t = (QuickTap)target;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.quickActionName = EditorGUILayout.TextField("Name",t.quickActionName);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.is2Finger = EditorGUILayout.Toggle("2 fingers gesture",t.is2Finger);
|
||||
t.actionTriggering = (QuickTap.ActionTriggering)EditorGUILayout.EnumPopup("Action triggering",t.actionTriggering);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.enablePickOverUI = EditorGUILayout.ToggleLeft("Allow over UI Element",t.enablePickOverUI);
|
||||
|
||||
serializedObject.Update();
|
||||
SerializedProperty touch = serializedObject.FindProperty("onTap");
|
||||
EditorGUILayout.PropertyField(touch, true, null);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (GUI.changed){
|
||||
EditorUtility.SetDirty(t);
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
EditorSceneManager.MarkSceneDirty( EditorSceneManager.GetActiveScene());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e3e03caf02a475448be04b282362697d
|
||||
timeCreated: 1452768422
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,50 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using HedgehogTeam.EasyTouch;
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
using UnityEditor.SceneManagement;
|
||||
#endif
|
||||
|
||||
[CustomEditor(typeof(QuickTouch))]
|
||||
public class QuickTouchInspector : UnityEditor.Editor {
|
||||
|
||||
public override void OnInspectorGUI(){
|
||||
|
||||
QuickTouch t = (QuickTouch)target;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.quickActionName = EditorGUILayout.TextField("Name",t.quickActionName);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.is2Finger = EditorGUILayout.Toggle("2 fingers gesture",t.is2Finger);
|
||||
t.actionTriggering = (QuickTouch.ActionTriggering)EditorGUILayout.EnumPopup("Action triggering",t.actionTriggering);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
if (!t.is2Finger){
|
||||
t.isMultiTouch = EditorGUILayout.ToggleLeft("Allow multi-touch",t.isMultiTouch);
|
||||
}
|
||||
t.enablePickOverUI = EditorGUILayout.ToggleLeft("Allow over UI Element",t.enablePickOverUI);
|
||||
|
||||
serializedObject.Update();
|
||||
SerializedProperty touch = serializedObject.FindProperty("onTouch");
|
||||
EditorGUILayout.PropertyField(touch, true, null);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (t.actionTriggering == QuickTouch.ActionTriggering.Up){
|
||||
touch = serializedObject.FindProperty("onTouchNotOverMe");
|
||||
EditorGUILayout.PropertyField(touch, true, null);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
if (GUI.changed){
|
||||
EditorUtility.SetDirty(t);
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
EditorSceneManager.MarkSceneDirty( EditorSceneManager.GetActiveScene());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 525af5a608b3ff549823bdcffc6979e1
|
||||
timeCreated: 1450164615
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,57 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using HedgehogTeam.EasyTouch;
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
using UnityEditor.SceneManagement;
|
||||
#endif
|
||||
|
||||
[CustomEditor(typeof(QuickTwist))]
|
||||
public class QuickTwistInspector : UnityEditor.Editor {
|
||||
|
||||
public override void OnInspectorGUI(){
|
||||
|
||||
QuickTwist t = (QuickTwist)target;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.quickActionName = EditorGUILayout.TextField("Quick name",t.quickActionName);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.isGestureOnMe = EditorGUILayout.ToggleLeft("Gesture over me", t.isGestureOnMe);
|
||||
t.enablePickOverUI = EditorGUILayout.ToggleLeft("Allow over UI Element",t.enablePickOverUI);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
t.actionTriggering = (QuickTwist.ActionTiggering)EditorGUILayout.EnumPopup("Triggering",t.actionTriggering);
|
||||
t.rotationDirection = (QuickTwist.ActionRotationDirection)EditorGUILayout.EnumPopup("Twist direction",t.rotationDirection);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
if (t.actionTriggering == QuickTwist.ActionTiggering.InProgress){
|
||||
t.enableSimpleAction = EditorGUILayout.Toggle("Enable simple action",t.enableSimpleAction);
|
||||
if (t.enableSimpleAction){
|
||||
EditorGUI.indentLevel++;
|
||||
t.directAction = (QuickSwipe.DirectAction) EditorGUILayout.EnumPopup("Action",t.directAction);
|
||||
t.axesAction = (QuickSwipe.AffectedAxesAction)EditorGUILayout.EnumPopup("Affected axes",t.axesAction);
|
||||
t.sensibility = EditorGUILayout.FloatField("Sensibility",t.sensibility);
|
||||
t.inverseAxisValue = EditorGUILayout.Toggle("Inverse axis",t.inverseAxisValue);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
serializedObject.Update();
|
||||
SerializedProperty twistAction = serializedObject.FindProperty("onTwistAction");
|
||||
EditorGUILayout.PropertyField(twistAction, true, null);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (GUI.changed){
|
||||
EditorUtility.SetDirty(t);
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
EditorSceneManager.MarkSceneDirty( EditorSceneManager.GetActiveScene());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 08c96add5e005424aab15d266b33a173
|
||||
timeCreated: 1450353544
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e68e1b715a165d43b061566c29acbb2
|
||||
folderAsset: yes
|
||||
timeCreated: 1451142772
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 18 KiB |
@@ -0,0 +1,56 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea429d7f6cfed924a8798b9071509398
|
||||
timeCreated: 1451153057
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 512
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 19 KiB |
@@ -0,0 +1,56 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e573ef57d138214a932c4b3eb653900
|
||||
timeCreated: 1451153776
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -3
|
||||
maxTextureSize: 64
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
@@ -0,0 +1,56 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84b3bc3eb1ce7ab43809b8296ea9fd62
|
||||
timeCreated: 1451165436
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 64
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
@@ -0,0 +1,56 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2fcacbb7989d2c040bb26b9c5af88c1a
|
||||
timeCreated: 1451165436
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 64
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 6.1 KiB |
@@ -0,0 +1,56 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a16b9527219e4324a99b00e9a6c610ad
|
||||
timeCreated: 1451156361
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 64
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/EasyTouchBundle/EasyTouch/Plugins/Engine.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb9769511904e074d9b9a54602f88c54
|
||||
folderAsset: yes
|
||||
timeCreated: 1450797918
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,74 @@
|
||||
/***********************************************
|
||||
EasyTouch V
|
||||
Copyright © 2014-2015 The Hedgehog Team
|
||||
http://www.thehedgehogteam.com/Forum/
|
||||
|
||||
The.Hedgehog.Team@gmail.com
|
||||
|
||||
**********************************************/
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HedgehogTeam.EasyTouch{
|
||||
public class BaseFinger{
|
||||
|
||||
public int fingerIndex;
|
||||
public int touchCount;
|
||||
public Vector2 startPosition;
|
||||
public Vector2 position;
|
||||
public Vector2 deltaPosition;
|
||||
public float actionTime;
|
||||
public float deltaTime;
|
||||
|
||||
public Camera pickedCamera;
|
||||
public GameObject pickedObject;
|
||||
public bool isGuiCamera;
|
||||
|
||||
public bool isOverGui;
|
||||
public GameObject pickedUIElement;
|
||||
|
||||
|
||||
public float altitudeAngle;
|
||||
public float azimuthAngle;
|
||||
public float maximumPossiblePressure;
|
||||
public float pressure;
|
||||
|
||||
public float radius;
|
||||
public float radiusVariance;
|
||||
public TouchType touchType;
|
||||
|
||||
|
||||
|
||||
public Gesture GetGesture(){
|
||||
|
||||
Gesture gesture = new Gesture();
|
||||
gesture.fingerIndex = fingerIndex;
|
||||
gesture.touchCount = touchCount;
|
||||
gesture.startPosition = startPosition;
|
||||
gesture.position = position;
|
||||
gesture.deltaPosition = deltaPosition;
|
||||
gesture.actionTime = actionTime;
|
||||
gesture.deltaTime = deltaTime;
|
||||
gesture.isOverGui = isOverGui;
|
||||
|
||||
gesture.pickedCamera = pickedCamera;
|
||||
gesture.pickedObject = pickedObject;
|
||||
gesture.isGuiCamera = isGuiCamera;
|
||||
|
||||
gesture.pickedUIElement = pickedUIElement;
|
||||
|
||||
gesture.altitudeAngle = altitudeAngle;
|
||||
gesture.azimuthAngle = azimuthAngle;
|
||||
gesture.maximumPossiblePressure = maximumPossiblePressure;
|
||||
gesture.pressure = pressure;
|
||||
gesture.radius = radius;
|
||||
gesture.radiusVariance = radiusVariance;
|
||||
gesture.touchType = touchType;
|
||||
|
||||
return gesture;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8dfe7526dc614dd4a8e7249e52174f98
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
25
Assets/EasyTouchBundle/EasyTouch/Plugins/Engine/ECamera.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
/***********************************************
|
||||
EasyTouch V
|
||||
Copyright © 2014-2015 The Hedgehog Team
|
||||
http://www.thehedgehogteam.com/Forum/
|
||||
|
||||
The.Hedgehog.Team@gmail.com
|
||||
|
||||
**********************************************/
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace HedgehogTeam.EasyTouch{
|
||||
[System.Serializable]
|
||||
public class ECamera{
|
||||
|
||||
public Camera camera;
|
||||
public bool guiCamera;
|
||||
|
||||
public ECamera( Camera cam,bool gui){
|
||||
this.camera = cam;
|
||||
this.guiCamera = gui;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 524815593fe79cf46b3c7e1ae30e948e
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
2209
Assets/EasyTouchBundle/EasyTouch/Plugins/Engine/EasyTouch.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42241010c6f9ddc46b78abdc21d505c5
|
||||
timeCreated: 1440150387
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 9cfeb5ae16bf3cc4084255c9ae7cf36f, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,246 @@
|
||||
/***********************************************
|
||||
EasyTouch V
|
||||
Copyright © 2014-2015 The Hedgehog Team
|
||||
http://www.thehedgehogteam.com/Forum/
|
||||
|
||||
The.Hedgehog.Team@gmail.com
|
||||
|
||||
**********************************************/
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace HedgehogTeam.EasyTouch{
|
||||
// This is the class that simulate touches with the mouse.
|
||||
// Internal use only, DO NOT USE IT
|
||||
public class EasyTouchInput{
|
||||
|
||||
#region private members
|
||||
private Vector2[] oldMousePosition = new Vector2[2];
|
||||
private int[] tapCount = new int[2];
|
||||
private float[] startActionTime = new float[2];
|
||||
private float[] deltaTime = new float[2];
|
||||
private float[] tapeTime = new float[2];
|
||||
|
||||
// Complexe 2 fingers simulation
|
||||
private bool bComplex=false;
|
||||
private Vector2 deltaFingerPosition;
|
||||
private Vector2 oldFinger2Position;
|
||||
private Vector2 complexCenter;
|
||||
#endregion
|
||||
|
||||
#region Public methods
|
||||
// Return the number of touch
|
||||
public int TouchCount(){
|
||||
|
||||
#if ((UNITY_ANDROID || UNITY_IOS || UNITY_BLACKBERRY || UNITY_TVOS || UNITY_PSP2) && !UNITY_EDITOR)
|
||||
return getTouchCount(true);
|
||||
#else
|
||||
return getTouchCount(false);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
private int getTouchCount(bool realTouch){
|
||||
|
||||
int count=0;
|
||||
|
||||
if (realTouch || EasyTouch.instance.enableRemote ){
|
||||
count = Input.touchCount;
|
||||
}
|
||||
else{
|
||||
if (Input.GetMouseButton(0) || Input.GetMouseButtonUp(0)){
|
||||
count=1;
|
||||
if (EasyTouch.GetSecondeFingerSimulation()){
|
||||
if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(EasyTouch.instance.twistKey)|| Input.GetKey(KeyCode.LeftControl) ||Input.GetKey(EasyTouch.instance.swipeKey ))
|
||||
count=2;
|
||||
if (Input.GetKeyUp(KeyCode.LeftAlt)|| Input.GetKeyUp(EasyTouch.instance.twistKey)|| Input.GetKeyUp(KeyCode.LeftControl)|| Input.GetKeyUp(EasyTouch.instance.swipeKey))
|
||||
count=2;
|
||||
}
|
||||
if (count ==0){
|
||||
complexCenter = Vector2.zero;
|
||||
oldMousePosition[0] = new Vector2(-1,-1);
|
||||
oldMousePosition[1] = new Vector2(-1,-1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
// return in Finger structure all informations on an touch
|
||||
public Finger GetMouseTouch(int fingerIndex,Finger myFinger){
|
||||
|
||||
Finger finger;
|
||||
|
||||
if (myFinger!=null){
|
||||
finger = myFinger;
|
||||
}
|
||||
else{
|
||||
finger = new Finger();
|
||||
finger.gesture = EasyTouch.GestureType.None;
|
||||
}
|
||||
|
||||
|
||||
if (fingerIndex==1 && (Input.GetKeyUp(KeyCode.LeftAlt)|| Input.GetKeyUp(EasyTouch.instance.twistKey)|| Input.GetKeyUp(KeyCode.LeftControl)|| Input.GetKeyUp(EasyTouch.instance.swipeKey))){
|
||||
finger.fingerIndex = fingerIndex;
|
||||
finger.position = oldFinger2Position;
|
||||
finger.deltaPosition = finger.position - oldFinger2Position;
|
||||
finger.tapCount = tapCount[fingerIndex];
|
||||
finger.deltaTime = Time.realtimeSinceStartup-deltaTime[fingerIndex];
|
||||
finger.phase = TouchPhase.Ended;
|
||||
|
||||
return finger;
|
||||
}
|
||||
|
||||
if (Input.GetMouseButton(0)){
|
||||
|
||||
finger.fingerIndex = fingerIndex;
|
||||
finger.position = GetPointerPosition(fingerIndex);
|
||||
|
||||
if (Time.realtimeSinceStartup-tapeTime[fingerIndex]>0.5){
|
||||
tapCount[fingerIndex]=0;
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonDown(0) || (fingerIndex==1 && (Input.GetKeyDown(KeyCode.LeftAlt)|| Input.GetKeyDown(EasyTouch.instance.twistKey)|| Input.GetKeyDown(KeyCode.LeftControl)|| Input.GetKeyDown(EasyTouch.instance.swipeKey)))){
|
||||
|
||||
// Began
|
||||
finger.position = GetPointerPosition(fingerIndex);
|
||||
finger.deltaPosition = Vector2.zero;
|
||||
tapCount[fingerIndex]=tapCount[fingerIndex]+1;
|
||||
finger.tapCount = tapCount[fingerIndex];
|
||||
startActionTime[fingerIndex] = Time.realtimeSinceStartup;
|
||||
deltaTime[fingerIndex] = startActionTime[fingerIndex];
|
||||
finger.deltaTime = 0;
|
||||
finger.phase = TouchPhase.Began;
|
||||
|
||||
|
||||
if (fingerIndex==1){
|
||||
oldFinger2Position = finger.position;
|
||||
oldMousePosition[fingerIndex] = finger.position;
|
||||
}
|
||||
else{
|
||||
oldMousePosition[fingerIndex] = finger.position;
|
||||
}
|
||||
|
||||
if (tapCount[fingerIndex]==1){
|
||||
tapeTime[fingerIndex] = Time.realtimeSinceStartup;
|
||||
}
|
||||
|
||||
|
||||
return finger;
|
||||
}
|
||||
|
||||
finger.deltaPosition = finger.position - oldMousePosition[fingerIndex];
|
||||
|
||||
finger.tapCount = tapCount[fingerIndex];
|
||||
finger.deltaTime = Time.realtimeSinceStartup-deltaTime[fingerIndex];
|
||||
if (finger.deltaPosition.sqrMagnitude <1){
|
||||
finger.phase = TouchPhase.Stationary;
|
||||
}
|
||||
else{
|
||||
finger.phase = TouchPhase.Moved;
|
||||
}
|
||||
|
||||
oldMousePosition[fingerIndex] = finger.position;
|
||||
deltaTime[fingerIndex] = Time.realtimeSinceStartup;
|
||||
|
||||
return finger;
|
||||
}
|
||||
|
||||
else if (Input.GetMouseButtonUp(0)){
|
||||
finger.fingerIndex = fingerIndex;
|
||||
finger.position = GetPointerPosition(fingerIndex);
|
||||
finger.deltaPosition = finger.position - oldMousePosition[fingerIndex];
|
||||
finger.tapCount = tapCount[fingerIndex];
|
||||
finger.deltaTime = Time.realtimeSinceStartup-deltaTime[fingerIndex];
|
||||
finger.phase = TouchPhase.Ended;
|
||||
oldMousePosition[fingerIndex] = finger.position;
|
||||
|
||||
return finger;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get the position of the simulate second finger
|
||||
public Vector2 GetSecondFingerPosition(){
|
||||
|
||||
Vector2 pos = new Vector2(-1,-1);
|
||||
|
||||
if ((Input.GetKey(KeyCode.LeftAlt)|| Input.GetKey(EasyTouch.instance.twistKey)) && (Input.GetKey(KeyCode.LeftControl)|| Input.GetKey(EasyTouch.instance.swipeKey))){
|
||||
if (!bComplex){
|
||||
bComplex=true;
|
||||
deltaFingerPosition = (Vector2)Input.mousePosition - oldFinger2Position;
|
||||
}
|
||||
pos = GetComplex2finger();
|
||||
return pos;
|
||||
}
|
||||
else if (Input.GetKey(KeyCode.LeftAlt)|| Input.GetKey(EasyTouch.instance.twistKey) ){
|
||||
pos = GetPinchTwist2Finger();
|
||||
bComplex = false;
|
||||
return pos;
|
||||
}else if (Input.GetKey(KeyCode.LeftControl)|| Input.GetKey(EasyTouch.instance.swipeKey) ){
|
||||
|
||||
pos =GetComplex2finger();
|
||||
bComplex = false;
|
||||
return pos;
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private methods
|
||||
// Get the postion of simulate finger
|
||||
private Vector2 GetPointerPosition(int index){
|
||||
|
||||
Vector2 pos;
|
||||
|
||||
if (index==0){
|
||||
pos= Input.mousePosition;
|
||||
return pos;
|
||||
}
|
||||
else{
|
||||
return GetSecondFingerPosition();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Simulate for a twist or pinc
|
||||
private Vector2 GetPinchTwist2Finger(bool newSim=false){
|
||||
|
||||
Vector2 position;
|
||||
|
||||
if (complexCenter==Vector2.zero){
|
||||
position.x = (Screen.width/2.0f) - (Input.mousePosition.x - (Screen.width/2.0f)) ;
|
||||
position.y = (Screen.height/2.0f) - (Input.mousePosition.y - (Screen.height/2.0f));
|
||||
}
|
||||
else{
|
||||
position.x = (complexCenter.x) - (Input.mousePosition.x - (complexCenter.x)) ;
|
||||
position.y = (complexCenter.y) - (Input.mousePosition.y - (complexCenter.y));
|
||||
}
|
||||
oldFinger2Position = position;
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
// complexe Alt + Ctr
|
||||
private Vector2 GetComplex2finger(){
|
||||
|
||||
Vector2 position;
|
||||
|
||||
position.x = Input.mousePosition.x - deltaFingerPosition.x;
|
||||
position.y = Input.mousePosition.y - deltaFingerPosition.y;
|
||||
|
||||
complexCenter = new Vector2((Input.mousePosition.x+position.x)/2f, (Input.mousePosition.y+position.y)/2f);
|
||||
oldFinger2Position = position;
|
||||
|
||||
return position;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 404eb304606225a41845f4e87b8531cc
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
32
Assets/EasyTouchBundle/EasyTouch/Plugins/Engine/Finger.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
/***********************************************
|
||||
EasyTouch V
|
||||
Copyright © 2014-2015 The Hedgehog Team
|
||||
http://www.thehedgehogteam.com/Forum/
|
||||
|
||||
The.Hedgehog.Team@gmail.com
|
||||
|
||||
**********************************************/
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HedgehogTeam.EasyTouch{
|
||||
// Represents informations on Finger for touch
|
||||
// Internal use only, DO NOT USE IT
|
||||
public class Finger : BaseFinger{
|
||||
|
||||
public float startTimeAction;
|
||||
public Vector2 oldPosition;
|
||||
public int tapCount; // Number of taps.
|
||||
public TouchPhase phase; // Describes the phase of the touch.
|
||||
public EasyTouch.GestureType gesture;
|
||||
public EasyTouch.SwipeDirection oldSwipeType;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91501b99eb179804686edef05f75f7e3
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
141
Assets/EasyTouchBundle/EasyTouch/Plugins/Engine/Gesture.cs
Normal file
@@ -0,0 +1,141 @@
|
||||
/***********************************************
|
||||
EasyTouch V
|
||||
Copyright © 2014-2015 The Hedgehog Team
|
||||
http://www.thehedgehogteam.com/Forum/
|
||||
|
||||
The.Hedgehog.Team@gmail.com
|
||||
|
||||
**********************************************/
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System;
|
||||
|
||||
namespace HedgehogTeam.EasyTouch{
|
||||
/// <summary>
|
||||
/// This is the class passed as parameter by EasyTouch events, that containing all informations about the touch that raise the event,
|
||||
/// or by the tow fingers gesture that raise the event.
|
||||
/// </summary>
|
||||
public class Gesture : BaseFinger,ICloneable{
|
||||
|
||||
/// <summary>
|
||||
/// The siwpe or drag type ( None, Left, Right, Up, Down, Other => look at EayTouch.SwipeType enumeration).
|
||||
/// </summary>
|
||||
public EasyTouch.SwipeDirection swipe;
|
||||
/// <summary>
|
||||
/// The length of the swipe.
|
||||
/// </summary>
|
||||
public float swipeLength;
|
||||
/// <summary>
|
||||
/// The swipe vector direction.
|
||||
/// </summary>
|
||||
public Vector2 swipeVector;
|
||||
|
||||
/// <summary>
|
||||
/// The pinch length delta since last change.
|
||||
/// </summary>
|
||||
public float deltaPinch;
|
||||
/// <summary>
|
||||
/// The angle of the twist.
|
||||
/// </summary>
|
||||
public float twistAngle;
|
||||
/// <summary>
|
||||
/// The distance between two finger for a two finger gesture.
|
||||
/// </summary>
|
||||
public float twoFingerDistance;
|
||||
|
||||
public EasyTouch.EvtType type = EasyTouch.EvtType.None;
|
||||
|
||||
#region public method
|
||||
public object Clone(){
|
||||
return this.MemberwiseClone();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Transforms touch position into world space, or the center position between the two touches for a two fingers gesture.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The touch to wordl point.
|
||||
/// </returns>
|
||||
/// <param name='z'>
|
||||
/// The z position in world units from the camera or in world depending on worldZ value
|
||||
/// </param>
|
||||
/// <param name='worldZ'>
|
||||
/// true = r
|
||||
/// </param>
|
||||
///
|
||||
public Vector3 GetTouchToWorldPoint(float z){
|
||||
|
||||
return Camera.main.ScreenToWorldPoint( new Vector3( position.x, position.y,z));
|
||||
|
||||
}
|
||||
|
||||
public Vector3 GetTouchToWorldPoint( Vector3 position3D){
|
||||
|
||||
return Camera.main.ScreenToWorldPoint( new Vector3( position.x, position.y,Camera.main.transform.InverseTransformPoint(position3D).z));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the swipe or drag angle. (calculate from swipe Vector)
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// Float : The swipe or drag angle.
|
||||
/// </returns>
|
||||
public float GetSwipeOrDragAngle(){
|
||||
return Mathf.Atan2( swipeVector.normalized.y,swipeVector.normalized.x) * Mathf.Rad2Deg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Normalizeds the position.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The position.
|
||||
/// </returns>
|
||||
public Vector2 NormalizedPosition(){
|
||||
return new Vector2(100f/Screen.width*position.x/100f,100f/Screen.height*position.y/100f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this instance is over user interface element.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if this instance is over user interface element; otherwise, <c>false</c>.</returns>
|
||||
public bool IsOverUIElement(){
|
||||
return EasyTouch.IsFingerOverUIElement( fingerIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this instance is over rect transform the specified tr camera.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if this instance is over rect transform the specified tr camera; otherwise, <c>false</c>.</returns>
|
||||
/// <param name="tr">Tr.</param>
|
||||
/// <param name="camera">Camera.</param>
|
||||
public bool IsOverRectTransform(RectTransform tr,Camera camera=null){
|
||||
|
||||
if (camera == null){
|
||||
return RectTransformUtility.RectangleContainsScreenPoint( tr,position,null);
|
||||
}
|
||||
else{
|
||||
return RectTransformUtility.RectangleContainsScreenPoint( tr,position,camera);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the first picked user interface element.
|
||||
/// </summary>
|
||||
/// <returns>The first picked user interface element.</returns>
|
||||
public GameObject GetCurrentFirstPickedUIElement(bool isTwoFinger=false){
|
||||
return EasyTouch.GetCurrentPickedUIElement( fingerIndex,isTwoFinger);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current picked object.
|
||||
/// </summary>
|
||||
/// <returns>The current picked object.</returns>
|
||||
public GameObject GetCurrentPickedObject(bool isTwoFinger=false){
|
||||
return EasyTouch.GetCurrentPickedObject( fingerIndex,isTwoFinger);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42d70a45bcf6a3b4cb6fbc54cefed1e4
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,65 @@
|
||||
/***********************************************
|
||||
EasyTouch V
|
||||
Copyright © 2014-2015 The Hedgehog Team
|
||||
http://www.thehedgehogteam.com/Forum/
|
||||
|
||||
The.Hedgehog.Team@gmail.com
|
||||
|
||||
**********************************************/
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace HedgehogTeam.EasyTouch{
|
||||
public class TwoFingerGesture{
|
||||
|
||||
public EasyTouch.GestureType currentGesture = EasyTouch.GestureType.None;
|
||||
public EasyTouch.GestureType oldGesture= EasyTouch.GestureType.None;
|
||||
public int finger0;
|
||||
public int finger1;
|
||||
|
||||
public float startTimeAction;
|
||||
public float timeSinceStartAction;
|
||||
public Vector2 startPosition;
|
||||
public Vector2 position;
|
||||
public Vector2 deltaPosition;
|
||||
public Vector2 oldStartPosition;
|
||||
public float startDistance;
|
||||
|
||||
public float fingerDistance;
|
||||
public float oldFingerDistance;
|
||||
|
||||
public bool lockPinch=false;
|
||||
public bool lockTwist=true;
|
||||
public float lastPinch=0;
|
||||
public float lastTwistAngle = 0;
|
||||
|
||||
// Game Object
|
||||
public GameObject pickedObject;
|
||||
public GameObject oldPickedObject;
|
||||
public Camera pickedCamera;
|
||||
public bool isGuiCamera;
|
||||
|
||||
// UI
|
||||
public bool isOverGui;
|
||||
public GameObject pickedUIElement;
|
||||
|
||||
public bool dragStart=false;
|
||||
public bool swipeStart=false;
|
||||
|
||||
public bool inSingleDoubleTaps = false;
|
||||
public float tapCurentTime = 0;
|
||||
|
||||
public void ClearPickedObjectData(){
|
||||
pickedObject = null;
|
||||
oldPickedObject = null;
|
||||
pickedCamera = null;
|
||||
isGuiCamera = false;
|
||||
}
|
||||
|
||||
public void ClearPickedUIData(){
|
||||
isOverGui = false;
|
||||
pickedUIElement = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b166c9002d8a98e4d9923f6b75a54197
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/EasyTouchBundle/EasyTouch/Plugins/Gizmos.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22d06bd428d43ee40adfa02092f06335
|
||||
folderAsset: yes
|
||||
timeCreated: 1435661089
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 4.5 KiB |
@@ -0,0 +1,53 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9cfeb5ae16bf3cc4084255c9ae7cf36f
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,53 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 61719e5cd5d2e754280e0dd736d759ec
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/EasyTouchBundle/EasyTouch/Plugins/Resources.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26f9eca9006b9e44cb5b02f7ffbf9fd5
|
||||
folderAsset: yes
|
||||
timeCreated: 1435661089
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,56 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81049b81c2b0c2142be91c25eb466ecc
|
||||
timeCreated: 1447667337
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 4.5 KiB |
@@ -0,0 +1,53 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dfd71a03722781a4d871f01b8e1bb7e7
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 3.0 KiB |
@@ -0,0 +1,53 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3686533aff0e2b4bac7a2a7faf73f7a
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||