Пример #1
0
 void Input_OnGUIEvent(Event evt)
 {
     if (evt.type == EventType.MouseDown)
     {
         var pos = _getPointerPosition(position: evt.mousePosition);
         _wrapper.OnPointerDown(pos: pos, _buttonToPointerId(buttonId: evt.button));
     }
     else if (evt.type == EventType.MouseUp || evt.rawType == EventType.MouseUp)
     {
         var pos = _getPointerPosition(position: evt.mousePosition);
         _wrapper.OnPointerUp(pos: pos, _buttonToPointerId(buttonId: evt.button));
     }
     else if (evt.type == EventType.MouseDrag)
     {
         var pos = _getPointerPosition(position: evt.mousePosition);
         _wrapper.OnMouseMove(pos: pos);
     }
     else if (evt.type == EventType.MouseMove)
     {
         var pos = _getPointerPosition(position: evt.mousePosition);
         _wrapper.OnMouseMove(pos: pos);
     }
     else if (evt.type == EventType.ScrollWheel && evt.delta.magnitude != 0)
     {
         var delta = evt.delta;
         delta.y /= 3f;
         var pos = _getPointerPosition(position: evt.mousePosition);
         _wrapper.OnMouseScroll(delta: delta, pos: pos);
     }
 }
Пример #2
0
 void Input_OnGUIEvent(Event evt)
 {
     if (evt.type == EventType.MouseDown)
     {
         var pos = _getPointerPosition(position: evt.mousePosition);
         _wrapper.OnPointerDown(pos: pos, _buttonToPointerId(buttonId: evt.button));
     }
     else if (evt.type == EventType.MouseUp || evt.rawType == EventType.MouseUp)
     {
         var pos = _getPointerPosition(position: evt.mousePosition);
         _wrapper.OnPointerUp(pos: pos, _buttonToPointerId(buttonId: evt.button));
     }
     else if (evt.type == EventType.MouseDrag)
     {
         var pos = _getPointerPosition(position: evt.mousePosition);
         _wrapper.OnMouseMove(pos: pos);
     }
     else if (evt.type == EventType.MouseMove)
     {
         var pos = _getPointerPosition(position: evt.mousePosition);
         _wrapper.OnMouseMove(pos: pos);
     }
     else if (evt.type == EventType.ScrollWheel && evt.delta.magnitude != 0)
     {
         var delta = evt.delta;
         delta.y /= 3f;
         var pos = _getPointerPosition(position: evt.mousePosition);
         _wrapper.OnMouseScroll(delta: delta, pos: pos);
     }
     else if (evt.type == EventType.DragUpdated)
     {
         var pos = _getPointerPosition(position: evt.mousePosition);
         _wrapper.OnDragUpdateInEditor(pos: pos);
     }
     else if (evt.type == EventType.DragPerform || evt.type == EventType.DragExited)
     {
         var pos = _getPointerPosition(position: evt.mousePosition);
         _wrapper.OnDragReleaseInEditor(pos: pos);
     }
     else if (evt.isKey)
     {
         _wrapper.OnKeyDown(e: evt);
         Event.current.Use();
     }
 }