mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Highlight sa targets in Desktop GUI
This commit is contained in:
@@ -33,8 +33,16 @@ public class InputSelectEntitiesFromList<T extends GameEntity> extends InputSele
|
||||
public InputSelectEntitiesFromList(final PlayerControllerHuman controller, final int min, final int max, final FCollectionView<T> validChoices0, final SpellAbility sa0) {
|
||||
super(controller, Math.min(min, validChoices0.size()), Math.min(max, validChoices0.size()),sa0);
|
||||
validChoices = validChoices0;
|
||||
if (min > validChoices.size()) {
|
||||
if (min > validChoices.size()) { // pfps does this really do anything useful??
|
||||
System.out.println(String.format("Trying to choose at least %d things from a list with only %d things!", min, validChoices.size()));
|
||||
}
|
||||
ArrayList<CardView> vCards = new ArrayList<CardView>();
|
||||
for ( T c : validChoices0 ) {
|
||||
if ( c instanceof Card ) {
|
||||
vCards.add(((Card)c).getView()) ;
|
||||
}
|
||||
}
|
||||
controller.getGui().setSelectables(vCards);
|
||||
final PlayerZoneUpdates zonesToUpdate = new PlayerZoneUpdates();
|
||||
for (final GameEntity c : validChoices) {
|
||||
final Zone cz = (c instanceof Card) ? ((Card) c).getZone() : null ;
|
||||
@@ -46,13 +54,6 @@ public class InputSelectEntitiesFromList<T extends GameEntity> extends InputSele
|
||||
zonesShown = controller.getGui().tempShowZones(controller.getPlayer().getView(),zonesToUpdate);
|
||||
}
|
||||
});
|
||||
ArrayList<CardView> vCards = new ArrayList<CardView>();
|
||||
for ( T c : validChoices0 ) {
|
||||
if ( c instanceof Card ) {
|
||||
vCards.add(((Card)c).getView()) ;
|
||||
}
|
||||
}
|
||||
controller.getGui().setSelectables(vCards);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,6 +22,9 @@ import forge.properties.ForgeConstants;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.util.ITriggerEvent;
|
||||
import forge.util.TextUtil;
|
||||
import forge.player.PlayerZoneUpdate;
|
||||
import forge.player.PlayerZoneUpdates;
|
||||
import forge.FThreads;
|
||||
|
||||
public final class InputSelectTargets extends InputSyncronizedBase {
|
||||
private final List<Card> choices;
|
||||
@@ -44,6 +47,16 @@ public final class InputSelectTargets extends InputSyncronizedBase {
|
||||
this.tgt = sa.getTargetRestrictions();
|
||||
this.sa = sa;
|
||||
this.mandatory = mandatory;
|
||||
controller.getGui().setSelectables(CardView.getCollection(choices));
|
||||
final PlayerZoneUpdates zonesToUpdate = new PlayerZoneUpdates();
|
||||
for (final Card c : choices) {
|
||||
zonesToUpdate.add(new PlayerZoneUpdate(c.getZone().getPlayer().getView(),c.getZone().getZoneType()));
|
||||
}
|
||||
FThreads.invokeInEdtNowOrLater(new Runnable() {
|
||||
@Override public void run() {
|
||||
controller.getGui().updateZones(zonesToUpdate);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -297,4 +310,12 @@ public final class InputSelectTargets extends InputSyncronizedBase {
|
||||
private boolean hasAllTargets() {
|
||||
return tgt.isMaxTargetsChosen(sa.getHostCard(), sa) || ( tgt.getStillToDivide() == 0 && tgt.isDividedAsYouChoose());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
getController().getGui().clearSelectables();
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user