Beispiel #1
0
        void LateUpdate()
        {
            if (_mouseDown.IsDown)
            {
                // test only, move it back to FixedUpdate
                GameObject prevObj = _mouseDown.LastOverObject;
                if (_mouseDown.OverObjectChanged())
                {
                    MessengerGlobal <GameObject, GameObject, GameObject> .Broadcast(EventsCtrl.TouchOverEnd, _mouseDown.StartOverObject, prevObj, _mouseDown.LastOverObject);

                    MessengerGlobal <GameObject, GameObject> .Broadcast(EventsCtrl.TouchOverStart, prevObj, _mouseDown.LastOverObject);

                    if (_mouseDown.StartControlObject != null)
                    {
                        _mouseDown.StartControlObject.MouseMoved(_mouseDown.LastOverObject);
                    }
                }

                if (!Input.GetMouseButton(0))
                {
                    MouseUp();
                }
            }
            else
            {
                if (Input.GetMouseButton(0))
                {
                    MouseDown();
                }
            }
        }
Beispiel #2
0
        public void MouseDown()
        {
            _mouseDown.OverObject();

            Debug.Log("TouchController::StartTouch() startOver: " + _mouseDown.LastOverObject);
            ObjectCtrl controlObj = _mouseDown.StartClick();

            MessengerGlobal <GameObject> .Broadcast(EventsCtrl.TouchStart, _mouseDown.LastOverObject);

//			MessengerGlobal<List<GameObject>>.Broadcast(EventsCtrl.TouchStartAll, _mouseDown.LastOverObjects);
            MessengerGlobal <GameObject, GameObject> .Broadcast(EventsCtrl.TouchOverStart, null, _mouseDown.LastOverObject);

            if (controlObj != null)
            {
                controlObj.MouseDown();
            }
        }
Beispiel #3
0
        public void MouseUp()
        {
            Debug.Log("TouchController::EndTouch() startOver: " + _mouseDown.StartOverObject + " lastOver: " + _mouseDown.LastOverObject);
            MessengerGlobal <GameObject, GameObject> .Broadcast(EventsCtrl.TouchEnd, _mouseDown.StartOverObject, _mouseDown.LastOverObject);

            MessengerGlobal <GameObject, GameObject, GameObject> .Broadcast(EventsCtrl.TouchOverEnd, _mouseDown.StartOverObject, _mouseDown.LastOverObject, null);

            if (_mouseDown.StartOverObject == _mouseDown.LastOverObject)
            {
                if (_lastClickedObject == _mouseDown.LastOverObject && _doubleClickEndTime > Time.time)
                {
                    MessengerGlobal <GameObject> .Broadcast(EventsCtrl.DoubleClick, _mouseDown.LastOverObject);

                    _lastClickedObject = null;
                }
                else
                {
                    _lastClickedObject  = _mouseDown.LastOverObject;
                    _doubleClickEndTime = Time.time + DOUBLE_CLICK_TIME;
                    MessengerGlobal <GameObject> .Broadcast(EventsCtrl.Click, _mouseDown.LastOverObject);
                }
            }
            else
            {
                _lastClickedObject = null;
            }

            if (_mouseDown.StartControlObject)
            {
                if (_mouseDown.LastOverObject == _mouseDown.StartControlObject.gameObject)
                {
                    _mouseDown.StartControlObject.OnClicked();
                }
                _mouseDown.StartControlObject.MouseUp(_mouseDown.LastOverObject);
            }

            _mouseDown.StopClick();
        }