Exemple #1
0
 void ITouchForwarderController.OnTouchMoved(Touch touch)
 {
     if (this.Touch == null)
     {
         this.StartDrag(touch);
     }
 }
        /// <summary>
        /// Called by the <see cref="LineDrawingTool" /> when the touch associated with this line begins on the <see cref="DrawingSurface" />.
        /// </summary>
        public void OnTouchBegan(DrawingSurface surface, Color color, Touch touch, LineOptions options)
        {
            // get position
            Vector2 position = CameraUtils.TouchToWorldPoint(touch, surface.Transform, surface.Camera);

            position = surface.Transform.parent.InverseTransformPoint(position);

            // reset points
            m_Points           = m_Points ?? new LinePoint[16];
            m_PointCount       = 0;
            m_SmoothPoints     = m_SmoothPoints ?? new LinePoint[1024];
            m_SmoothPointCount = 0;

            // reset
            m_Cap.Reset(options.Overdraw);
            m_Segment.Reset(options.Overdraw);
            m_Velocity.Reset(position, options.VelocityMin, options.VelocityMax, options.VelocitySmoothing);

            // add point
            LinePoint point = default(LinePoint);

            point.Color    = color;
            point.Position = position;
            point.Weight   = Mathf.Lerp(options.WeightMin, options.WeightMax, m_Velocity.Factor);
            AddPoint(point);

            // set flags
            m_IsDirty     = true;
            m_CapRequired = true;
        }
Exemple #3
0
 override public void OnTouchMoved(Touch touch)
 {
     if (this.RollOver && this.Touch == null)
     {
         if (this.IsOverShape(touch))
         {
             this.Touch = touch;
             this.Swallow(m_Touch);
         }
         else
         {
             if (this.Touch == touch)
             {
                 this.Touch = null;
             }
         }
     }
     if (this.Touch != null)
     {
         foreach (ITouchForwarderController t in this.Listeners)
         {
             t.OnTouchMoved(touch);
         }
     }
 }
 public void OnTouchCancelled(Touch touch)
 {
     if (this.Touch == touch)
     {
         this.Touch = null;
     }
 }
        /// <summary>
        /// Invoked when a users finger touches the devices screen
        /// </summary>
        /// <param name="touch">The touch object</param>
        /// <returns>True: TouchDispatcher receives events | False: TouchDispatcher DOES NOT receive events</returns>
        public bool OnTouchBegan(Touch touch)
        {
            bool hasHit = HitTest(touch);

            Debug.Log($"MyTouchObserver::OnTouchBegan:hasHit<{hasHit}>");
            return(hasHit);
        }
Exemple #6
0
        private bool HitTest(Touch touch)
        {
            var bounds = this.Renderer.bounds;

            bounds.extents += Vector3.forward;
            return(bounds.Contains(CameraUtils.TouchToWorldPoint(touch, this.Transform, this.Camera)));
        }
Exemple #7
0
 public void SwallowTouch(Touch touch, TouchForwarderListener controller)
 {
     if (!this.SwallowedTouches.ContainsKey(touch))
     {
         this.SwallowedTouches.Add(touch, controller);
     }
 }
Exemple #8
0
 public void OnTouchEnded(Touch touch)
 {
     if (this.Touch == touch)
     {
         this.Touch = null;
     }
 }
Exemple #9
0
 /// <see cref="ISingleTouchObserver.OnTouchEnded" />
 public void OnTouchEnded(Touch touch)
 {
     if (touch.IsTap && this.HitTest(touch) && this.OnTap != null)
     {
         this.OnTap(this);
     }
 }
Exemple #10
0
        public void OnTouchEnded(Touch touch)
        {
            //Single touch behaviour
            //m_Touch = null;

            //Mutitouch behaviour
            this.Touches.Remove(touch);
        }
 protected void OnTouchStartButton(TouchArea touchArea, Touch touch)
 {
     if (this.TitleSceneController)
     {
         PlayAudio();
         this.TitleSceneController.OnTouchStartButton(touchArea, touch);
     }
 }
Exemple #12
0
 private void EndDrag(Touch touch)
 {
     if (this.Touch == null || this.Touch != touch)
     {
         return;
     }
     this.Touch = null;
 }
Exemple #13
0
        private void StartDrag(Touch touch)
        {
            if (Touch != null)
            {
                return;
            }

            this.Touch = touch;
        }
Exemple #14
0
 virtual public void OnTouchStartButton(TouchArea touchArea, Touch touch)
 {
     if (SceneNavigator.Instance && SceneNavigator.Instance.IsReady)
     {
         SagoBiz.Facade.OnSceneWillDisappear(true);
         DisableAllTouchAreas();
         BounceStartButton(touchArea.gameObject);
         StopMusicAndNavigateToNextScene();
     }
 }
Exemple #15
0
 override public void OnTouchCancelled(Touch touch)
 {
     if (this.Touch != null && this.Touch == touch)
     {
         foreach (ITouchForwarderController t in this.Listeners)
         {
             t.OnTouchCancelled(touch);
         }
     }
 }
Exemple #16
0
 public bool OnTouchBegan(Touch touch)
 {
     if (!HitTest(touch))
     {
         return(false);
     }
     m_Touches.Add(touch);
     Debug.Log("Touch began. Num touches now " + m_Touches.Count);
     return(true);
 }
Exemple #17
0
        public bool IsOverShape(Touch touch)
        {
            if (this.SwallowTouch && touch == this.Touch)
            {
                return(true);
            }
            bool overShape = this.TouchShape.PositionOverShape(CameraUtils.TouchToWorldPoint(touch, this.Camera.transform, this.Camera));

            return(overShape);
        }
