Search in sources :

Example 1 with ChoiceSequence

use of eidolons.client.cc.gui.neo.choice.ChoiceSequence 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 ChoiceSequence

use of eidolons.client.cc.gui.neo.choice.ChoiceSequence 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 ChoiceSequence

use of eidolons.client.cc.gui.neo.choice.ChoiceSequence 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 ChoiceSequence

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

the class SkirmishMaster method newCustomSkirmish.

public static void newCustomSkirmish() {
    ChoiceSequence cs = new ChoiceSequence();
    new EnumChoiceView<>(cs, null, SKIRMISH_TYPE.class);
    // battlefield
    // max level
    // nemesis groups
    // objective
    // filtering based on chosen template/type/bf
    String info = "";
    String data = "";
    String path = PathFinder.getDungeonLevelFolder();
    final Map<String, File> map = new HashMap<>();
    for (File file : FileManager.getFilesFromDirectory(path, false)) {
        data += file.getName() + ";";
        map.put(file.getName(), file);
    }
    ListChoiceView battlefieldChoiceView = new ListChoiceView(cs, info, data) {

        public Component getListCellRendererComponent(JList<? extends String> list, String value, int index, boolean isSelected, boolean cellHasFocus) {
            return getBattlefieldImageAndText(map.get(value), value, isSelected);
        }
    };
    // filter!
    final ArrayList<OBJECTIVE_TYPE> allowed = new ArrayList<>();
    EnumChoiceView<OBJECTIVE_TYPE> objectiveChoiceView = new EnumChoiceView<OBJECTIVE_TYPE>(cs, null, OBJECTIVE_TYPE.class) {

        @Override
        public boolean isOkBlocked() {
            return allowed.contains(getSelectedItem());
        }
    };
    cs.addView(battlefieldChoiceView);
    // or mission?
    cs.addView(objectiveChoiceView);
    // mode choice
    // dungeon choice? mission type choice?
    cs.setManager(getChoiceMaster(map, battlefieldChoiceView, objectiveChoiceView));
    cs.start();
}
Also used : OBJECTIVE_TYPE(eidolons.game.battlecraft.logic.meta.scenario.ObjectiveMaster.OBJECTIVE_TYPE) EnumChoiceView(eidolons.client.cc.gui.neo.choice.EnumChoiceView) HashMap(java.util.HashMap) ListChoiceView(eidolons.client.cc.gui.neo.choice.ListChoiceView) ArrayList(java.util.ArrayList) ChoiceSequence(eidolons.client.cc.gui.neo.choice.ChoiceSequence) File(java.io.File)

Example 5 with ChoiceSequence

use of eidolons.client.cc.gui.neo.choice.ChoiceSequence 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

ChoiceSequence (eidolons.client.cc.gui.neo.choice.ChoiceSequence)6 SequenceManager (eidolons.client.dc.SequenceManager)4 Unit (eidolons.entity.obj.unit.Unit)4 ArrayList (java.util.ArrayList)4 ObjType (main.entity.type.ObjType)3 EntityChoiceView (eidolons.client.cc.gui.neo.choice.EntityChoiceView)1 EnumChoiceView (eidolons.client.cc.gui.neo.choice.EnumChoiceView)1 HeroChoiceSequence (eidolons.client.cc.gui.neo.choice.HeroChoiceSequence)1 ListChoiceView (eidolons.client.cc.gui.neo.choice.ListChoiceView)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 TavernView (eidolons.client.cc.gui.neo.choice.TavernView)1 HC_SequenceMaster (eidolons.client.dc.HC_SequenceMaster)1 OBJECTIVE_TYPE (eidolons.game.battlecraft.logic.meta.scenario.ObjectiveMaster.OBJECTIVE_TYPE)1 File (java.io.File)1 HashMap (java.util.HashMap)1 List (java.util.List)1 OBJ_TYPE (main.content.OBJ_TYPE)1