public EditorRendererEvent ProcessEvents(Event currentEvent, Rect r) { EditorRendererEvent e = null; for (int i = GUIQueueSize - 1; i >= 0; i--) { if ((e = GUIRenderQueue [i].ProcessEvents(currentEvent, r)) != null) { break; } } return(e); }
protected bool ProcessEvents(Event currentEvent) { if (rect.Contains(currentEvent.mousePosition)) { // mousePosition = currentEvent.mousePosition - rect.position; EditorRendererEvent e = guiSystem.ProcessEvents(currentEvent, rect); if (e != null) { if (OnGUIEvent != null) { OnGUIEvent(e); } return(true); } if (renderUtil.camera.orthographic) { Vector2 invertedY = new Vector2(mousePosition.x, rect.height - mousePosition.y); mousePositionWorld = renderUtil.camera.ScreenToWorldPoint(invertedY * renderUtil.GetScaleFactor(rect.width, rect.height)); } switch (currentEvent.type) { case EventType.MouseDown: if (OnMouseDown != null) { OnMouseDown(); } break; case EventType.MouseUp: if (OnMouseUp != null) { OnMouseUp(); } break; } } else { mousePosition = new Vector2(-1, -1); mousePositionWorld = Vector2.zero; } return(false); }
protected override void EventHandler(EditorRendererEvent e) { switch (e.type) { case EditorRendererEvent.EventType.clicked: if (e.buttonID == buttonBackID) { rotationEuler -= new Vector3(0, 45, 0); SetObjectInDisplay(); } if (e.buttonID == buttonForwardID) { rotationEuler += new Vector3(0, 45, 0); SetObjectInDisplay(); } break; default: throw new System.NotImplementedException("EventType has not been implemented: " + e.type); } }
protected override void EventHandler(EditorRendererEvent e) { serializedObject.Update(); switch (e.type) { case EditorRendererEvent.EventType.clicked: if (e.buttonID == buttonBackID) { rotation.vector3Value -= new Vector3(0, 45, 0); serializedObject.ApplyModifiedProperties(); SetObjectInDisplay(); } if (e.buttonID == buttonForwardID) { rotation.vector3Value += new Vector3(0, 45, 0); serializedObject.ApplyModifiedProperties(); SetObjectInDisplay(); } break; default: throw new System.NotImplementedException("EventType has not been implemented: " + e.type); } }