Search in sources :

Example 1 with LastSeenTooltipFactory

use of eidolons.libgdx.gui.tooltips.LastSeenTooltipFactory in project Eidolons by IDemiurge.

the class UnitViewFactory method create.

public static GridUnitView create(BattleFieldObject bfObj) {
    UnitViewOptions options = new UnitViewOptions(bfObj);
    GridUnitView view = new GridUnitView(options);
    if (VisionMaster.isLastSeenOn()) {
        LastSeenView lsv = new LastSeenView(options, view);
        view.setLastSeenView(lsv);
        new LastSeenTooltipFactory().add(lsv, bfObj);
    }
    view.setOutlinePathSupplier(() -> {
        OUTLINE_TYPE type = null;
        // if (bfObj instanceof Unit) {
        // if (!VisionManager.checkVisible(bfObj)) {
        // type = OUTLINE_TYPE.DARK_OUTLINE;
        // }
        // }
        // if (type == null)
        type = bfObj.getOutlineTypeForPlayer();
        if (type == null)
            return null;
        String path = Eidolons.game.getVisionMaster().getVisibilityMaster().getImagePath(type, bfObj);
        return (path);
    });
    view.createHpBar((new ResourceSourceImpl(bfObj)));
    if (bfObj instanceof Unit) {
        view.getInitiativeQueueUnitView().getHpBar().setTeamColor(options.getTeamColor());
    }
    view.getHpBar().setTeamColor(options.getTeamColor());
    final UnitViewTooltip tooltip = new UnitViewTooltip(view);
    tooltip.setUserObject(UnitViewTooltipFactory.create(bfObj));
    view.setToolTip(tooltip);
    ClickListener listener = createListener(bfObj);
    view.addListener(listener);
    view.getInitiativeQueueUnitView().addListener(listener);
    return view;
}
Also used : OUTLINE_TYPE(main.content.enums.rules.VisionEnums.OUTLINE_TYPE) ResourceSourceImpl(eidolons.libgdx.gui.panels.dc.unitinfo.datasource.ResourceSourceImpl) LastSeenTooltipFactory(eidolons.libgdx.gui.tooltips.LastSeenTooltipFactory) Unit(eidolons.entity.obj.unit.Unit) UnitViewTooltip(eidolons.libgdx.gui.tooltips.UnitViewTooltip) BattleClickListener(eidolons.libgdx.bf.mouse.BattleClickListener) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Aggregations

ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)1 Unit (eidolons.entity.obj.unit.Unit)1 BattleClickListener (eidolons.libgdx.bf.mouse.BattleClickListener)1 ResourceSourceImpl (eidolons.libgdx.gui.panels.dc.unitinfo.datasource.ResourceSourceImpl)1 LastSeenTooltipFactory (eidolons.libgdx.gui.tooltips.LastSeenTooltipFactory)1 UnitViewTooltip (eidolons.libgdx.gui.tooltips.UnitViewTooltip)1 OUTLINE_TYPE (main.content.enums.rules.VisionEnums.OUTLINE_TYPE)1