This is the main class of Easytouch engine. For add Easy Touch to your scene It is a fake singleton, so you can simply access their settings via a script with all static methods or with the inspector.
Inheritance: MonoBehaviour
 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 );
 }
Example #2
0
		private void CreateEasyTouch()
		{
			Debug.Log("Create easy touch object in strategy!");
			easyTouch = GameObject.FindObjectOfType<EasyTouch>();
			if (easyTouch == null)
			{
				easyTouch = new GameObject("EasyTouch").AddComponent<EasyTouch>();
				easyTouch.transform.parent = InputManager.Instance.transform;
			}
		}
Example #3
0
	/// <summary>
	/// Awake this instance.
	/// </summary>
	void Awake()
	{
		// add easy touch component
		m_dEasyTouch = GetComponent<EasyTouch> ();
		if (!m_dEasyTouch)
			throw new System.NullReferenceException ();
		
		m_dEasyTouch.enableReservedArea 	= true;
		m_dEasyTouch.useBroadcastMessage 	= false;
	}
    public void AddTrigger(EasyTouch.EventName 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();
        }
    }
Example #5
0
    void On_TouchDown(Gesture gesture)
    {
        if (gesture.pickedObject != null)
        {
            if (!EasyTouch.GetAutoUpdatePickedObject())
            {
                label.text = "Picked object from event : " + gesture.pickedObject.name + " : " + gesture.position;
            }
            else
            {
                label.text = "Picked object from event : " + gesture.pickedObject.name + " : " + gesture.position;
            }
        }
        else
        {
            if (!EasyTouch.GetAutoUpdatePickedObject())
            {
                label.text = "Picked object from event :  none";
            }
            else
            {
                label.text = "Picked object from event : none";
            }
        }

        label2.text = "";
        if (!EasyTouch.GetAutoUpdatePickedObject())
        {
            GameObject tmp = gesture.GetCurrentPickedObject();
            if (tmp != null)
            {
                label2.text = "Picked object from GetCurrentPickedObject : " + tmp.name;
            }
            else
            {
                label2.text = "Picked object from GetCurrentPickedObject : none";
            }
        }
    }
Example #6
0
 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);
             }
         }
     }
 }
Example #7
0
    static GameObject AddEasyTouch(bool c)
    {
        if (GameObject.FindObjectOfType(typeof(EasyTouch)) == null)
        {
            GameObject easyTouch = new GameObject("EasyTouch");
            EasyTouch  easy      = easyTouch.AddComponent <EasyTouch>();

            if (c)
            {
                easy.useBroadcastMessage = false;
            }
            else
            {
                easy.useBroadcastMessage = true;
            }
            return(easyTouch);
        }
        else
        {
            EditorUtility.DisplayDialog("Warning", "EasyTouch is already exist in your scene", "OK");
            return(null);
        }
    }
Example #8
0
    void On_TouchDown(Gesture gesture)
    {
        GameObject pickedObject = EasyTouch.GetCurrentPickedObject(gesture.fingerIndex);

        // if something is picked
        if (pickedObject != null)
        {
            // test the object name Right
            if (pickedObject.name == "Right")
            {
                demon.transform.localEulerAngles = new Vector3(0, 90f, 0);
                moveDirection.x = 0.7f;
                demon.animation.CrossFade("walk");
            }
            // test the object name Lefy
            else if (pickedObject.name == "Left")
            {
                demon.transform.localEulerAngles = new Vector3(0, -90f, 0);
                moveDirection.x = -0.7f;
                demon.animation.CrossFade("walk");
            }
        }
    }
Example #9
0
    void OnGUI()
    {
        GUI.matrix = Matrix4x4.Scale(new Vector3(Screen.width / 1024.0f, Screen.height / 768.0f, 1f));

        GUI.Box(new Rect(0, -4, 1024, 30), "");
        GUILayout.Label("Manipulation of an image : Twist, Pinch, Drag  with 1 or 2 fingers, ctrl key to swipe and  alt key to Twist and pinch to simulate the second finger");

        GUILayout.Space(15);

        bTwist = GUILayout.Toggle(bTwist, "Enable Twist");
        EasyTouch.SetEnableTwist(bTwist);

        GUILayout.Space(15);

        bPinch = GUILayout.Toggle(bPinch, "Enable Pinch");
        EasyTouch.SetEnablePinch(bPinch);

        // Back to menu menu
        if (GUI.Button(new Rect(412, 700, 200, 50), "Main menu"))
        {
            Application.LoadLevel("StartMenu");
        }
    }
Example #10
0
        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);
        }
Example #11
0
 public void SetAutoUpdate(bool value)
 {
     EasyTouch.SetAutoUpdatePickedObject(value);
 }
Example #12
0
	private void TriggerScheduler(EasyTouch.EventName 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;

					}
				}
			}
		}
	}
    public override void OnInspectorGUI()
    {
        EasyTouch t = (EasyTouch)target;

        HTGUILayout.FoldOut(ref t.showGeneral, "General properties", false);
        if (t.showGeneral)
        {
            if (t.enable)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.enable = EditorGUILayout.Toggle("Enable EasyTouch", t.enable);
            if (t.enableRemote)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.enableRemote = EditorGUILayout.Toggle("Enable unity remote", t.enableRemote);


            if (t.useBroadcastMessage)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.useBroadcastMessage = EditorGUILayout.BeginToggleGroup("Broadcast messages", t.useBroadcastMessage);
            GUI.backgroundColor   = Color.white;
            if (t.useBroadcastMessage)
            {
                EditorGUILayout.BeginVertical(paddingStyle1);
                t.receiverObject = (GameObject)EditorGUILayout.ObjectField("Other receiver", t.receiverObject, typeof(GameObject), true);
                if (t.isExtension)
                {
                    GUI.backgroundColor = Color.green;
                }
                else
                {
                    GUI.backgroundColor = Color.red;
                }
                t.isExtension       = EditorGUILayout.Toggle("Joysticks & buttons", t.isExtension);
                GUI.backgroundColor = Color.white;
                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.EndToggleGroup();
            EditorGUILayout.Space();

            if (t.enableReservedArea)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.enableReservedArea = EditorGUILayout.Toggle("Enable reserved area", t.enableReservedArea);
            EditorGUILayout.Space();
            if (t.enabledNGuiMode)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.enabledNGuiMode   = EditorGUILayout.Toggle("Enable NGUI compatibilty", t.enabledNGuiMode);
            GUI.backgroundColor = Color.white;
            if (t.enabledNGuiMode)
            {
                EditorGUILayout.BeginVertical(paddingStyle1);

                // Camera
                serializedObject.Update();
                EditorGUIUtility.LookLikeInspector();
                SerializedProperty cameras = serializedObject.FindProperty("nGUICameras");
                EditorGUILayout.PropertyField(cameras, true);
                serializedObject.ApplyModifiedProperties();
                EditorGUIUtility.LookLikeControls();

                EditorGUILayout.Space();

                // layers
                serializedObject.Update();
                EditorGUIUtility.LookLikeInspector();
                SerializedProperty layers = serializedObject.FindProperty("nGUILayers");
                EditorGUILayout.PropertyField(layers, false);
                serializedObject.ApplyModifiedProperties();
                EditorGUIUtility.LookLikeControls();

                EditorGUILayout.EndVertical();
            }
        }

        if (t.enable)
        {
            // Auto select porperties
            HTGUILayout.FoldOut(ref t.showSelect, "Auto-select properties", false);
            if (t.showSelect)
            {
                t.easyTouchCamera = (Camera)EditorGUILayout.ObjectField("Camera", t.easyTouchCamera, typeof(Camera), true);
                if (t.autoSelect)
                {
                    GUI.backgroundColor = Color.green;
                }
                else
                {
                    GUI.backgroundColor = Color.red;
                }
                t.autoSelect        = EditorGUILayout.Toggle("Enable auto-select", t.autoSelect);
                GUI.backgroundColor = Color.white;
                if (t.autoSelect)
                {
                    serializedObject.Update();
                    EditorGUIUtility.LookLikeInspector();
                    SerializedProperty layers = serializedObject.FindProperty("pickableLayers");
                    EditorGUILayout.PropertyField(layers, true);
                    serializedObject.ApplyModifiedProperties();
                    EditorGUIUtility.LookLikeControls();
                }
            }

            // General gesture properties
            HTGUILayout.FoldOut(ref t.showGesture, "General gesture properties", false);
            if (t.showGesture)
            {
                t.StationnaryTolerance = EditorGUILayout.FloatField("Stationary tolerance", t.StationnaryTolerance);
                t.longTapTime          = EditorGUILayout.FloatField("Long tap time", t.longTapTime);
                t.swipeTolerance       = EditorGUILayout.FloatField("Swipe tolerance", t.swipeTolerance);
            }

            // Two fingers gesture
            HTGUILayout.FoldOut(ref t.showTwoFinger, "Two fingers gesture properties", false);
            if (t.showTwoFinger)
            {
                if (t.enable2FingersGesture)
                {
                    GUI.backgroundColor = Color.green;
                }
                else
                {
                    GUI.backgroundColor = Color.red;
                }
                t.enable2FingersGesture = EditorGUILayout.Toggle("2 fingers gesture", t.enable2FingersGesture);
                GUI.backgroundColor     = Color.white;
                if (t.enable2FingersGesture)
                {
                    EditorGUILayout.Separator();
                    if (t.enablePinch)
                    {
                        GUI.backgroundColor = Color.green;
                    }
                    else
                    {
                        GUI.backgroundColor = Color.red;
                    }
                    t.enablePinch       = EditorGUILayout.Toggle("Enable Pinch", t.enablePinch);
                    GUI.backgroundColor = Color.white;
                    if (t.enablePinch)
                    {
                        t.minPinchLength = EditorGUILayout.FloatField("Min pinch length", t.minPinchLength);
                    }
                    EditorGUILayout.Separator();
                    if (t.enableTwist)
                    {
                        GUI.backgroundColor = Color.green;
                    }
                    else
                    {
                        GUI.backgroundColor = Color.red;
                    }
                    t.enableTwist       = EditorGUILayout.Toggle("Enable twist", t.enableTwist);
                    GUI.backgroundColor = Color.white;
                    if (t.enableTwist)
                    {
                        t.minTwistAngle = EditorGUILayout.FloatField("Min twist angle", t.minTwistAngle);
                    }

                    EditorGUILayout.Separator();
                }
            }

            // Second Finger simulation
            HTGUILayout.FoldOut(ref t.showSecondFinger, "Second finger simulation", false);
            if (t.showSecondFinger)
            {
                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);
            }
        }
    }
