mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Support selecting cards
This commit is contained in:
@@ -109,7 +109,7 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
|
|
||||||
for (final SpellAbility ab : abilities) {
|
for (final SpellAbility ab : abilities) {
|
||||||
if (ab.canPlay()) {
|
if (ab.canPlay()) {
|
||||||
FControl.getView().getPrompt().getInputProxy().selectAbility(ab);
|
FControl.getInputProxy().selectAbility(ab);
|
||||||
return ab;
|
return ab;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import forge.screens.match.events.IUiEventVisitor;
|
|||||||
import forge.screens.match.events.UiEvent;
|
import forge.screens.match.events.UiEvent;
|
||||||
import forge.screens.match.events.UiEventAttackerDeclared;
|
import forge.screens.match.events.UiEventAttackerDeclared;
|
||||||
import forge.screens.match.events.UiEventBlockerAssigned;
|
import forge.screens.match.events.UiEventBlockerAssigned;
|
||||||
|
import forge.screens.match.input.InputProxy;
|
||||||
import forge.screens.match.input.InputQueue;
|
import forge.screens.match.input.InputQueue;
|
||||||
import forge.screens.match.views.VAssignDamage;
|
import forge.screens.match.views.VAssignDamage;
|
||||||
import forge.screens.match.views.VPhaseIndicator.PhaseLabel;
|
import forge.screens.match.views.VPhaseIndicator.PhaseLabel;
|
||||||
@@ -43,6 +44,7 @@ public class FControl {
|
|||||||
private static Game game;
|
private static Game game;
|
||||||
private static MatchScreen view;
|
private static MatchScreen view;
|
||||||
private static InputQueue inputQueue;
|
private static InputQueue inputQueue;
|
||||||
|
private static InputProxy inputProxy;
|
||||||
private static List<Player> sortedPlayers;
|
private static List<Player> sortedPlayers;
|
||||||
private static final EventBus uiEvents;
|
private static final EventBus uiEvents;
|
||||||
private static boolean gameHasHumanPlayer;
|
private static boolean gameHasHumanPlayer;
|
||||||
@@ -69,6 +71,7 @@ public class FControl {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
inputQueue = new InputQueue();
|
inputQueue = new InputQueue();
|
||||||
|
inputProxy = new InputProxy();
|
||||||
|
|
||||||
//game.subscribeToEvents(Singletons.getControl().getSoundSystem());
|
//game.subscribeToEvents(Singletons.getControl().getSoundSystem());
|
||||||
|
|
||||||
@@ -77,7 +80,7 @@ public class FControl {
|
|||||||
initMatch(game.getRegisteredPlayers(), humanLobbyPlayer);
|
initMatch(game.getRegisteredPlayers(), humanLobbyPlayer);
|
||||||
|
|
||||||
FModel.getPreferences().actuateMatchPreferences();
|
FModel.getPreferences().actuateMatchPreferences();
|
||||||
view.getPrompt().getInputProxy().setGame(game);
|
inputProxy.setGame(game);
|
||||||
|
|
||||||
// Listen to DuelOutcome event to show ViewWinLose
|
// Listen to DuelOutcome event to show ViewWinLose
|
||||||
game.subscribeToEvents(fcVisitor);
|
game.subscribeToEvents(fcVisitor);
|
||||||
@@ -117,6 +120,10 @@ public class FControl {
|
|||||||
return inputQueue;
|
return inputQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static InputProxy getInputProxy() {
|
||||||
|
return inputProxy;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean stopAtPhase(final Player turn, final PhaseType phase) {
|
public static boolean stopAtPhase(final Player turn, final PhaseType phase) {
|
||||||
PhaseLabel label = getPlayerPanel(turn).getPhaseIndicator().getLabel(phase);
|
PhaseLabel label = getPlayerPanel(turn).getPhaseIndicator().getLabel(phase);
|
||||||
return label == null || label.getStopAtPhase();
|
return label == null || label.getStopAtPhase();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package forge.screens.match.views;
|
package forge.screens.match.views;
|
||||||
|
|
||||||
import forge.game.card.Card;
|
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.toolbox.FCardPanel;
|
import forge.toolbox.FCardPanel;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import forge.assets.FSkinColor;
|
|||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.assets.FSkinColor.Colors;
|
import forge.assets.FSkinColor.Colors;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.screens.match.input.InputProxy;
|
import forge.screens.match.FControl;
|
||||||
import forge.toolbox.FButton;
|
import forge.toolbox.FButton;
|
||||||
import forge.toolbox.FContainer;
|
import forge.toolbox.FContainer;
|
||||||
import forge.utils.Utils;
|
import forge.utils.Utils;
|
||||||
@@ -23,20 +23,19 @@ public class VPrompt extends FContainer {
|
|||||||
private static final FSkinFont font = FSkinFont.get(11);
|
private static final FSkinFont font = FSkinFont.get(11);
|
||||||
|
|
||||||
private final FButton btnOk, btnCancel;
|
private final FButton btnOk, btnCancel;
|
||||||
private final InputProxy inputProxy = new InputProxy();
|
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
public VPrompt() {
|
public VPrompt() {
|
||||||
btnOk = add(new FButton("Yes", new Runnable() {
|
btnOk = add(new FButton("Yes", new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
inputProxy.selectButtonOK();
|
FControl.getInputProxy().selectButtonOK();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
btnCancel = add(new FButton("No", new Runnable() {
|
btnCancel = add(new FButton("No", new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
inputProxy.selectButtonCancel();
|
FControl.getInputProxy().selectButtonCancel();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
btnOk.setSize(BTN_WIDTH, HEIGHT);
|
btnOk.setSize(BTN_WIDTH, HEIGHT);
|
||||||
@@ -58,10 +57,6 @@ public class VPrompt extends FContainer {
|
|||||||
message = message0;
|
message = message0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputProxy getInputProxy() {
|
|
||||||
return inputProxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Flashes animation on input panel if play is currently waiting on input. */
|
/** Flashes animation on input panel if play is currently waiting on input. */
|
||||||
public void remind() {
|
public void remind() {
|
||||||
//SDisplayUtil.remind(view);
|
//SDisplayUtil.remind(view);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import forge.FThreads;
|
|||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
|
import forge.screens.match.FControl;
|
||||||
import forge.toolbox.FCardPanel;
|
import forge.toolbox.FCardPanel;
|
||||||
import forge.toolbox.FScrollPane;
|
import forge.toolbox.FScrollPane;
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ public class VZoneDisplay extends FScrollPane {
|
|||||||
clear();
|
clear();
|
||||||
cardPanels.clear();
|
cardPanels.clear();
|
||||||
for (Card card : player.getZone(zoneType).getCards()) {
|
for (Card card : player.getZone(zoneType).getCards()) {
|
||||||
cardPanels.add(add(new FCardPanel(card)));
|
cardPanels.add(add(new ZoneCardPanel(card)));
|
||||||
}
|
}
|
||||||
revalidate();
|
revalidate();
|
||||||
}
|
}
|
||||||
@@ -64,4 +65,16 @@ public class VZoneDisplay extends FScrollPane {
|
|||||||
x += cardWidth;
|
x += cardWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ZoneCardPanel extends FCardPanel {
|
||||||
|
private ZoneCardPanel(Card card0) {
|
||||||
|
super(card0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean tap(float x, float y, int count) {
|
||||||
|
FControl.getInputProxy().selectCard(getCard());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user