Search in sources :

Example 1 with ListChoiceView

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

Aggregations

ChoiceSequence (eidolons.client.cc.gui.neo.choice.ChoiceSequence)1 EnumChoiceView (eidolons.client.cc.gui.neo.choice.EnumChoiceView)1 ListChoiceView (eidolons.client.cc.gui.neo.choice.ListChoiceView)1 OBJECTIVE_TYPE (eidolons.game.battlecraft.logic.meta.scenario.ObjectiveMaster.OBJECTIVE_TYPE)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1