Exemplo n.º 1
0
 private void CreateLongPress()
 {
     longPress = new LongPressGestureRecognizer();
     longPress.MaximumNumberOfTouchesToTrack = 1;
     longPress.StateUpdated += LongPressHandle;
     FingersScript.Instance.AddGesture(longPress);
 }
Exemplo n.º 2
0
 private void CreateLongPressGesture()
 {
     longPressGesture = new LongPressGestureRecognizer();
     longPressGesture.MaximumNumberOfTouchesToTrack = 1;
     longPressGesture.StateUpdated += LongPressGestureCallback;
     FingersScript.Instance.AddGesture(longPressGesture);
 }
Exemplo n.º 3
0
 private void Start()
 {
     // create a long press gesture to drag and swipe cards around
     longPress = new LongPressGestureRecognizer();
     longPress.StateUpdated += LongPress_StateUpdated;
     FingersScript.Instance.AddGesture(longPress);
     FingersScript.Instance.ShowTouches = true;
 }
 private void Start()
 {
     this.Camera      = (this.Camera == null ? Camera.main : this.Camera);
     longPressGesture = new LongPressGestureRecognizer();
     longPressGesture.StateUpdated += LongPressGestureUpdated;
     rigidBody      = GetComponent <Rigidbody2D>();
     spriteRenderer = GetComponent <SpriteRenderer>();
     if (spriteRenderer != null)
     {
         startSortOrder = spriteRenderer.sortingOrder;
     }
     FingersScript.Instance.AddGesture(longPressGesture);
 }
        private void OnEnable()
        {
            if (Camera == null)
            {
                Camera = Camera.main;
            }

            Target       = (Target == null ? transform : Target);
            origRotation = Target.rotation;
            origScale    = Target.localScale;

            PanGesture = new PanGestureRecognizer();
            PanGesture.StateUpdated        += PanGestureStateUpdated;
            PanGesture.PlatformSpecificView = gameObject;
            FingersScript.Instance.AddGesture(PanGesture);

            RotateGesture = new RotateGestureRecognizer();
            RotateGesture.StateUpdated        += RotateGestureStateUpdated;
            RotateGesture.PlatformSpecificView = gameObject;
            RotateGesture.AllowSimultaneousExecution(PanGesture);
            FingersScript.Instance.AddGesture(RotateGesture);

            ScaleGesture = new ScaleGestureRecognizer();
            ScaleGesture.StateUpdated        += ScaleGestureStateUpdated;
            ScaleGesture.PlatformSpecificView = gameObject;
            ScaleGesture.ZoomSpeed           *= ScaleSpeed;
            ScaleGesture.AllowSimultaneousExecution(RotateGesture);
            ScaleGesture.AllowSimultaneousExecution(PanGesture);
            FingersScript.Instance.AddGesture(ScaleGesture);

            TapGestureReset = new TapGestureRecognizer();
            TapGestureReset.NumberOfTapsRequired = 2;
            TapGestureReset.PlatformSpecificView = gameObject;
            TapGestureReset.StateUpdated        += TapGestureResetStateUpdated;
            FingersScript.Instance.AddGesture(TapGestureReset);

            TapGestureDestroy = new TapGestureRecognizer();
            TapGestureDestroy.NumberOfTapsRequired = 3;
            TapGestureDestroy.PlatformSpecificView = gameObject;
            TapGestureDestroy.StateUpdated        += TapGestureDestroyStateUpdated;
            FingersScript.Instance.AddGesture(TapGestureDestroy);

            TapGestureReset.RequireGestureRecognizerToFail = TapGestureDestroy;

            LongPressGesture = new LongPressGestureRecognizer();
            LongPressGesture.PlatformSpecificView = gameObject;
            LongPressGesture.StateUpdated        += LongPressGestureStateUpdated;
            FingersScript.Instance.AddGesture(LongPressGesture);
        }
 private void OnEnable()
 {
     if ((Cameras == null || Cameras.Length == 0) && Camera.main != null)
     {
         Cameras = new Camera[] { Camera.main };
     }
     LongPressGesture = new LongPressGestureRecognizer();
     LongPressGesture.StateUpdated += LongPressGestureUpdated;
     rigidBody      = GetComponent <Rigidbody>();
     rigidBody2D    = GetComponent <Rigidbody2D>();
     spriteRenderer = GetComponent <SpriteRenderer>();
     if (spriteRenderer != null)
     {
         startSortOrder = spriteRenderer.sortingOrder;
     }
     FingersScript.Instance.AddGesture(LongPressGesture);
 }
        private void OnEnable()
        {
            if (Camera == null)
            {
                Camera = Camera.main;
            }

            Targets = (Targets == null || Targets.Count == 0 ? new List <Transform> {
                transform
            } : Targets);
            UpdateOrigStates();

            PanGesture = new PanGestureRecognizer();
            PanGesture.StateUpdated += PanGestureStateUpdated;
            FingersScript.Instance.AddGesture(PanGesture);

            RotateGesture = new RotateGestureRecognizer();
            RotateGesture.StateUpdated += RotateGestureStateUpdated;
            RotateGesture.AllowSimultaneousExecution(PanGesture);
            FingersScript.Instance.AddGesture(RotateGesture);

            ScaleGesture = new ScaleGestureRecognizer();
            ScaleGesture.StateUpdated += ScaleGestureStateUpdated;
            ScaleGesture.ZoomSpeed    *= ScaleSpeed;
            ScaleGesture.AllowSimultaneousExecution(RotateGesture);
            ScaleGesture.AllowSimultaneousExecution(PanGesture);
            FingersScript.Instance.AddGesture(ScaleGesture);

            TapGestureReset = new TapGestureRecognizer();
            TapGestureReset.NumberOfTapsRequired = 2;
            TapGestureReset.StateUpdated        += TapGestureResetStateUpdated;
            FingersScript.Instance.AddGesture(TapGestureReset);

            TapGestureDestroy = new TapGestureRecognizer();
            TapGestureDestroy.NumberOfTapsRequired = 3;
            TapGestureDestroy.StateUpdated        += TapGestureDestroyStateUpdated;
            FingersScript.Instance.AddGesture(TapGestureDestroy);
            TapGestureReset.RequireGestureRecognizerToFail = TapGestureDestroy;

            LongPressGesture = new LongPressGestureRecognizer();
            LongPressGesture.StateUpdated += LongPressGestureStateUpdated;
            FingersScript.Instance.AddGesture(LongPressGesture);
        }
Exemplo n.º 8
0
        private void Start()
        {
            if (FingersScript.Instance == null)
            {
                Debug.LogError("Fingers script prefab needs to be added to the first scene");
                return;
            }

            this.Camera               = (this.Camera == null ? Camera.main : this.Camera);
            longPressGesture          = new LongPressGestureRecognizer();
            longPressGesture.Updated += LongPressGestureUpdated;
            rigidBody      = GetComponent <Rigidbody2D>();
            spriteRenderer = GetComponent <SpriteRenderer>();
            if (spriteRenderer != null)
            {
                startSortOrder = spriteRenderer.sortingOrder;
            }
            FingersScript.Instance.AddGesture(longPressGesture);
        }
		private void CreateLongPressGesture()
		{
			longPressGesture = new LongPressGestureRecognizer();
			longPressGesture.Updated += LongPressGestureCallback;
			FingerScript.AddGesture(longPressGesture);
		}