Example #14
0
 void Start()
 {
     textMesh = (TextMesh)GameObject.Find("TouchOnLayer").transform.gameObject.GetComponent("TextMesh");
     EasyTouch.AddReservedGuiArea(rect1);
     EasyTouch.AddReservedGuiArea(rect2);
 }
Example #15
0
 /// <summary>
 /// Gets the current picked object.
 /// </summary>
 /// <returns>The current picked object.</returns>
 public GameObject GetCurrentPickedObject(bool isTwoFinger = false)
 {
     return(EasyTouch.GetCurrentPickedObject(fingerIndex, isTwoFinger));
 }
Example #16
0
 // Token: 0x060002D1 RID: 721 RVA: 0x0000DA14 File Offset: 0x0000BE14
 private void DoAction(Gesture gesture)
 {
     if (this.realType == QuickBase.GameObjectType.UI)
     {
         if (gesture.isOverGui && (gesture.pickedUIElement == base.gameObject || gesture.pickedUIElement.transform.IsChildOf(base.transform)))
         {
             this.onTap.Invoke(gesture);
         }
     }
     else if (((!this.enablePickOverUI && gesture.pickedUIElement == null) || this.enablePickOverUI) && EasyTouch.GetGameObjectAt(gesture.position, this.is2Finger) == base.gameObject)
     {
         this.onTap.Invoke(gesture);
     }
 }
Example #17
0
 public void RemoveTouchUp2Fingers(EasyTouch.TouchUp2FingersHandler handler)
 {
     if (handler != null && this.m_TouchUp2FingersList.Contains(handler))
     {
         this.m_TouchUp2FingersList.Remove(handler);
     }
 }
Example #18
0
	/// <summary>
	/// Transforms touch position into world space, or the center position between the two touches for a two fingers gesture.
	/// </summary>
	/// <returns>
	/// Vector3 : world position
	/// </returns>
	/// <param name='z'>
	/// The z position in world units from the camera
	/// </param>
	public Vector3 GetTouchToWordlPoint(float z){
		return  EasyTouch.GetCamera().ScreenToWorldPoint( new Vector3( position.x, position.y,z));	
	}
Example #19
0
 public void RemoveSwipeStart(EasyTouch.SwipeStartHandler handler)
 {
     if (handler != null && this.m_SwipeStartList.Contains(handler))
     {
         this.m_SwipeStartList.Remove(handler);
     }
 }
Example #20
0
 public void RemoveTouchDown(EasyTouch.TouchDownHandler handler)
 {
     if (handler != null && this.m_TouchDownList.Contains(handler))
     {
         this.m_TouchDownList.Remove(handler);
     }
 }
