コード例 #1
0
        void UpdateTouch(TouchInfo touch)
        {
            TouchContainer container = null;
            var            id        = touch.id;

            if (_containers.ContainsKey(id))
            {
                container = _containers[id];
            }
            else
            {
                container    = _containersPool.Obtain(CreateTouchContainer);
                container.Id = id;
                _containers.Add(id, container);
            }
            container.Touch = touch;
            UpdateContainer(container, touch.phase);
        }
コード例 #2
0
        void UpdateContainer(TouchContainer container, TouchPhase phase)
        {
            switch (phase)
            {
            case TouchPhase.Began:
                _startList.Add(container);
                break;

            case TouchPhase.Moved:
            case TouchPhase.Stationary:
                _updateList.Add(container);
                break;

            case TouchPhase.Ended:
            case TouchPhase.Canceled:
                _endList.Add(container);
                break;
            }
        }
コード例 #3
0
        void UpdateMouse(UpdateArgs e)
        {
            var lbState = Input.GetMouseButton(0);
            var id      = MouseTouchId;
            var touch   = new TouchInfo(MouseTouchId, TouchPhase.Began, Input.mousePosition, e.time);

            touch.CalRay(CreateArgs.Camera, new Plane(Vector3.forward, Vector3.zero));
            TouchContainer container = null;

            if (lbState)
            {
                touch.id = id;
                if (_containers.ContainsKey(id))
                {
                    container = _containers[id];
                    _updateList.Add(container);
                    touch.phase = TouchPhase.Moved;
                }
                else
                {
                    container    = _containersPool.Obtain(CreateTouchContainer);
                    container.Id = id;
                    _containers.Add(id, container);
                    _startList.Add(container);
                    touch.phase = TouchPhase.Began;
                }
                container.Touch = touch;
            }
            else
            {
                if (_containers.ContainsKey(id))
                {
                    container = _containers[id];
                    _endList.Add(container);
                    touch.phase     = TouchPhase.Ended;
                    container.Touch = touch;
                }
            }
        }