Exemple #18
0
 public void OnTouchBeganInternal(Touch touch)
 {
     foreach (TouchForwarderListener l in this.Listeners)
     {
         l.OnTouchBegan(touch);
         if (this.SwallowedTouches.ContainsKey(touch))
         {
             break;
         }
     }
 }
 /// <summary>
 /// Prevents pass-through of touches over the DevUI.
 /// Otherwise, returns false.
 /// </summary>
 public bool OnTouchBegan(Touch touch)
 {
     if (this.DebugGUIClient == null || !this.DebugGUIClient.IsEnabled)
     {
         return(false);
     }
     else
     {
         Vector2 guiTouch = GUIUtility.ScreenToGUIPoint(new Vector2(touch.Position.x, Screen.height - touch.Position.y));
         return(this.WindowRect.Contains(guiTouch));
     }
 }
Exemple #20
0
 private void OnTouchCancelledInternal(Touch touch)
 {
     foreach (TouchForwarderListener l in this.Listeners)
     {
         l.OnTouchCancelled(touch);
     }
     this.Touches.Remove(touch);
     if (this.SwallowedTouches.ContainsKey(touch))
     {
         this.SwallowedTouches.Remove(touch);
     }
 }
Exemple #21
0
 /// <see cref="ISingleTouchObserver.OnTouchEnded" />
 public void OnTouchEnded(Touch touch)
 {
     if (touch.IsTap && this.HitTest(touch))
     {
         // Quitting out of game so that it is not left in memory stack.
         // This is for any Android derived OS that does not have back button or home button that users can interact with.
         // Right now doing this only for PanasonicEx platform but we can add more platforms to the macro.
                         #if SAGO_PANASONIC_EX
         BounceScaleBehaviour.Trigger();
         StartCoroutine(WaitAndQuit(m_TimeToWaitBeforeQuit));
                         #endif
     }
 }
Exemple #22
0
        /// <summary>
        /// Checks whether the touch is hitting the renderer.
        /// </summary>
        bool HitTest(Touch touch)
        {
            if (this.Camera && this.Renderer)
            {
                Bounds bounds;
                bounds = Align.Bounds;

                Vector3 point;
                point = CameraUtils.TouchToWorldPoint(touch, this.Transform, this.Camera);

                return(bounds.Contains(point));
            }
            return(false);
        }
Exemple #23
0
 /// <summary>
 /// <see cref="ISingleTouchObserver.OnTouchEnded" />
 /// </summary>
 public void OnTouchEnded(Touch touch)
 {
     if (Touches.Contains(touch))
     {
         if (Surface != null && Tool != null)
         {
             Tool.OnTouchEnded(Surface, touch);
         }
     }
     Touches.Remove(touch);
     if (Touches.Count == 0 && DrawingEnded != null)
     {
         DrawingEnded(this);
     }
 }
Exemple #24
0
 override public void OnTouchBegan(Touch touch)
 {
     if (this.IsOverShape(touch))
     {
         this.Touch = touch;
         this.Swallow(m_Touch);
     }
     if (this.Touch != null)
     {
         foreach (ITouchForwarderController t in this.Listeners)
         {
             t.OnTouchBegan(this.Touch);
         }
     }
 }
 public void OnTouchEnded(Touch touch)
 {
     if (handleMultipleTouches)
     {
         this.Touches.Remove(touch);
         if (this.Touches.Count < 1)
         {
             ReactTouchOut();
         }
     }
     else
     {
         ReactTouchOut();
         m_Touch = null;
     }
 }
Exemple #26
0
 private void OnTouchMovedInternal(Touch touch)
 {
     foreach (TouchForwarderListener l in this.Listeners)
     {
         if (this.SwallowedTouches.ContainsKey(touch))
         {
             if (l == this.SwallowedTouches[touch])
             {
                 l.OnTouchMoved(touch);
             }
         }
         else
         {
             l.OnTouchMoved(touch);
         }
     }
 }
Exemple #27
0
        public bool OnTouchBegan(Touch touch)
        {
            //Single Touch Behaviour
            //if(m_Touch == null && HitTest(touch)) {
            //    m_Touch = touch;
            //    return true;
            //}

            //Mutitouch Behaviour
            if (HitTest(touch))
            {
                this.Touches.Add(touch);
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Called by the <see cref="LineDrawingTool" /> when the touch associated with this line moves on the <see cref="DrawingSurface" />.
        /// </summary>
        public void OnTouchMoved(DrawingSurface surface, Color color, Touch touch, LineOptions options)
        {
            // get position
            Vector2 position = CameraUtils.TouchToWorldPoint(touch, surface.Transform, surface.Camera);

            position = surface.Transform.parent.InverseTransformPoint(position);

            // update
            m_Velocity.Update(position);

            // add point
            LinePoint point = default(LinePoint);

            point.Color    = color;
            point.Position = position;
            point.Weight   = Mathf.Lerp(options.WeightMin, options.WeightMax, m_Velocity.Factor);
            AddPoint(point);
        }
Exemple #29
0
        // ISingleTouchObserver Implementation

        public bool OnTouchBegan(Touch touch)
        {
            // Actually check if the touch is within this object
            RaycastHit2D hit2D;
            Vector2      ray = Camera.ScreenToWorldPoint(touch.Position);

            hit2D = Physics2D.Raycast(ray, Vector3.back);

            if (hit2D.transform == transform)
            {
                rb2d.sharedMaterial = null;
                this.Touch          = touch;
                return(true);
            }
            else
            {
                return(false);
            }
        }
 public bool OnTouchBegan(Touch touch)
 {
     if (HitTest(touch))
     {
         if (handleMultipleTouches)
         {
             this.Touches.Add(touch);
             ReactTouchIn();
             return(true);
         }
         if (m_Touch == null)
         {
             m_Touch = touch;
             ReactTouchIn();
             return(true);
         }
     }
     return(false);
 }