Example #21
0
 public void RemoveSimpleTap(EasyTouch.SimpleTapHandler handler)
 {
     if (handler != null && this.m_SimpleTapList.Contains(handler))
     {
         this.m_SimpleTapList.Remove(handler);
     }
 }
Example #22
0
 public void RemovePinchOut(EasyTouch.PinchOutHandler handler)
 {
     if (handler != null && this.m_PinchOutList.Contains(handler))
     {
         this.m_PinchOutList.Remove(handler);
     }
 }
Example #23
0
 public void RemoveLongTapStart(EasyTouch.LongTapStartHandler handler)
 {
     if (handler != null && this.m_LongTapStartList.Contains(handler))
     {
         this.m_LongTapStartList.Remove(handler);
     }
 }
Example #24
0
    void InitEasyTouch()
    {
        input = new EasyTouchInput();

        // Assing the fake singleton
        if (EasyTouch.instance == null)
            instance = this;

        // We search the main camera with the tag MainCamera.
        // For automatic object selection.
        if (easyTouchCamera == null){
            easyTouchCamera = Camera.main;

            if (easyTouchCamera==null && autoSelect){
                Debug.LogWarning("No camera with flag \"MainCam\" was found in the scene, please setup the camera");
            }
        }

        // The texture to display the simulation of the second finger.
        #if ((!UNITY_ANDROID && !UNITY_IPHONE) || UNITY_EDITOR)
            if (secondFingerTexture==null){
                secondFingerTexture =Resources.Load("secondFinger") as Texture;
            }
        #endif
    }
Example #25
0
 public void RemoveTwist(EasyTouch.TwistHandler handler)
 {
     if (handler != null && this.m_TwistList.Contains(handler))
     {
         this.m_TwistList.Remove(handler);
     }
 }
Example #26
0
    void InitEasyTouch()
    {
        input = new EasyTouchInput();

        // Assing the fake singleton
        if (EasyTouch.instance == null)
            instance = this;

        // The texture to display the simulation of the second finger.
        #if ((!UNITY_ANDROID && !UNITY_IPHONE && !UNITY_WP8 && !UNITY_BLACKBERRY) || UNITY_EDITOR)
            if (secondFingerTexture==null){
                secondFingerTexture =Resources.Load("secondFinger") as Texture;
            }
        #endif
    }
Example #27
0
 public void RegisterDragEnd(EasyTouch.DragEndHandler handler)
 {
     if (handler != null && !this.m_DragEndList.Contains(handler))
     {
         this.m_DragEndList.Add(handler);
     }
 }
Example #28
0
 // If the two finger gesture is finished
 void On_Cancel2Fingers(Gesture gesture)
 {
     EasyTouch.SetEnablePinch(true);
     transform.rotation = Quaternion.identity;
     textMesh.text      = "Twist me";
 }
Example #29
0
 public void RegisterTouchUp2Fingers(EasyTouch.TouchUp2FingersHandler handler)
 {
     if (handler != null && !this.m_TouchUp2FingersList.Contains(handler))
     {
         this.m_TouchUp2FingersList.Add(handler);
     }
 }
Example #30
0
 /// <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 GetTouchToWordlPoint(float z, bool worldZ = false)
 {
     if (!worldZ)
     {
         return(EasyTouch.GetCamera().ScreenToWorldPoint(new Vector3(position.x, position.y, z)));
     }
     else
     {
         return(EasyTouch.GetCamera().ScreenToWorldPoint(new Vector3(position.x, position.y, z - EasyTouch.GetCamera().transform.position.z)));
     }
 }
Example #31
0
 public void RegisterTouchDown(EasyTouch.TouchDownHandler handler)
 {
     if (handler != null && !this.m_TouchDownList.Contains(handler))
     {
         this.m_TouchDownList.Add(handler);
     }
 }
Example #32
0
 public void RegisterLongTapStart(EasyTouch.LongTapStartHandler handler)
 {
     if (handler != null && !this.m_LongTapStartList.Contains(handler))
     {
         this.m_LongTapStartList.Add(handler);
     }
 }
Example #33
0
 public override void OnEnter()
 {
     EasyTouch.SetMinTwistAngle(angle.Value);
     Finish();
 }
Example #34
0
 public void RemoveDragEnd(EasyTouch.DragEndHandler handler)
 {
     if (handler != null && this.m_DragEndList.Contains(handler))
     {
         this.m_DragEndList.Remove(handler);
     }
 }
