Пример #1
0
    private void CreateMainUiRootEntity(GameObject go)
    {
        UiEntity entity = _context.CreateEntity();

        entity.isMainUi     = true;
        entity.isViewRoot   = true;
        entity.isMainUiRoot = true;
        entity.AddView(go);
        go.Link(entity, _context);
    }
Пример #2
0
    protected override void Execute(List <InputEntity> entities)
    {
        foreach (var entity in entities)
        {
            if (entity.hasInputSelectionFrameStart && entity.hasInputSelectionFrameEnd)
            {
                Vector3 sPos = entity.inputSelectionFrameStart.position;
                Vector3 ePos = entity.inputSelectionFrameEnd.position;

                Rect builtRect = RectUtils.CreateFromPoints(sPos, ePos);

                UiEntity rectEntity = uiContext.selectionUiEntity;
                if (rectEntity == null)
                {
                    rectEntity = uiContext.CreateEntity();
                    rectEntity.isSelectionUi = true;
                    rectEntity.AddAsset("Prefabs/SelectionRect");
                }
                rectEntity.ReplaceRect(builtRect);
            }
        }
    }