Exemplo n.º 1
0
        protected override void OnCreate()
        {
            DragThreshold         = 3.0f;
            m_ButtonStates        = new NativeArray <MouseButtonState>(3, Allocator.Persistent);
            m_CommandBufferSystem = World.GetOrCreateSystem <ControlsInputBufferSystem>();

            m_PointerEventArchetype  = EntityManager.CreateArchetype(typeof(PointerEvent), typeof(PointerInputBuffer));
            m_KeyboardEventArchetype =
                EntityManager.CreateArchetype(typeof(KeyboardEvent), typeof(KeyboardInputBuffer));

            m_RootGroup = GetEntityQuery(new EntityQueryDesc
            {
                All = new ComponentType[]
                {
                    ComponentType.ReadOnly <RectTransform>(),
                    ComponentType.ReadOnly <Child>(),
                    ComponentType.ReadOnly <WorldSpaceRect>(),
                },
                None = new ComponentType[]
                {
                    typeof(Parent)
                },
                Options = EntityQueryOptions.FilterWriteGroup
            });

            EntityManager.CreateEntity(typeof(InputSystemState));
            EntityManager.CreateEntity(typeof(NativePointerInputContainer), typeof(NativePointerButtonEvent), typeof(NativePointerState));
            EntityManager.CreateEntity(typeof(NativeKeyboardInputContainer), typeof(NativeKeyboardInputEvent));
            base.OnCreateManager();
        }