Search in sources :

Example 1 with SequenceManager

use of eidolons.client.dc.SequenceManager in project Eidolons by IDemiurge.

the class ScenarioPrecombatMaster method newScenario.

public static void newScenario() {
    final ScenarioChoiceView scv = new ScenarioChoiceView();
    final ChoiceSequence choiceSequence = new ChoiceSequence(scv);
    final ScenarioModeChoiceView smcv = new ScenarioModeChoiceView(choiceSequence, SCENARIO_MODES.class);
    // TODO only if there are choices!
    choiceSequence.addView(smcv);
    choiceSequence.start();
    choiceSequence.setManager(new SequenceManager() {

        @Override
        public void doneSelection() {
            ObjType type = scv.getSelectedItem();
            scenario = new Scenario(type);
            SCENARIO_MODES mode = smcv.getSelectedItem();
            if (mode == SCENARIO_MODES.STORY_MODE) {
                String prop = scenario.getProperty(MACRO_PROPS.MISSION_PARTY);
                List<Unit> heroes;
                if (!DataManager.isTypeName(prop, DC_TYPE.PARTY)) {
                    prop = scenario.getProperty(MACRO_PROPS.MISSION_CUSTOM_PARTY);
                    heroes = new ArrayList<>();
                    String leaderName = prop.split(";")[0];
                    Unit leader = Launcher.getMainManager().initSelectedHero(leaderName);
                    // prop = prop.replace(leaderName, "");
                    // for (String s : StringMaster.open(prop)) {
                    // }
                    heroes.add(leader);
                    PartyHelper.newParty(leader);
                    Launcher.getMainManager().launchHC();
                    return;
                } else {
                    heroes = PartyHelper.loadParty(prop);
                }
                Launcher.getMainManager().launchHC(heroes);
                return;
            }
            Launcher.resetView(VIEWS.MENU);
        }

        @Override
        public void cancelSelection() {
            Launcher.getMainManager().exitToMainMenu();
        }
    });
}
Also used : ObjType(main.entity.type.ObjType) ArrayList(java.util.ArrayList) ChoiceSequence(eidolons.client.cc.gui.neo.choice.ChoiceSequence) ArrayList(java.util.ArrayList) List(java.util.List) Unit(eidolons.entity.obj.unit.Unit) ScenarioChoiceView(eidolons.client.cc.gui.neo.choice.ScenarioChoiceView) ScenarioModeChoiceView(eidolons.client.cc.gui.neo.choice.ScenarioModeChoiceView) SequenceManager(eidolons.client.dc.SequenceManager)

Example 2 with SequenceManager

use of eidolons.client.dc.SequenceManager 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)

Example 3 with SequenceManager

use of eidolons.client.dc.SequenceManager in project Eidolons by IDemiurge.

the class HC_Controls method testFightLaunch.

private void testFightLaunch() {
    ChoiceSequence choiceSequence = new ChoiceSequence();
    choiceSequence.addView(new PrincipleChoiceView(choiceSequence, hero));
    choiceSequence.setManager(new SequenceManager() {

        @Override
        public void doneSelection() {
            Launcher.resetView(VIEWS.HC);
        }

        @Override
        public void cancelSelection() {
            Launcher.resetView(VIEWS.HC);
        }
    });
    choiceSequence.start();
// choose a dungeon freely?
// test profiles , enemy presets
// DC_Game.game.getDungeonMaster().initDungeonLevelChoice();
}
Also used : ChoiceSequence(eidolons.client.cc.gui.neo.choice.ChoiceSequence) HeroChoiceSequence(eidolons.client.cc.gui.neo.choice.HeroChoiceSequence) SequenceManager(eidolons.client.dc.SequenceManager) PrincipleChoiceView(eidolons.client.cc.gui.neo.choice.PrincipleChoiceView)

Example 4 with SequenceManager

use of eidolons.client.dc.SequenceManager in project Eidolons by IDemiurge.

the class SkirmishMaster method getChoiceMaster.

