//dir > 0 鼠标中间滚轮向后滚动 //dir <0 鼠标中间滚轮向前滚动 public void OnScrollWheel(float dir) { if (scrollWheelListeners != null) { _eventParam.Reset(); _eventParam.eventType = TouchEventType.ScrollWheel; TouchInfo touch = ObjectPool <TouchInfo> .Instance.GetObject(); touch.position.x = dir; _eventParam.AddTouch(touch); scrollWheelListeners.Invoke(_eventParam); } }
public void OnTouchEnded(Vector2 pos) { if (touchEndedListeners != null) { _eventParam.Reset(); _eventParam.eventType = TouchEventType.TouchEnded; TouchInfo touch = ObjectPool <TouchInfo> .Instance.GetObject(); touch.position = pos; _eventParam.AddTouch(touch); touchEndedListeners.Invoke(_eventParam); } }
public void OnMultiTouchMoved(Touch[] touches) { if (multiTouchMovedListeners != null) { _eventParam.Reset(); _eventParam.eventType = TouchEventType.MultiTouchMoved; int count = touches.Length; for (int i = 0; i < count; ++i) { Touch touch = Input.GetTouch(i); TouchInfo info = ObjectPool <TouchInfo> .Instance.GetObject(); info.position = touch.position; info.deltaPosition = touch.deltaPosition; info.fingerId = touch.fingerId; _eventParam.AddTouch(info); } multiTouchMovedListeners.Invoke(_eventParam); } }
public void AddTouch(TouchInfo info) { _touchs.Add(info); }