mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
Add option to select cards from any Zone that can be shown (implemented in desktop GUI only for now)
This commit is contained in:
@@ -101,6 +101,7 @@ import forge.util.gui.SOptionPane;
|
||||
import forge.view.FView;
|
||||
import forge.view.arcane.CardPanel;
|
||||
import forge.view.arcane.FloatingCardArea;
|
||||
import forge.match.input.*;
|
||||
|
||||
/**
|
||||
* Constructs instance of match UI controller, used as a single point of
|
||||
@@ -395,7 +396,8 @@ public final class CMatchUI
|
||||
break;
|
||||
case Hand:
|
||||
updateHand = true;
|
||||
//$FALL-THROUGH$
|
||||
updateZones = true;
|
||||
break;
|
||||
default:
|
||||
updateZones = true;
|
||||
FloatingCardArea.refresh(owner, zone);
|
||||
@@ -424,6 +426,57 @@ public final class CMatchUI
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<PlayerZoneUpdate> tempShowZones(final PlayerView controller, final Iterable<PlayerZoneUpdate> zonesToUpdate) {
|
||||
for (final PlayerZoneUpdate update : zonesToUpdate) {
|
||||
final PlayerView player = update.getPlayer();
|
||||
for (final ZoneType zone : update.getZones()) {
|
||||
switch (zone) {
|
||||
case Battlefield: // always shown
|
||||
break;
|
||||
case Hand: // controller hand always shown
|
||||
if (controller != player) {
|
||||
FloatingCardArea.show(this,player,zone);
|
||||
}
|
||||
break;
|
||||
case Library:
|
||||
case Graveyard:
|
||||
case Exile:
|
||||
case Flashback:
|
||||
case Command:
|
||||
FloatingCardArea.show(this,player,zone);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return zonesToUpdate; //pfps should return only the newly shown zones
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideZones(final PlayerView controller, final Iterable<PlayerZoneUpdate> zonesToUpdate) {
|
||||
for (final PlayerZoneUpdate update : zonesToUpdate) {
|
||||
final PlayerView player = update.getPlayer();
|
||||
for (final ZoneType zone : update.getZones()) {
|
||||
switch (zone) {
|
||||
case Battlefield: // always shown
|
||||
break;
|
||||
case Hand: // the controller's hand should never be temporarily shown, but ...
|
||||
case Library:
|
||||
case Graveyard:
|
||||
case Exile:
|
||||
case Flashback:
|
||||
case Command:
|
||||
FloatingCardArea.hide(this,player,zone);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Player's mana pool changes
|
||||
@Override
|
||||
public void updateManaPool(final Iterable<PlayerView> manaPoolUpdate) {
|
||||
@@ -465,6 +518,7 @@ public final class CMatchUI
|
||||
}
|
||||
break;
|
||||
default:
|
||||
FloatingCardArea.refresh(c.getController(),zone); // in case the card is visible in the zone
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,10 @@ public class FloatingCardArea extends CardArea {
|
||||
final FloatingCardArea cardArea = _init(matchUI, player, zone);
|
||||
cardArea.showWindow();
|
||||
}
|
||||
public static void hide(final CMatchUI matchUI, final PlayerView player, final ZoneType zone) {
|
||||
final FloatingCardArea cardArea = _init(matchUI, player, zone);
|
||||
cardArea.hideWindow();
|
||||
}
|
||||
private static FloatingCardArea _init(final CMatchUI matchUI, final PlayerView player, final ZoneType zone) {
|
||||
final int key = getKey(player, zone);
|
||||
FloatingCardArea cardArea = floatingAreas.get(key);
|
||||
@@ -205,6 +209,11 @@ public class FloatingCardArea extends CardArea {
|
||||
window.setFocusableWindowState(false); // should probably do this earlier
|
||||
window.setVisible(true);
|
||||
}
|
||||
private void hideWindow() {
|
||||
onShow();
|
||||
window.setFocusableWindowState(false); // should probably do this earlier
|
||||
window.setVisible(false);
|
||||
}
|
||||
private void showOrHideWindow() {
|
||||
onShow();
|
||||
window.setFocusableWindowState(false); // should probably do this earlier
|
||||
|
||||
Reference in New Issue
Block a user