public void SetEntitySelection(Entity entitySelection)
 {
     if (entitySelection != Entity.Null && getWorldSelection().EntityManager.Exists(entitySelection))
     {
         SetSelection(new List <int> {
             EntityArrayListAdapter.IndexToItemId(entitySelection.Index)
         });
     }
 }
Exemplo n.º 2
0
 public EntityListView(TreeViewState state, EntityListQuery entityQuery, EntitySelectionCallback entitySelectionCallback, WorldSelectionGetter getWorldSelection, SystemSelectionGetter getSystemSelection) : base(state)
 {
     this.setEntitySelection = entitySelectionCallback;
     this.getWorldSelection  = getWorldSelection;
     this.getSystemSelection = getSystemSelection;
     selectedEntityQuery     = entityQuery;
     rows = new EntityArrayListAdapter();
     getNewSelectionOverride = (item, selection, shift) => new List <int>()
     {
         item.id
     };
     Reload();
 }
 public EntityListView(TreeViewState state, EntityListQuery entityQuery, EntitySelectionCallback entitySelectionCallback, WorldSelectionGetter getWorldSelection, SystemSelectionGetter getSystemSelection, ChunkArrayAssignmentCallback setChunkArray)
     : base(state, new MultiColumnHeader(CreateState()))
 {
     this.setEntitySelection = entitySelectionCallback;
     this.getWorldSelection  = getWorldSelection;
     this.getSystemSelection = getSystemSelection;
     this.setChunkArray      = setChunkArray;
     selectedEntityQuery     = entityQuery;
     rows = new EntityArrayListAdapter();
     getNewSelectionOverride = (item, selection, shift) => new List <int>()
     {
         item.id
     };
     showAlternatingRowBackgrounds = true;
     Reload();
 }
        protected override void RowGUI(RowGUIArgs args)
        {
            var index = EntityArrayListAdapter.ItemIdToIndex(args.item.id);

            if (index > widestIndex)
            {
                widestIndex      = index;
                tempContent.text = widestIndex.ToString();
                widestIndexWith  = DefaultStyles.label.CalcSize(tempContent).x;
            }
            var rowRect = args.rowRect;
            var idRect  = args.rowRect;

            rowRect.xMin += widestIndexWith;
            args.rowRect  = rowRect;

            base.RowGUI(args);

            DefaultGUI.Label(idRect, index.ToString(), args.selected, args.focused);
        }
Exemplo n.º 5
0
 public Enumerator(EntityArrayListAdapter adapter)
 {
     this.adapter = adapter;
     Reset();
 }