private static SequenceManager getChoiceMaster(final Map<String, File> map, final ListChoiceView battlefieldChoiceView, final EnumChoiceView<OBJECTIVE_TYPE> objectiveChoiceView) {
    return new SequenceManager() {

        @Override
        public void doneSelection() {
            WaitMaster.receiveInput(WAIT_OPERATIONS.CUSTOM_SELECT, true);
            Object bfName = battlefieldChoiceView.getSelectedItem();
            File file = map.get(bfName);
            if (!file.isFile()) {
                return;
            }
            // Dungeon dungeon = DungeonBuilder.buildDungeon(FileManager.readFile(file));
            // specified where? used
            ObjType missionType = new ObjType();
            // for
            // what?
            OBJECTIVE_TYPE objective = objectiveChoiceView.getSelectedItem();
            // initSkirmish(missionType, dungeon);
            Launcher.resetView(VIEWS.MENU);
        }

        @Override
        public void cancelSelection() {
            WaitMaster.receiveInput(WAIT_OPERATIONS.CUSTOM_SELECT, false);
            Launcher.getMainManager().exitToMainMenu();
        }
    };
}
Also used : OBJECTIVE_TYPE(eidolons.game.battlecraft.logic.meta.scenario.ObjectiveMaster.OBJECTIVE_TYPE) ObjType(main.entity.type.ObjType) File(java.io.File) SequenceManager(eidolons.client.dc.SequenceManager)

Example 5 with SequenceManager

use of eidolons.client.dc.SequenceManager in project Eidolons by IDemiurge.

the class DemoManager method initHero.

private static void initHero() {
    // TODO JUST USE 'CHOOSE CENTER HERO' ?
    List<ObjType> demoHeroes = new ArrayList<>();
    DataManager.getTypesSubGroup(DC_TYPE.CHARS, "Demo");
    Unit entity = null;
    ChoiceSequence sequence = new ChoiceSequence();
    sequence.addView(new EntityChoiceView(sequence, entity, demoHeroes) {

        @Override
        public String getInfo() {
            return null;
        }

        @Override
        protected PROPERTY getPROP() {
            return null;
        }

        // @Override
        // protected Condition getFilterConditions() {
        // //                return new NumericCondition("level");
        // }
        @Override
        protected VALUE getFilterValue() {
            return null;
        }

        protected OBJ_TYPE getTYPE() {
            return DC_TYPE.CHARS;
        }
    });
    sequence.setManager(new SequenceManager() {

        @Override
        public void doneSelection() {
            WaitMaster.receiveInput(WAIT_OPERATIONS.SELECTION, sequence.getValue());
            Launcher.resetView(VIEWS.HC);
            // setLeader()
            PartyHelper.loadParty(demoParty);
        // initSelectedHero();
        // newParty();
        // launchHC();
        }

        @Override
        public void cancelSelection() {
        }
    });
    sequence.start();
}
Also used : EntityChoiceView(eidolons.client.cc.gui.neo.choice.EntityChoiceView) OBJ_TYPE(main.content.OBJ_TYPE) ObjType(main.entity.type.ObjType) PROPERTY(main.content.values.properties.PROPERTY) ArrayList(java.util.ArrayList) ChoiceSequence(eidolons.client.cc.gui.neo.choice.ChoiceSequence) VALUE(main.content.VALUE) Unit(eidolons.entity.obj.unit.Unit) SequenceManager(eidolons.client.dc.SequenceManager)

Aggregations

SequenceManager (eidolons.client.dc.SequenceManager)5 ChoiceSequence (eidolons.client.cc.gui.neo.choice.ChoiceSequence)4 ObjType (main.entity.type.ObjType)4 Unit (eidolons.entity.obj.unit.Unit)3 ArrayList (java.util.ArrayList)3 EntityChoiceView (eidolons.client.cc.gui.neo.choice.EntityChoiceView)1 HeroChoiceSequence (eidolons.client.cc.gui.neo.choice.HeroChoiceSequence)1 PositionChoiceView (eidolons.client.cc.gui.neo.choice.PositionChoiceView)1 PrincipleChoiceView (eidolons.client.cc.gui.neo.choice.PrincipleChoiceView)1 ScenarioChoiceView (eidolons.client.cc.gui.neo.choice.ScenarioChoiceView)1 ScenarioModeChoiceView (eidolons.client.cc.gui.neo.choice.ScenarioModeChoiceView)1 OBJECTIVE_TYPE (eidolons.game.battlecraft.logic.meta.scenario.ObjectiveMaster.OBJECTIVE_TYPE)1 File (java.io.File)1 List (java.util.List)1 OBJ_TYPE (main.content.OBJ_TYPE)1 VALUE (main.content.VALUE)1 PROPERTY (main.content.values.properties.PROPERTY)1 Coordinates (main.game.bf.Coordinates)1