Search in sources :

Example 1 with PositionChoiceView

use of eidolons.client.cc.gui.neo.choice.PositionChoiceView in project Eidolons by IDemiurge.

the class UnitGroupMaster method mapPositions.

private static List<ObjAtCoordinate> mapPositions(List<ObjType> list, Entity hero) {
    ChoiceSequence sequence = new ChoiceSequence();
    Unit unit = null;
    // posView.in
    List<Unit> units = new ArrayList<>();
    if (hero != null) {
        if (hero instanceof Unit) {
            unit = (Unit) hero;
        } else {
            unit = (new Unit((ObjType) hero));
        }
        units.add(unit);
    }
    for (ObjType type : list) {
        if (type != null) {
            units.add(new Unit(type));
        }
    }
    PositionChoiceView posView = new PositionChoiceView(sequence, unit) {

        @Override
        protected boolean isReady() {
            return false;
        }
    };
    sequence.addView(posView);
    Map<Unit, Coordinates> map = DC_Game.game.getDungeonMaster().getPositioner().getPartyCoordinates(units);
    posView.setPartyCoordinates(map);
    sequence.setManager(new SequenceManager() {

        @Override
        public void doneSelection() {
            WaitMaster.receiveInput(WAIT_OPERATIONS.CUSTOM_SELECT, true);
        }

        @Override
        public void cancelSelection() {
            WaitMaster.receiveInput(WAIT_OPERATIONS.CUSTOM_SELECT, false);
        }
    });
    sequence.start();
    Launcher.setView(VIEWS.CHOICE);
    boolean result = (boolean) WaitMaster.waitForInput(WAIT_OPERATIONS.CUSTOM_SELECT);
    Launcher.initMenu(MAIN_MENU_ITEMS.FACTION);
    Launcher.setView(VIEWS.MENU);
    if (!result) {
        return null;
    }
    DC_SoundMaster.playStandardSound(STD_SOUNDS.OK);
    return ListMaster.toObjAtCoordinate(units);
}
Also used : ObjType(main.entity.type.ObjType) PositionChoiceView(eidolons.client.cc.gui.neo.choice.PositionChoiceView) Coordinates(main.game.bf.Coordinates) ArrayList(java.util.ArrayList) ChoiceSequence(eidolons.client.cc.gui.neo.choice.ChoiceSequence) Unit(eidolons.entity.obj.unit.Unit) SequenceManager(eidolons.client.dc.SequenceManager)

Aggregations

ChoiceSequence (eidolons.client.cc.gui.neo.choice.ChoiceSequence)1 PositionChoiceView (eidolons.client.cc.gui.neo.choice.PositionChoiceView)1 SequenceManager (eidolons.client.dc.SequenceManager)1 Unit (eidolons.entity.obj.unit.Unit)1 ArrayList (java.util.ArrayList)1 ObjType (main.entity.type.ObjType)1 Coordinates (main.game.bf.Coordinates)1