Example #35
0
 public override void OnEnter()
 {
     EasyTouch.SetTwoFingerPickMethod(method);
     Finish();
 }
Example #36
0
 public override void OnEnter()
 {
     EasyTouch.SetAutoUpdateUI(enable.Value);
     Finish();
 }
Example #37
0
 public void RegisterSwipeStart(EasyTouch.SwipeStartHandler handler)
 {
     if (handler != null && !this.m_SwipeStartList.Contains(handler))
     {
         this.m_SwipeStartList.Add(handler);
     }
 }
Example #38
0
 public void SetAutoSelect(bool value)
 {
     EasyTouch.SetEnableAutoSelect(value);
 }
 public override void OnUpdate()
 {
     EasyTouch.SetEnableAutoSelect(value.Value);
 }
Example #40
0
	private bool IsRecevier4(EasyTouch.EventName evnt){

		int result = receivers.FindIndex(
			delegate(EasyTouchTrigger.EasyTouchReceiver e){
			return  e.eventName == evnt;
		}
		);

		if (result>-1){
			return true;
		}
		else{
			return false;
		}
	}
	private void TriggerInspector(EasyTouch.EventName 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);

	}
 // Token: 0x0600025B RID: 603 RVA: 0x0000B16F File Offset: 0x0000956F
 private void Start()
 {
     EasyTouch.SetEnableAutoSelect(true);
 }
 public override void OnEnter()
 {
     EasyTouch.SetMinPinchLength(length.Value);
     Finish();
 }
Example #44
0
    void InitEasyTouch()
    {
        input = new EasyTouchInput();

        // Assing the fake singleton
        if (EasyTouch.instance == null)
            instance = this;

        // We search the main camera with the tag MainCamera.
        // For automatic object selection.
        mainCam = Camera.mainCamera;

        if (mainCam==null){
            Debug.LogError("No camera with flag \"MainCam\" was found in the scene");
        }

        // The texture to display the simulation of the second finger.
        #if ((!UNITY_ANDROID && !UNITY_IPHONE) || UNITY_EDITOR)
            secondFingerTexture =Resources.Load("secondFinger") as Texture;
        #endif
    }
Example #45
0
    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
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
                        #endif
        }
    }
Example #46
0
 public void RegisterPinchOut(EasyTouch.PinchOutHandler handler)
 {
     if (handler != null && !this.m_PinchOutList.Contains(handler))
     {
         this.m_PinchOutList.Add(handler);
     }
 }
 private void InitEasyTouch()
 {
     this.input = new EasyTouchInput();
     if (instance == null)
     {
         instance = this;
     }
 }
Example #48
0
 /// <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));
 }
Example #49
0
 public override void OnUpdate()
 {
     EasyTouch.SetAutoUpdateUI(value.Value);
 }
 public override void OnEnter()
 {
     EasyTouch.SetEnable2FingersGesture(enable.Value);
     Finish();
 }
Example #51
0
	void Awake(){
		// Assing the fake singleton
		if (EasyTouch.instance == null)
			instance = this;		
	}
Example #52
0
	public static void SetTwoFingerPickMethod( EasyTouch.TwoFingerPickMethod pickMethod){
		if (EasyTouch.instance)
			EasyTouch.instance.twoFingerPickMethod = pickMethod;
	}
Example #53
0
 public void RegisterSimpleTap(EasyTouch.SimpleTapHandler handler)
 {
     if (handler != null && !this.m_SimpleTapList.Contains(handler))
     {
         this.m_SimpleTapList.Add(handler);
     }
 }
Example #54
0
 public override void OnEnter()
 {
     enabled.Value = EasyTouch.GetAutoUpdatePickedObject();
     Finish();
 }
Example #55
0
 public void SetCompatibility(bool value)
 {
     EasyTouch.SetUICompatibily(value);
 }
Example #56
0
 public override void OnEnter()
 {
     enabled.Value = EasyTouch.GetEnableAutoSelect();
     Finish();
 }
 public override void OnEnter()
 {
     EasyTouch.SetGesturePriority(priority);
     Finish();
 }
 public override void OnEnter()
 {
     EasyTouch.SetEnableUIDetection(enable.Value);
     Finish();
 }
Example #59
0
 public void RegisterTwist(EasyTouch.TwistHandler handler)
 {
     if (handler != null && !this.m_TwistList.Contains(handler))
     {
         this.m_TwistList.Add(handler);
     }
 }