Search in sources :

Example 1 with GenericGridView

use of eidolons.libgdx.bf.grid.GenericGridView in project Eidolons by IDemiurge.

the class GlobalController method tab.

private void tab() {
    GridUnitView hovered = DungeonScreen.getInstance().getGridPanel().getHoverObj();
    GridCellContainer cell = (GridCellContainer) hovered.getParent();
    List<GenericGridView> list = new ArrayList<>(cell.getUnitViewsVisible());
    if (list.size() == 1)
        // or do something else
        return;
    SortMaster.sortByExpression(list, view -> view.hashCode());
    int index = list.indexOf(hovered);
    index++;
    if (list.size() <= index)
        index = 0;
    GuiEventManager.trigger(GuiEventType.GRID_OBJ_HOVER_OFF, hovered);
    GenericGridView newFocus = list.get(index);
    cell.popupUnitView(newFocus);
    GuiEventManager.trigger(GuiEventType.GRID_OBJ_HOVER_ON, newFocus);
    GuiEventManager.trigger(GuiEventType.SHOW_TOOLTIP, newFocus.getTooltip());
}
Also used : GridCellContainer(eidolons.libgdx.bf.grid.GridCellContainer) ArrayList(java.util.ArrayList) GenericGridView(eidolons.libgdx.bf.grid.GenericGridView) GridUnitView(eidolons.libgdx.bf.grid.GridUnitView)

Aggregations

GenericGridView (eidolons.libgdx.bf.grid.GenericGridView)1 GridCellContainer (eidolons.libgdx.bf.grid.GridCellContainer)1 GridUnitView (eidolons.libgdx.bf.grid.GridUnitView)1 ArrayList (java.util.ArrayList)1