Ejemplo n.º 1
0
        void TapThreeTimes(System.Object[] args = null)
        {
            if (args != null && args.Length == 1 && args [0] is TouchScript.Gestures.TapGesture)
            {
                //Got three tap gesture, now checking the corners
                TouchScript.Gestures.TapGesture tapGesture = args [0] as TouchScript.Gestures.TapGesture;

                if (tapGesture.NormalizedScreenPosition.x < m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y < m_NormalizedThresholdHeight)
                {
                    EventManager.Instance.SendEvent(Constants.Event.ON_TAP_THREETIMES_BOTTOM_LEFT);
                    TapOnBottomLeft();
                }
                else if (tapGesture.NormalizedScreenPosition.x < m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y > 1.0f - m_NormalizedThresholdHeight)
                {
                    EventManager.Instance.SendEvent(Constants.Event.ON_TAP_THREETIMES_TOP_LEFT);
                    TapOnTopLeft();
                }
                else if (tapGesture.NormalizedScreenPosition.x > 1.0f - m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y < m_NormalizedThresholdHeight)
                {
                    EventManager.Instance.SendEvent(Constants.Event.ON_TAP_THREETIMES_BOTTOM_RIGHT);
                    TapOnBottomRight();
                }
                else if (tapGesture.NormalizedScreenPosition.x > 1.0f - m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y > 1.0f - m_NormalizedThresholdHeight)
                {
                    EventManager.Instance.SendEvent(Constants.Event.ON_TAP_THREETIMES_TOP_RIGHT);
                    TapOnTopRight();
                }
                else if (tapGesture.NormalizedScreenPosition.x < m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y > 0.5f - (m_NormalizedThresholdHeight / 2.0f) && tapGesture.NormalizedScreenPosition.y < 0.5f + (m_NormalizedThresholdHeight / 2.0f))
                {
                    EventManager.Instance.SendEvent(Constants.Event.ON_TAP_THREETIMES_MIDDLE_LEFT);
                    TapOnMiddleLeft();
                }
                else if (tapGesture.NormalizedScreenPosition.x > 1.0f - m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y > 0.5f - (m_NormalizedThresholdHeight / 2.0f) && tapGesture.NormalizedScreenPosition.y < 0.5f + (m_NormalizedThresholdHeight / 2.0f))
                {
                    EventManager.Instance.SendEvent(Constants.Event.ON_TAP_THREETIMES_MIDDLE_RIGHT);
                    TapOnMiddleRight();
                }
                else if (tapGesture.NormalizedScreenPosition.x > 0.5f - (m_NormalizedThresholdWidth / 2.0f) && tapGesture.NormalizedScreenPosition.x < 0.5f + (m_NormalizedThresholdWidth / 2.0f) && tapGesture.NormalizedScreenPosition.y < m_NormalizedThresholdHeight)
                {
                    EventManager.Instance.SendEvent(Constants.Event.ON_TAP_THREETIMES_MIDDLE_BOTTOM);
                    TapOnMiddleBottom();
                }
                else if (tapGesture.NormalizedScreenPosition.x > 0.5f - (m_NormalizedThresholdWidth / 2.0f) && tapGesture.NormalizedScreenPosition.x < 0.5f + (m_NormalizedThresholdWidth / 2.0f) && tapGesture.NormalizedScreenPosition.y > 1.0f - m_NormalizedThresholdHeight)
                {
                    EventManager.Instance.SendEvent(Constants.Event.ON_TAP_THREETIMES_MIDDLE_TOP);
                    TapOnMiddleTop();
                }
                else
                {
                    //do nothing
                }
            }
            else
            {
                Log.Warning("WatsonCamera", "TapThreeTimes has invalid arguments.");
            }
        }
