mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
* Workaround to fix problem with deck layout.
This commit is contained in:
parent
769a37958d
commit
5d8ae4d411
5 changed files with 38 additions and 16 deletions
|
@ -54,7 +54,6 @@ import mage.client.deckeditor.SortSetting;
|
|||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.ImageHelper;
|
||||
import mage.client.util.Listener;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
import mage.constants.CardType;
|
||||
|
@ -409,7 +408,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
Image image = Plugins.getInstance().getOriginalImage(card);
|
||||
if (image != null && image instanceof BufferedImage) {
|
||||
// XXX: scaled to fit width
|
||||
bigCard.setCard(card.getId(), EnlargeMode.NORMAL, image, new ArrayList<String>(), false);
|
||||
bigCard.setCard(card.getId(), EnlargeMode.NORMAL, image, new ArrayList<>(), false);
|
||||
} else {
|
||||
drawCardText(card);
|
||||
}
|
||||
|
|
|
@ -675,6 +675,9 @@ public class SessionImpl implements Session {
|
|||
public boolean joinTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill, DeckCardLists deckList, String password) {
|
||||
try {
|
||||
if (isConnected()) {
|
||||
// Workaround to fix Can't join table problem
|
||||
deckList.setCardLayout(null);
|
||||
deckList.setSideboardLayout(null);
|
||||
return server.joinTable(sessionId, roomId, tableId, playerName, playerType, skill, deckList, password);
|
||||
}
|
||||
} catch (InvalidDeckException iex) {
|
||||
|
@ -693,6 +696,9 @@ public class SessionImpl implements Session {
|
|||
public boolean joinTournamentTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill, DeckCardLists deckList, String password) {
|
||||
try {
|
||||
if (isConnected()) {
|
||||
// Workaround to fix Can't join table problem
|
||||
deckList.setCardLayout(null);
|
||||
deckList.setSideboardLayout(null);
|
||||
return server.joinTournamentTable(sessionId, roomId, tableId, playerName, playerType, skill, deckList, password);
|
||||
}
|
||||
} catch (GameException ex) {
|
||||
|
@ -1175,6 +1181,9 @@ public class SessionImpl implements Session {
|
|||
public boolean submitDeck(UUID tableId, DeckCardLists deck) {
|
||||
try {
|
||||
if (isConnected()) {
|
||||
// Workaround to fix Can't join table problem
|
||||
deck.setCardLayout(null);
|
||||
deck.setSideboardLayout(null);
|
||||
return server.submitDeck(sessionId, tableId, deck);
|
||||
}
|
||||
} catch (GameException ex) {
|
||||
|
@ -1191,6 +1200,8 @@ public class SessionImpl implements Session {
|
|||
public boolean updateDeck(UUID tableId, DeckCardLists deck) {
|
||||
try {
|
||||
if (isConnected()) {
|
||||
deck.setCardLayout(null);
|
||||
deck.setSideboardLayout(null);
|
||||
server.updateDeck(sessionId, tableId, deck);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package mage.cards;
|
|||
import mage.ObjectColor;
|
||||
|
||||
public final class CardGraphicInfo {
|
||||
|
||||
private final ObjectColor frameColor;
|
||||
private final FrameStyle frameStyle;
|
||||
private final boolean useVariousArt;
|
||||
|
@ -17,9 +18,15 @@ public final class CardGraphicInfo {
|
|||
this.useVariousArt = useVariousArt;
|
||||
}
|
||||
|
||||
public ObjectColor getFrameColor() { return this.frameColor != null ? this.frameColor.copy() : null; }
|
||||
public ObjectColor getFrameColor() {
|
||||
return this.frameColor != null ? this.frameColor.copy() : null;
|
||||
}
|
||||
|
||||
public FrameStyle getFrameStyle() { return this.frameStyle; }
|
||||
public FrameStyle getFrameStyle() {
|
||||
return this.frameStyle;
|
||||
}
|
||||
|
||||
public boolean getUsesVariousArt() { return this.useVariousArt; }
|
||||
public boolean getUsesVariousArt() {
|
||||
return this.useVariousArt;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,9 @@ import java.util.List;
|
|||
* Created by stravant@gmail.com on 2016-10-03.
|
||||
*/
|
||||
public class DeckCardLayout {
|
||||
private List<List<List<DeckCardInfo>>> cards;
|
||||
private String settings;
|
||||
|
||||
private final List<List<List<DeckCardInfo>>> cards;
|
||||
private final String settings;
|
||||
|
||||
public DeckCardLayout(List<List<List<DeckCardInfo>>> cards, String settings) {
|
||||
this.cards = cards;
|
||||
|
|
|
@ -121,18 +121,22 @@ public class DckDeckImporter extends DeckImporter {
|
|||
//
|
||||
DeckCardLayout layout = new DeckCardLayout(grid, settings);
|
||||
int expectedCount = 0;
|
||||
if (target.equals("MAIN")) {
|
||||
deckList.setCardLayout(layout);
|
||||
expectedCount = deckList.getCards().size();
|
||||
} else if (target.equals("SIDEBOARD")) {
|
||||
deckList.setSideboardLayout(layout);
|
||||
expectedCount = deckList.getSideboard().size();
|
||||
} else {
|
||||
sbMessage.append("Bad target `" + target + "` for layout.\n");
|
||||
switch (target) {
|
||||
case "MAIN":
|
||||
deckList.setCardLayout(layout);
|
||||
expectedCount = deckList.getCards().size();
|
||||
break;
|
||||
case "SIDEBOARD":
|
||||
deckList.setSideboardLayout(layout);
|
||||
expectedCount = deckList.getSideboard().size();
|
||||
break;
|
||||
default:
|
||||
sbMessage.append("Bad target `").append(target).append("` for layout.\n");
|
||||
break;
|
||||
}
|
||||
//
|
||||
if (totalCardCount != expectedCount) {
|
||||
sbMessage.append("Layout mismatch: Expected " + expectedCount + " cards, but got " + totalCardCount + " in layout `" + target + "`\n.");
|
||||
sbMessage.append("Layout mismatch: Expected ").append(expectedCount).append(" cards, but got ").append(totalCardCount).append(" in layout `").append(target).append("`\n.");
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue