Search in sources :

Example 1 with ScenarioChoiceView

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

Aggregations

ChoiceSequence (eidolons.client.cc.gui.neo.choice.ChoiceSequence)1 ScenarioChoiceView (eidolons.client.cc.gui.neo.choice.ScenarioChoiceView)1 ScenarioModeChoiceView (eidolons.client.cc.gui.neo.choice.ScenarioModeChoiceView)1 SequenceManager (eidolons.client.dc.SequenceManager)1 Unit (eidolons.entity.obj.unit.Unit)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ObjType (main.entity.type.ObjType)1