use of eidolons.libgdx.bf.TargetRunnable in project Eidolons by IDemiurge.
the class DC_GameManager method select.
@Override
public Integer select(Set<Obj> selectingSet, Ref ref) {
Pair<Set<Obj>, TargetRunnable> p = new ImmutablePair<>(selectingSet, (t) -> {
if (ref.getActive() instanceof DC_ActiveObj) {
// TODO CLICK ON ANY OTHER OBJ MUST RESULT IN SELECTION STOP!
// ((DC_ActiveObj) ref.getActive()).activateOn(t);
// WaitMaster.receiveInput(WAIT_OPERATIONS.SELECT_BF_OBJ, t.getId());
t.invokeClicked();
}
});
GuiEventManager.trigger(SELECT_MULTI_OBJECTS, p);
for (Obj obj : new ArrayList<>(selectingSet)) {
if (obj instanceof DC_Obj) {
DC_Obj unit = (DC_Obj) obj;
if (getActiveObj() != null) {
if (getActiveObj().getZ() != unit.getZ()) {
selectingSet.remove(unit);
}
}
}
}
this.selectingSet = selectingSet;
if (selectingSet.isEmpty()) {
// getGame().getToolTipMaster().addTooltip(SCREEN_POSITION.ACTIVE_UNIT_BOTTOM,
// "No targets available!");
DC_SoundMaster.playStandardSound(STD_SOUNDS.ACTION_CANCELLED);
return null;
}
setSelecting(true);
for (Obj obj : selectingSet) {
DrawMasterStatic.getObjImageCache().remove(obj);
}
Integer id = selectAwait();
if (id == null) {
if (ref.getTarget() != null) {
return ref.getTarget();
}
}
return id;
}
use of eidolons.libgdx.bf.TargetRunnable in project Eidolons by IDemiurge.
the class PartyManager method chooseMainHero.
protected String chooseMainHero() {
if (party.getMembers().size() == 1) {
return party.getLeader().getName();
}
// return ListChooser.chooseObj(party.getMembers(), SELECTION_MODE.SINGLE);
if (!WaitMaster.isComplete(WAIT_OPERATIONS.GUI_READY)) {
Object result = WaitMaster.waitForInput(WAIT_OPERATIONS.GUI_READY, 4000);
if (result == null)
return ListChooser.chooseObj(party.getMembers(), SELECTION_MODE.SINGLE);
}
Set<Obj> selectingSet = new HashSet<>(party.getMembers());
Pair<Set<Obj>, TargetRunnable> p = new ImmutablePair<>(selectingSet, (t) -> {
WaitMaster.receiveInput(WAIT_OPERATIONS.SELECT_BF_OBJ, t);
});
party.getMembers().forEach(hero -> {
GuiEventManager.trigger(ADD_FLOATING_TEXT, FloatingTextMaster.getInstance().getFloatingText(hero, TEXT_CASES.BATTLE_COMMENT, hero.getName()));
});
GuiEventManager.trigger(SELECT_MULTI_OBJECTS, p);
Unit unit = (Unit) WaitMaster.waitForInput(WAIT_OPERATIONS.SELECT_BF_OBJ, 15000);
if (unit == null) {
// List<JButton> pics = party.getMembers().stream().map(hero ->
// new JButton(ImageManager.getIcon(hero.getImagePath().replace(" 128", "")))).collect(Collectors.toList());
// int i = DialogMaster.optionChoice(pics.toArray(), "Choose a hero to control...");
// if (i==-1)
// i=0;
String hero = // party.getMembers().get(i).getName();
ListChooser.chooseObj(party.getMembers(), SELECTION_MODE.SINGLE);
return hero;
}
return unit.getName();
}
Aggregations