Пример #1
0
        internal static EventBase CreateEvent(Event systemEvent)
        {
            switch (systemEvent.type)
            {
            case EventType.MouseMove:
                return(MouseMoveEvent.GetPooled(systemEvent));

            case EventType.MouseDrag:
                return(MouseMoveEvent.GetPooled(systemEvent));

            case EventType.MouseDown:
                return(MouseDownEvent.GetPooled(systemEvent));

            case EventType.MouseUp:
                return(MouseUpEvent.GetPooled(systemEvent));

            case EventType.ScrollWheel:
                return(WheelEvent.GetPooled(systemEvent));

            case EventType.KeyDown:
                return(KeyDownEvent.GetPooled(systemEvent));

            case EventType.KeyUp:
                return(KeyUpEvent.GetPooled(systemEvent));

            case EventType.MouseEnterWindow:
                return(MouseEnterWindowEvent.GetPooled(systemEvent));

            case EventType.MouseLeaveWindow:
                return(MouseLeaveWindowEvent.GetPooled(systemEvent));

            default:
                return(IMGUIEvent.GetPooled(systemEvent));
            }
        }
Пример #2
0
        // In order for tests to run without an EditorWindow but still be able to send
        // events, we sometimes need to force the event type. IMGUI::GetEventType() (native) will
        // return the event type as Ignore if the proper views haven't yet been
        // initialized. This (falsely) breaks tests that rely on the event type. So for tests, we
        // just ensure the event type is what we originally set it to when we sent it.
        internal static EventBase CreateEvent(Event systemEvent, EventType eventType)
        {
            switch (eventType)
            {
            case EventType.MouseMove:
                return(MouseMoveEvent.GetPooled(systemEvent));

            case EventType.MouseDrag:
                return(MouseMoveEvent.GetPooled(systemEvent));

            case EventType.MouseDown:
                return(MouseDownEvent.GetPooled(systemEvent));

            case EventType.MouseUp:
                return(MouseUpEvent.GetPooled(systemEvent));

            case EventType.ContextClick:
                return(ContextClickEvent.GetPooled(systemEvent));

            case EventType.MouseEnterWindow:
                return(MouseEnterWindowEvent.GetPooled(systemEvent));

            case EventType.MouseLeaveWindow:
                return(MouseLeaveWindowEvent.GetPooled(systemEvent));

            case EventType.ScrollWheel:
                return(WheelEvent.GetPooled(systemEvent));

            case EventType.KeyDown:
                return(KeyDownEvent.GetPooled(systemEvent));

            case EventType.KeyUp:
                return(KeyUpEvent.GetPooled(systemEvent));

            case EventType.DragUpdated:
                return(DragUpdatedEvent.GetPooled(systemEvent));

            case EventType.DragPerform:
                return(DragPerformEvent.GetPooled(systemEvent));

            case EventType.DragExited:
                return(DragExitedEvent.GetPooled(systemEvent));

            case EventType.ValidateCommand:
                return(ValidateCommandEvent.GetPooled(systemEvent));

            case EventType.ExecuteCommand:
                return(ExecuteCommandEvent.GetPooled(systemEvent));

            default:    // Layout, Ignore, Used
                return(IMGUIEvent.GetPooled(systemEvent));
            }
        }
        internal static EventBase CreateEvent(Event systemEvent)
        {
            EventBase pooled;

            switch (systemEvent.type)
            {
            case EventType.MouseDown:
                pooled = MouseEventBase <MouseDownEvent> .GetPooled(systemEvent);

                break;

            case EventType.MouseUp:
                pooled = MouseEventBase <MouseUpEvent> .GetPooled(systemEvent);

                break;

            case EventType.MouseMove:
                pooled = MouseEventBase <MouseMoveEvent> .GetPooled(systemEvent);

                break;

            case EventType.MouseDrag:
                pooled = MouseEventBase <MouseMoveEvent> .GetPooled(systemEvent);

                break;

            case EventType.KeyDown:
                pooled = KeyboardEventBase <KeyDownEvent> .GetPooled(systemEvent);

                break;

            case EventType.KeyUp:
                pooled = KeyboardEventBase <KeyUpEvent> .GetPooled(systemEvent);

                break;

            case EventType.ScrollWheel:
                pooled = WheelEvent.GetPooled(systemEvent);
                break;

            default:
                pooled = IMGUIEvent.GetPooled(systemEvent);
                break;
            }
            return(pooled);
        }
Пример #4
0
        internal static EventBase CreateEvent(Event systemEvent)
        {
            EventType type = systemEvent.type;
            EventBase pooled;

            switch (type)
            {
            case EventType.MouseDown:
                pooled = MouseEventBase <MouseDownEvent> .GetPooled(systemEvent);

                break;

            case EventType.MouseUp:
                pooled = MouseEventBase <MouseUpEvent> .GetPooled(systemEvent);

                break;

            case EventType.MouseMove:
                pooled = MouseEventBase <MouseMoveEvent> .GetPooled(systemEvent);

                break;

            case EventType.MouseDrag:
                pooled = MouseEventBase <MouseMoveEvent> .GetPooled(systemEvent);

                break;

            case EventType.KeyDown:
                pooled = KeyboardEventBase <KeyDownEvent> .GetPooled(systemEvent);

                break;

            case EventType.KeyUp:
                pooled = KeyboardEventBase <KeyUpEvent> .GetPooled(systemEvent);

                break;

            case EventType.ScrollWheel:
                pooled = WheelEvent.GetPooled(systemEvent);
                break;

            default:
                if (type != EventType.MouseEnterWindow)
                {
                    if (type != EventType.MouseLeaveWindow)
                    {
                        pooled = IMGUIEvent.GetPooled(systemEvent);
                    }
                    else
                    {
                        pooled = MouseEventBase <MouseLeaveWindowEvent> .GetPooled(systemEvent);
                    }
                }
                else
                {
                    pooled = MouseEventBase <MouseEnterWindowEvent> .GetPooled(systemEvent);
                }
                break;
            }
            return(pooled);
        }