Search in sources :

Example 1 with GridUnitView

use of eidolons.libgdx.bf.grid.GridUnitView 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)

Example 2 with GridUnitView

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

the class InitiativePanel method cleanUp.

private void cleanUp() {
    Map<Integer, QueueView> views = new XLinkedMap<>();
    DC_Game.game.getTurnManager().getDisplayedUnitQueue().stream().forEach(unit -> {
        Object o = DungeonScreen.getInstance().getGridPanel().getViewMap().get(unit);
        if (o instanceof GridUnitView) {
            GridUnitView view = ((GridUnitView) o);
            views.put(view.getCurId(), view.getInitiativeQueueUnitView());
        }
    });
    /*
        if unit is unknown/unseen?
        >>
        if unit is unable to act?

        proper cleanup is not done on death(), right?
         */
    for (QueueViewContainer sub : queue) {
        if (sub == null)
            continue;
        if (!views.containsKey(sub.id)) {
            QueueViewContainer view = getIfExists(sub.id);
            if (view == null)
                continue;
            if (view.getActor() == null)
                continue;
            removeView((sub.id));
        }
    }
    // to ensure proper values are displayed
    previewAtbReadiness(null);
}
Also used : QueueView(eidolons.libgdx.bf.grid.QueueView) XLinkedMap(main.data.XLinkedMap) GridUnitView(eidolons.libgdx.bf.grid.GridUnitView)

Aggregations

GridUnitView (eidolons.libgdx.bf.grid.GridUnitView)2 GenericGridView (eidolons.libgdx.bf.grid.GenericGridView)1 GridCellContainer (eidolons.libgdx.bf.grid.GridCellContainer)1 QueueView (eidolons.libgdx.bf.grid.QueueView)1 ArrayList (java.util.ArrayList)1 XLinkedMap (main.data.XLinkedMap)1