Ejemplo n.º 2
0
        void TapThreeTimes(System.Object[] args = null)
        {
            if (args != null && args.Length > 0 && args[0] is TouchScript.Gestures.TapGesture)
            {
                //Got three tap gesture, now checking the corners
                TouchScript.Gestures.TapGesture tapGesture = args[0] as TouchScript.Gestures.TapGesture;

                if (tapGesture.NormalizedScreenPosition.x < m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y < m_NormalizedThresholdHeight)
                {
                    EventManager.Instance.SendEvent("OnTripleTapBottomLeft");
                }
                else if (tapGesture.NormalizedScreenPosition.x < m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y > 1.0f - m_NormalizedThresholdHeight)
                {
                    EventManager.Instance.SendEvent("OnTripleTapTopLeft");
                }
                else if (tapGesture.NormalizedScreenPosition.x > 1.0f - m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y < m_NormalizedThresholdHeight)
                {
                    EventManager.Instance.SendEvent("OnTripleTapBottomRight");
                }
                else if (tapGesture.NormalizedScreenPosition.x > 1.0f - m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y > 1.0f - m_NormalizedThresholdHeight)
                {
                    EventManager.Instance.SendEvent("OnTripleTapTopRight");
                }
                else if (tapGesture.NormalizedScreenPosition.x < m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y > 0.5f - (m_NormalizedThresholdHeight / 2.0f) && tapGesture.NormalizedScreenPosition.y < 0.5f + (m_NormalizedThresholdHeight / 2.0f))
                {
                    EventManager.Instance.SendEvent("OnTripleTapMiddleLeft");
                }
                else if (tapGesture.NormalizedScreenPosition.x > 1.0f - m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y > 0.5f - (m_NormalizedThresholdHeight / 2.0f) && tapGesture.NormalizedScreenPosition.y < 0.5f + (m_NormalizedThresholdHeight / 2.0f))
                {
                    EventManager.Instance.SendEvent("OnTripleTapMiddleRight");
                }
                else if (tapGesture.NormalizedScreenPosition.x > 0.5f - (m_NormalizedThresholdWidth / 2.0f) && tapGesture.NormalizedScreenPosition.x < 0.5f + (m_NormalizedThresholdWidth / 2.0f) && tapGesture.NormalizedScreenPosition.y < m_NormalizedThresholdHeight)
                {
                    EventManager.Instance.SendEvent("OnTripleTapMiddleBottom");
                }
                else if (tapGesture.NormalizedScreenPosition.x > 0.5f - (m_NormalizedThresholdWidth / 2.0f) && tapGesture.NormalizedScreenPosition.x < 0.5f + (m_NormalizedThresholdWidth / 2.0f) && tapGesture.NormalizedScreenPosition.y > 1.0f - m_NormalizedThresholdHeight)
                {
                    EventManager.Instance.SendEvent("OnTripleTapMiddleTop");
                }
                else
                {
                    //	do nothing
                }
            }
            else
            {
                Log.Warning("WatsonCamera", "TapThreeTimes has invalid arguments.");
            }
        }
Ejemplo n.º 3
0
        //---------------------------------------------------------------------
        // EVENT HANDLER
        //---------------------------------------------------------------------

        public void tapHandler(object sender, EventArgs e)
        {
            //Debug.Log ("TIPPIDITAPPTAPP");
            TouchScript.Gestures.TapGesture gesture = sender as TouchScript.Gestures.TapGesture;

            if (float.IsNaN(gesture.ScreenPosition.x) || float.IsNaN(gesture.ScreenPosition.y))
            {
                return;
            }
            if (gesture.ActiveTouches.Count < 2)
            {
                //this.setTappedPosition(gesture.ScreenPosition);
                if (SceneManager.getInstance().currentScene.Equals(SceneList.Map))
                {
                    SceneManager.getInstance().getMapManager().OnTouchMapMarker(gesture.ScreenPosition);
                }
            }
        }
Ejemplo n.º 4
0
        protected override void Start()
        {
            base.Start();

            _tapGesture = GetComponent <TouchScript.Gestures.TapGesture>();
        }