Show card when swiping or long-pressing in mobile prompt message area

This commit is contained in:
pfps
2017-01-25 00:29:15 +00:00
parent 2bedb54128
commit 403ecda572
2 changed files with 29 additions and 1 deletions

View File

@@ -158,7 +158,7 @@ public class MatchController extends AbstractGuiGame {
@Override
public void showPromptMessage(final PlayerView player, final String message, final CardView card) {
view.getPrompt(player).setMessage(message);
view.getPrompt(player).setMessage(message, card);
}
@Override

View File

@@ -10,6 +10,8 @@ import forge.assets.FSkinColor;
import forge.assets.FSkinFont;
import forge.assets.FSkinColor.Colors;
import forge.assets.TextRenderer;
import forge.card.CardZoom;
import forge.game.card.CardView;
import forge.menu.FMagnifyView;
import forge.toolbox.FButton;
import forge.toolbox.FButton.Corner;
@@ -29,6 +31,11 @@ public class VPrompt extends FContainer {
private final FButton btnOk, btnCancel;
private final MessageLabel lblMessage;
private String message;
private CardView card = null ;
public void setCardView(final CardView card) {
this.card = card ;
}
public VPrompt(String okText, String cancelText, FEventHandler okCommand, FEventHandler cancelCommand) {
lblMessage = add(new MessageLabel());
@@ -57,6 +64,11 @@ public class VPrompt extends FContainer {
}
public void setMessage(String message0) {
message = message0;
card = null ;
}
public void setMessage(String message0, CardView card0) {
message = message0;
card = card0;
}
/** Flashes animation on input panel if play is currently waiting on input. */
@@ -90,6 +102,22 @@ public class VPrompt extends FContainer {
return true;
}
@Override
public boolean fling(float x, float y) {
if ( card != null ) {
CardZoom.show(card);
}
return true;
}
@Override
public boolean longPress(float x, float y) {
if ( card != null ) {
CardZoom.show(card);
}
return true;
}
@Override
public void draw(Graphics g) {
if (!StringUtils.isEmpty(message)) {