コード例 #1
0
        // ----------------------
        public void OnSystemTouchMove(SystemTouchEventData data)
        {
            if (!this.IsInitialized)
            {
                return;
            }

            if (this.rig != null)
            {
                this.rig.WakeTouchControlsUp();
            }

            SystemTouch t = this.FindTouch(data.id);

            if (t == null)
            {
                return;
            }


            t.WakeUp();

            Vector2 pos = data.pos;

#if UNITY_EDITOR
            mSkipTouchScreenPixels = Mathf.Clamp(mSkipTouchScreenPixels, 0, 10);
            if (mSkipTouchScreenPixels > 0)
            {
                pos.x = (float)((mSkipTouchScreenPixels + 1) * (Mathf.RoundToInt(pos.x) / (mSkipTouchScreenPixels + 1)));
                pos.y = (float)((mSkipTouchScreenPixels + 1) * (Mathf.RoundToInt(pos.y) / (mSkipTouchScreenPixels + 1)));
            }
#endif

            t.touch.Move(pos, data.cam);



            // Handle swipe over...

            List <TouchControl>
            restrictedSwipeOverTargetList = t.touch.GetRestrictedSwipeOverTargetList();
            List <TouchControl>
            swipeOverTargetList = ((restrictedSwipeOverTargetList != null) ? restrictedSwipeOverTargetList : this.controls);



            if ((swipeOverTargetList.Count > 0) &&
                (this.hitPool.HitTest(swipeOverTargetList, t.touch.screenPosCur, t.touch.cam, MAX_RAYCAST_HITS, 0) > 0))
            {
                for (int ci = 0; ci < this.hitPool.GetList().Count; ++ci)
                {
                    TouchControl c = this.hitPool.GetList()[ci].c;
                    if (!c.IsActive())
                    {
                        continue;
                    }

                    if ((restrictedSwipeOverTargetList == null) ? c.CanBeSwipedOverFromNothing(t.touch) : c.CanBeSwipedOverFromRestrictedList(t.touch))
                    {
                        if (c.OnTouchStart(t.touch, null, TouchControl.TouchStartType.SwipeOver))
                        {
                            if (!c.shareTouch)
                            {
                                break;
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
 // ----------------
 public bool SwipeOverFromNothingControlFilter(TouchControl c)
 {
     return((c != null) && c.CanBeSwipedOverFromNothing(this));
 }