Commit 2cd86bfe authored by Peter Patel-Schneider's avatar Peter Patel-Schneider

put yellow border on selectable cards

parent 2f9fb96d
......@@ -287,6 +287,8 @@ public class GuiChoose {
public static List<CardView> manipulateCardList(final CMatchUI gui, final String title, final Iterable<CardView> cards, final Iterable<CardView> manipulable,
final boolean toTop, final boolean toBottom, final boolean toAnywhere) {
System.out.print("MCL "); System.out.println(manipulable);
gui.setSelectables(manipulable);
final Callable<List<CardView>> callable = new Callable<List<CardView>>() {
@Override
public List<CardView> call() throws Exception {
......@@ -299,6 +301,7 @@ public class GuiChoose {
};
final FutureTask<List<CardView>> ft = new FutureTask<List<CardView>>(callable);
FThreads.invokeInEdtAndWait(ft);
gui.clearSelectables();
try {
List<CardView> result = ft.get();
return result;
......
......@@ -273,7 +273,11 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
g2d.setColor(Color.magenta);
final int n2 = Math.max(1, Math.round(2 * cardWidth * CardPanel.SELECTED_BORDER_SIZE));
g2d.fillRoundRect(cardXOffset - n2, (cardYOffset - n2) + offset, cardWidth + (n2 * 2), cardHeight + (n2 * 2), cornerSize + n2, cornerSize + n2);
}
} else if (matchUI.isSelectable(getCard())) { // Yellow outline for selectable cards
g2d.setColor(Color.yellow);
final int n2 = Math.max(1, Math.round(2 * cardWidth * CardPanel.SELECTED_BORDER_SIZE));
g2d.fillRoundRect(cardXOffset - n2, (cardYOffset - n2) + offset, cardWidth + (n2 * 2), cardHeight + (n2 * 2), cornerSize + n2, cornerSize + n2);
}
// Green outline for hover
if (isSelected) {
......
......@@ -157,6 +157,8 @@ public interface IGuiGame {
void restoreOldZones(Map<PlayerView, Object> playersToRestoreZonesFor);
void setHighlighted(PlayerView pv, boolean b);
void setUsedToPay(CardView card, boolean value);
void setSelectables(final List<CardView> cards);
void clearSelectables();
void awaitNextInput();
void cancelAwaitNextInput();
......
......@@ -220,6 +220,17 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
return highlightedCards.contains(card);
}
private final Set<CardView> selectableCards = Sets.newHashSet();
public void setSelectables(final List<CardView> cards) {
selectableCards.addAll(cards);
}
public void clearSelectables() {
selectableCards.clear();
}
public boolean isSelectable(final CardView card) {
return selectableCards.contains(card);
}
/** Concede game, bring up WinLose UI. */
public boolean concede() {
if (gameView.isGameOver()) {
......
......@@ -2,9 +2,12 @@ package forge.match.input;
import java.util.Collection;
import java.util.List;
import java.util.ArrayList;
import forge.game.GameEntity;
import forge.game.card.Card;
import forge.game.card.CardView;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.player.PlayerControllerHuman;
......@@ -31,7 +34,6 @@ public class InputSelectEntitiesFromList<T extends GameEntity> extends InputSele
super(controller, Math.min(min, validChoices0.size()), Math.min(max, validChoices0.size()),sa0);
validChoices = validChoices0;
if (min > validChoices.size()) {
System.out.println(String.format("Trying to choose at least %d things from a list with only %d things!", min, validChoices.size()));
}
final PlayerZoneUpdates zonesToUpdate = new PlayerZoneUpdates();
for (final GameEntity c : validChoices) {
......@@ -44,6 +46,14 @@ 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);
System.out.print("InputSelectEntitiesFromList "); System.out.println(vCards);
}
@Override
......@@ -113,6 +123,7 @@ public class InputSelectEntitiesFromList<T extends GameEntity> extends InputSele
@Override
protected void onStop() {
getController().getGui().hideZones(getController().getPlayer().getView(),zonesShown);
getController().getGui().clearSelectables();
super.onStop();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment