restore changes to other zone, don't change tab when clearing cards
parent
8839c10410
commit
73a661c4f2
|
@ -8,7 +8,8 @@ public enum MagicPlayerZone {
|
|||
HAND(MagicPlayerZoneStrings._S1, MagicIcon.HAND_ZONE),
|
||||
LIBRARY(MagicPlayerZoneStrings._S2, MagicIcon.LIBRARY_ZONE),
|
||||
GRAVEYARD(MagicPlayerZoneStrings._S3, MagicIcon.GRAVEYARD_ZONE),
|
||||
EXILE(MagicPlayerZoneStrings._S4, MagicIcon.EXILE_ZONE);
|
||||
EXILE(MagicPlayerZoneStrings._S4, MagicIcon.EXILE_ZONE),
|
||||
CHOICE("", null);
|
||||
|
||||
private final String zoneName;
|
||||
private final MagicIcon zoneIcon;
|
||||
|
|
|
@ -73,9 +73,6 @@ public class BattlefieldPanel extends JPanel {
|
|||
|
||||
public void showCardsToChoose(final MagicCardList cards) {
|
||||
playerZoneViewer.showCardsToChoose(cards);
|
||||
if (cards != MagicCardList.NONE) {
|
||||
playerZoneViewer.setSelectedTab(5);
|
||||
}
|
||||
}
|
||||
|
||||
public void focusViewers(int handGraveyard) {
|
||||
|
|
|
@ -49,9 +49,16 @@ public class PlayerZoneButtonsPanel extends JPanel {
|
|||
MagicPlayerZone.EXILE, playerInfo.exile.size(), true)
|
||||
);
|
||||
|
||||
// hidden zone button that is activated whenever player is
|
||||
// required to choose one or more cards.
|
||||
zoneButtons.put(MagicPlayerZone.CHOICE, getZoneToggleButton(
|
||||
MagicPlayerZone.CHOICE, 0, true)
|
||||
);
|
||||
zoneButtons.get(MagicPlayerZone.CHOICE).setVisible(false);
|
||||
|
||||
setLayout(new MigLayout("insets 0 2 0 0"));
|
||||
for (ZoneToggleButton button : zoneButtons.values()) {
|
||||
add(button);
|
||||
add(button, "hidemode 3");
|
||||
}
|
||||
|
||||
setOpaque(false);
|
||||
|
|
|
@ -29,7 +29,7 @@ public class PlayerZoneViewer extends JPanel implements ChangeListener {
|
|||
|
||||
// translatable strings
|
||||
@StringContext(eg = "as in 'Other' player zone")
|
||||
private static final String _S1 = "Other";
|
||||
private static final String _S1 = "Choose a card";
|
||||
private static final String _S2 = "Other : %s";
|
||||
private static final String _S3 = "%s Hand";
|
||||
private static final String _S4 = "%s Graveyard";
|
||||
|
@ -74,10 +74,10 @@ public class PlayerZoneViewer extends JPanel implements ChangeListener {
|
|||
tabSelector.addTab(tabIcons.get(MagicIcon.GRAVEYARD_ZONE), "");
|
||||
tabSelector.addTab(tabIcons.get(MagicIcon.EXILE_ZONE), "");
|
||||
tabSelector.addTab(tabIcons.get(MagicIcon.EXILE_ZONE), "");
|
||||
tabSelector.addTab(tabIcons.get(MagicIcon.LIBRARY_ZONE), MText.get(_S2, getUserPlayer().getName()));
|
||||
tabSelector.addTab(tabIcons.get(MagicIcon.LIBRARY_ZONE), "");
|
||||
// this is used if the players are switched (ie. using the 'S' key).
|
||||
tabSelector.addTab(tabIcons.get(MagicIcon.LIBRARY_ZONE), "");
|
||||
add(tabSelector, BorderLayout.WEST);
|
||||
// add(tabSelector, BorderLayout.WEST);
|
||||
|
||||
add(imageCardsListViewer, BorderLayout.CENTER);
|
||||
}
|
||||
|
@ -92,9 +92,12 @@ public class PlayerZoneViewer extends JPanel implements ChangeListener {
|
|||
setSelectedTab(selectedTab, false);
|
||||
}
|
||||
|
||||
public void showCardsToChoose(final MagicCardList cards) {
|
||||
public void showCardsToChoose(MagicCardList cards) {
|
||||
cardsToChoose.clear();
|
||||
cardsToChoose.addAll(cards);
|
||||
if (cards != MagicCardList.NONE) {
|
||||
setSelectedTab(5);
|
||||
}
|
||||
}
|
||||
|
||||
public void update() {
|
||||
|
@ -220,7 +223,7 @@ public class PlayerZoneViewer extends JPanel implements ChangeListener {
|
|||
} else if (newPlayerZoneIndex == 4) {
|
||||
controller.notifyPlayerZoneChanged(getAiPlayer(), MagicPlayerZone.EXILE);
|
||||
} else if (newPlayerZoneIndex == 5) {
|
||||
controller.notifyPlayerZoneChanged(getUserPlayer(), MagicPlayerZone.LIBRARY);
|
||||
controller.notifyPlayerZoneChanged(getUserPlayer(), MagicPlayerZone.CHOICE);
|
||||
} else if (newPlayerZoneIndex == 6) {
|
||||
controller.notifyPlayerZoneChanged(getAiPlayer(), MagicPlayerZone.HAND);
|
||||
}
|
||||
|
@ -303,4 +306,10 @@ public class PlayerZoneViewer extends JPanel implements ChangeListener {
|
|||
}
|
||||
}
|
||||
|
||||
public void showChoiceViewerIfActive() {
|
||||
if (!cardsToChoose.isEmpty()) {
|
||||
setSelectedTab(5);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -116,6 +116,7 @@ public class UserActionPanel extends JPanel implements ActionListener {
|
|||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
controller.showChoiceCardPopup();
|
||||
controller.getPlayerZoneViewer().showChoiceViewerIfActive();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue