Merge pull request #3209 from spjspj/master

spjspj - Removed View Limited Deck option
This commit is contained in:
spjspj 2017-04-22 19:37:26 +10:00 committed by GitHub
commit ecaba8dab3
10 changed files with 4 additions and 74 deletions

View file

@ -1034,8 +1034,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
if (window instanceof DeckEditorPane) {
DeckEditorPane deckEditorPane = (DeckEditorPane) window;
if (deckEditorPane.getDeckEditorMode() == DeckEditorMode.LIMITED_BUILDING
|| deckEditorPane.getDeckEditorMode() == DeckEditorMode.SIDEBOARDING
|| deckEditorPane.getDeckEditorMode() == DeckEditorMode.VIEW_LIMITED_DECK) {
|| deckEditorPane.getDeckEditorMode() == DeckEditorMode.SIDEBOARDING) {
deckEditorPane.removeFrame();
}
}
@ -1045,7 +1044,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
public void showDeckEditor(DeckEditorMode mode, Deck deck, UUID tableId, int time) {
String name;
if (mode == DeckEditorMode.SIDEBOARDING || mode == DeckEditorMode.LIMITED_BUILDING || mode == DeckEditorMode.VIEW_LIMITED_DECK) {
if (mode == DeckEditorMode.SIDEBOARDING || mode == DeckEditorMode.LIMITED_BUILDING) {
name = "Deck Editor - " + tableId.toString();
} else {
if (deck != null) {

View file

@ -91,8 +91,7 @@ public final class Constants {
FREE_BUILDING,
LIMITED_BUILDING,
SIDEBOARDING,
VIEW_LIMITED_DECK
SIDEBOARDING
}
public enum SortBy {

View file

@ -80,8 +80,6 @@ public class DeckEditorPane extends MagePane {
public void show(DeckEditorMode mode, Deck deck, String name, UUID tableId, int time) {
if (mode == DeckEditorMode.SIDEBOARDING || mode == DeckEditorMode.LIMITED_BUILDING) {
this.setTitle("Deck Editor - " + tableId.toString());
} else if (mode == DeckEditorMode.VIEW_LIMITED_DECK) {
this.setTitle("Deck Editor - Current Deck");
} else if (deck != null) {
this.setTitle("Deck Editor - " + deck.getName());
} else {

View file

@ -233,24 +233,6 @@ public class DeckEditorPanel extends javax.swing.JPanel {
this.deckArea.showSideboard(true);
this.txtTimeRemaining.setVisible(false);
break;
case VIEW_LIMITED_DECK:
this.btnExit.setVisible(true);
this.btnAddLand.setVisible(false);
this.btnGenDeck.setVisible(false);
this.btnImport.setVisible(false);
this.btnLoad.setVisible(false);
this.btnNew.setVisible(false);
this.btnSave.setVisible(false);
this.btnSubmit.setVisible(false);
this.btnSubmitTimer.setVisible(false);
this.cardSelector.loadCards(this.bigCard);
this.cardSelector.setVisible(false);
this.deckArea.setOrientation(/*limitedBuildingOrientation = */true);
this.deckArea.showSideboard(true);
this.lblDeckName.setVisible(false);
this.txtDeckName.setVisible(false);
this.txtTimeRemaining.setVisible(false);
break;
}
init();
this.deckArea.setDeckEditorMode(mode);

View file

@ -472,17 +472,6 @@ public class PlayAreaPanel extends javax.swing.JPanel {
}
});
popupMenu.addSeparator();
menuItem = new JMenuItem("<html>View current deck");
menuItem.setMnemonic(KeyEvent.VK_V);
popupMenu.add(menuItem);
// View limited deck
menuItem.addActionListener(e -> {
SessionHandler.sendPlayerAction(PlayerAction.VIEW_LIMITED_DECK, gameId, null);
});
}
private void addPopupMenuWatcher() {

View file

@ -324,13 +324,6 @@ public class CallbackClientImpl implements CallbackClient {
}
break;
}
case VIEW_LIMITED_DECK: {
TableClientMessage message = (TableClientMessage) callback.getData();
DeckView deckView = message.getDeck();
Deck deck = DeckUtil.construct(deckView);
viewLimitedDeck(deck, message.getTableId(), message.getTime());
break;
}
case CONSTRUCT: {
TableClientMessage message = (TableClientMessage) callback.getData();
DeckView deckView = message.getDeck();
@ -519,10 +512,6 @@ public class CallbackClientImpl implements CallbackClient {
frame.showDeckEditor(DeckEditorMode.LIMITED_BUILDING, deck, tableId, time);
}
protected void viewLimitedDeck(Deck deck, UUID tableId, int time) {
frame.showDeckEditor(DeckEditorMode.VIEW_LIMITED_DECK, deck, tableId, time);
}
private void handleException(Exception ex) {
logger.fatal("Client error\n", ex);
frame.showError("Error: " + ex.getMessage());

View file

@ -13,7 +13,6 @@ public enum ClientCallbackMethod {
START_DRAFT("startDraft"),
START_TOURNAMENT("startTournament"),
SIDEBOARD("sideboard"),
VIEW_LIMITED_DECK("viewLimitedDeck"),
CONSTRUCT("construct"),
SHOW_USERMESSAGE("showUserMessage"),
WATCHGAME("watchGame"),

View file

@ -269,10 +269,6 @@ public class User {
sideboarding.put(tableId, deck);
}
public void ccViewLimitedDeck(final Deck deck, final UUID tableId, final int time, boolean limited) {
fireCallback(new ClientCallback(ClientCallbackMethod.VIEW_LIMITED_DECK, tableId, new TableClientMessage(deck, tableId, time, limited)));
}
public void ccConstruct(final Deck deck, final UUID tableId, final int time) {
fireCallback(new ClientCallback(ClientCallbackMethod.CONSTRUCT, tableId, new TableClientMessage(deck, tableId, time)));
}

View file

@ -546,9 +546,6 @@ public class GameController implements GameCallback {
requestPermissionToSeeHandCards(userId, (UUID) data);
}
break;
case VIEW_LIMITED_DECK:
viewLimitedDeck(getPlayerId(userId), userId);
break;
default:
game.sendPlayerAction(playerAction, getPlayerId(userId), data);
}
@ -605,23 +602,6 @@ public class GameController implements GameCallback {
}
}
private void viewLimitedDeck(UUID userIdRequester, UUID origId) {
Player viewLimitedDeckPlayer = game.getPlayer(userIdRequester);
if (viewLimitedDeckPlayer != null) {
if (viewLimitedDeckPlayer.isHuman()) {
System.out.println("Origid: " + origId + " req:" + userIdRequester);
for (MatchPlayer p : TableManager.instance.getTable(tableId).getMatch().getPlayers()) {
if (p.getPlayer().getId() == userIdRequester) {
Optional<User> u = UserManager.instance.getUser(origId);
if (u != null && u.isPresent() && p.getDeck() != null) {
u.get().ccViewLimitedDeck(p.getDeck(), tableId, requestsOpen, true);
}
}
}
}
}
}
public void cheat(UUID userId, UUID playerId, DeckCardLists deckList) {
try {
Deck deck = Deck.load(deckList, false, false);

View file

@ -83,6 +83,5 @@ public enum PlayerAction {
CLIENT_RECONNECT,
CLIENT_REPLAY_ACTION,
HOLD_PRIORITY,
UNHOLD_PRIORITY,
VIEW_LIMITED_DECK
UNHOLD_PRIORITY
}