mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Merge remote-tracking branch 'upstream/master' into collector-number-in-card-list-and-card-db-refactoring
This commit is contained in:
@@ -2,7 +2,6 @@ package forge.itemmanager.filters;
|
||||
|
||||
import forge.deck.DeckProxy;
|
||||
import forge.game.GameFormat;
|
||||
import forge.item.PaperCard;
|
||||
import forge.itemmanager.ItemManager;
|
||||
import forge.model.FModel;
|
||||
|
||||
|
||||
@@ -481,7 +481,6 @@ public class DialogChooseSets {
|
||||
|
||||
private int getMainDialogWidth() {
|
||||
int winWidth = Singletons.getView().getFrame().getSize().width;
|
||||
System.out.println("Win Width " + winWidth);
|
||||
int[] sizeBoundaries = new int[] {800, 1024, 1280, 2048};
|
||||
return calculateRelativePanelDimension(winWidth, 90, sizeBoundaries);
|
||||
}
|
||||
@@ -489,7 +488,6 @@ public class DialogChooseSets {
|
||||
// So far, not yet used, but left here just in case
|
||||
private int getMainDialogHeight() {
|
||||
int winHeight = Singletons.getView().getFrame().getSize().height;
|
||||
System.out.println("Win Height " + winHeight);
|
||||
int[] sizeBoundaries = new int[] {600, 720, 780, 1024};
|
||||
return calculateRelativePanelDimension(winHeight, 40, sizeBoundaries);
|
||||
}
|
||||
|
||||
@@ -485,6 +485,7 @@ public final class CMatchUI
|
||||
case Exile:
|
||||
case Flashback:
|
||||
case Command:
|
||||
case Ante:
|
||||
case Sideboard:
|
||||
if (FloatingZone.show(this,player,zone)) {
|
||||
updatedPlayerZones.add(update);
|
||||
@@ -513,6 +514,8 @@ public final class CMatchUI
|
||||
case Exile:
|
||||
case Flashback:
|
||||
case Command:
|
||||
case Ante:
|
||||
case Sideboard:
|
||||
FloatingZone.hide(this,player,zone);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -69,6 +69,8 @@ public class CField implements ICDoc {
|
||||
final ZoneAction graveAction = new ZoneAction(matchUI, player, ZoneType.Graveyard);
|
||||
final ZoneAction flashBackAction = new ZoneAction(matchUI, player, ZoneType.Flashback);
|
||||
final ZoneAction commandAction = new ZoneAction(matchUI, player, ZoneType.Command);
|
||||
final ZoneAction anteAction = new ZoneAction(matchUI, player, ZoneType.Ante);
|
||||
final ZoneAction sideboardAction = new ZoneAction(matchUI, player, ZoneType.Sideboard);
|
||||
|
||||
final Function<Byte, Boolean> manaAction = new Function<Byte, Boolean>() {
|
||||
@Override public final Boolean apply(final Byte colorCode) {
|
||||
@@ -85,7 +87,8 @@ public class CField implements ICDoc {
|
||||
}
|
||||
};
|
||||
|
||||
view.getDetailsPanel().setupMouseActions(handAction, libraryAction, exileAction, graveAction, flashBackAction, commandAction, manaAction);
|
||||
view.getDetailsPanel().setupMouseActions(handAction, libraryAction, exileAction, graveAction, flashBackAction,
|
||||
commandAction, anteAction, sideboardAction, manaAction);
|
||||
}
|
||||
|
||||
public final CMatchUI getMatchUI() {
|
||||
|
||||
@@ -39,6 +39,8 @@ public class PlayerDetailsPanel extends JPanel {
|
||||
private final DetailLabel lblExile = new DetailLabel(FSkinProp.IMG_ZONE_EXILE, Localizer.getInstance().getMessage("lblExileNCards", "%s"));
|
||||
private final DetailLabel lblFlashback = new DetailLabel(FSkinProp.IMG_ZONE_FLASHBACK, Localizer.getInstance().getMessage("lblFlashbackNCards", "%s"));
|
||||
private final DetailLabel lblCommand = new DetailLabel(FSkinProp.IMG_PLANESWALKER, Localizer.getInstance().getMessage("lblCommandZoneNCards", "%s"));
|
||||
private final DetailLabel lblAnte = new DetailLabel(FSkinProp.IMG_ZONE_ANTE, Localizer.getInstance().getMessage("lblAnteZoneNCards", "%s"));
|
||||
private final DetailLabel lblSideboard = new DetailLabel(FSkinProp.IMG_ZONE_SIDEBOARD, Localizer.getInstance().getMessage("lblSideboardNCards", "%s"));
|
||||
private final List<Pair<DetailLabel, Byte>> manaLabels = new ArrayList<>();
|
||||
|
||||
public PlayerDetailsPanel(final PlayerView player0) {
|
||||
@@ -67,6 +69,7 @@ public class PlayerDetailsPanel extends JPanel {
|
||||
final SkinnedPanel row4 = new SkinnedPanel(new MigLayout("insets 0, gap 0"));
|
||||
final SkinnedPanel row5 = new SkinnedPanel(new MigLayout("insets 0, gap 0"));
|
||||
final SkinnedPanel row6 = new SkinnedPanel(new MigLayout("insets 0, gap 0"));
|
||||
final SkinnedPanel row7 = new SkinnedPanel(new MigLayout("insets 0, gap 0"));
|
||||
|
||||
row1.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
row2.setOpaque(false);
|
||||
@@ -74,6 +77,7 @@ public class PlayerDetailsPanel extends JPanel {
|
||||
row4.setOpaque(false);
|
||||
row5.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
row6.setOpaque(false);
|
||||
row7.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
|
||||
// Hand, library, graveyard, exile, flashback, command
|
||||
final String constraintsCell = "w 50%-4px!, h 100%!, gapleft 2px, gapright 2px";
|
||||
@@ -87,22 +91,26 @@ public class PlayerDetailsPanel extends JPanel {
|
||||
row3.add(lblFlashback, constraintsCell);
|
||||
row3.add(lblCommand, constraintsCell);
|
||||
|
||||
row4.add(manaLabels.get(0).getLeft(), constraintsCell);
|
||||
row4.add(manaLabels.get(1).getLeft(), constraintsCell);
|
||||
row4.add(lblAnte, constraintsCell);
|
||||
row4.add(lblSideboard, constraintsCell);
|
||||
|
||||
row5.add(manaLabels.get(2).getLeft(), constraintsCell);
|
||||
row5.add(manaLabels.get(3).getLeft(), constraintsCell);
|
||||
row5.add(manaLabels.get(0).getLeft(), constraintsCell);
|
||||
row5.add(manaLabels.get(1).getLeft(), constraintsCell);
|
||||
|
||||
row6.add(manaLabels.get(4).getLeft(), constraintsCell);
|
||||
row6.add(manaLabels.get(5).getLeft(), constraintsCell);
|
||||
row6.add(manaLabels.get(2).getLeft(), constraintsCell);
|
||||
row6.add(manaLabels.get(3).getLeft(), constraintsCell);
|
||||
|
||||
final String constraintsRow = "w 100%!, h 16%!";
|
||||
row7.add(manaLabels.get(4).getLeft(), constraintsCell);
|
||||
row7.add(manaLabels.get(5).getLeft(), constraintsCell);
|
||||
|
||||
final String constraintsRow = "w 100%!, h 14%!";
|
||||
add(row1, constraintsRow + ", gap 0 0 2% 0");
|
||||
add(row2, constraintsRow);
|
||||
add(row3, constraintsRow);
|
||||
add(row4, constraintsRow);
|
||||
add(row5, constraintsRow);
|
||||
add(row6, constraintsRow);
|
||||
add(row7, constraintsRow);
|
||||
}
|
||||
|
||||
public Component getLblLibrary() {
|
||||
@@ -119,7 +127,9 @@ public class PlayerDetailsPanel extends JPanel {
|
||||
librarySize = String.valueOf(player.getLibrarySize()),
|
||||
flashbackSize = String.valueOf(player.getFlashbackSize()),
|
||||
exileSize = String.valueOf(player.getExileSize()),
|
||||
commandSize = String.valueOf(player.getCommandSize());
|
||||
commandSize = String.valueOf(player.getCommandSize()),
|
||||
anteSize = String.valueOf(player.getAnteSize()),
|
||||
sideboardSize = String.valueOf(player.getSideboardSize());
|
||||
|
||||
lblHand.setText(handSize);
|
||||
lblHand.setToolTip(handSize, player.getMaxHandString());
|
||||
@@ -133,6 +143,10 @@ public class PlayerDetailsPanel extends JPanel {
|
||||
lblExile.setToolTip(exileSize);
|
||||
lblCommand.setText(commandSize);
|
||||
lblCommand.setToolTip(commandSize);
|
||||
lblAnte.setText(anteSize);
|
||||
lblAnte.setToolTip(anteSize);
|
||||
lblSideboard.setText(sideboardSize);
|
||||
lblSideboard.setToolTip(sideboardSize);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,7 +161,7 @@ public class PlayerDetailsPanel extends JPanel {
|
||||
}
|
||||
|
||||
public void setupMouseActions(final Runnable handAction, final Runnable libraryAction, final Runnable exileAction,
|
||||
final Runnable graveAction, final Runnable flashBackAction, final Runnable commandAction,
|
||||
final Runnable graveAction, final Runnable flashBackAction, final Runnable commandAction, final Runnable anteAction, final Runnable sideboardAction,
|
||||
final Function<Byte, Boolean> manaAction) {
|
||||
// Detail label listeners
|
||||
lblGraveyard.addMouseListener(new FMouseAdapter() {
|
||||
@@ -180,6 +194,16 @@ public class PlayerDetailsPanel extends JPanel {
|
||||
commandAction.run();
|
||||
}
|
||||
});
|
||||
lblAnte.addMouseListener(new FMouseAdapter() {
|
||||
@Override public void onLeftClick(final MouseEvent e) {
|
||||
anteAction.run();
|
||||
}
|
||||
});
|
||||
lblSideboard.addMouseListener(new FMouseAdapter() {
|
||||
@Override public void onLeftClick(final MouseEvent e) {
|
||||
sideboardAction.run();
|
||||
}
|
||||
});
|
||||
|
||||
for (final Pair<DetailLabel, Byte> labelPair : manaLabels) {
|
||||
labelPair.getLeft().addMouseListener(new FMouseAdapter() {
|
||||
|
||||
@@ -188,6 +188,15 @@ public class FloatingZone extends FloatingCardArea {
|
||||
case Flashback:
|
||||
window.setIconImage(FSkin.getImage(FSkinProp.IMG_ZONE_FLASHBACK));
|
||||
break;
|
||||
case Command:
|
||||
window.setIconImage(FSkin.getImage(FSkinProp.IMG_PLANESWALKER));
|
||||
break;
|
||||
case Ante:
|
||||
window.setIconImage(FSkin.getImage(FSkinProp.IMG_ZONE_ANTE));
|
||||
break;
|
||||
case Sideboard:
|
||||
window.setIconImage(FSkin.getImage(FSkinProp.IMG_ZONE_SIDEBOARD));
|
||||
break;
|
||||
default:
|
||||
locPref = null;
|
||||
break;
|
||||
@@ -247,6 +256,15 @@ public class FloatingZone extends FloatingCardArea {
|
||||
case Flashback:
|
||||
locPref = isAi ? FPref.ZONE_LOC_AI_FLASHBACK : FPref.ZONE_LOC_HUMAN_FLASHBACK;
|
||||
break;
|
||||
case Command:
|
||||
locPref = isAi ? FPref.ZONE_LOC_AI_COMMAND : FPref.ZONE_LOC_HUMAN_COMMAND;
|
||||
break;
|
||||
case Ante:
|
||||
locPref = isAi ? FPref.ZONE_LOC_AI_ANTE : FPref.ZONE_LOC_HUMAN_ANTE;
|
||||
break;
|
||||
case Sideboard:
|
||||
locPref = isAi ? FPref.ZONE_LOC_AI_SIDEBOARD : FPref.ZONE_LOC_HUMAN_SIDEBOARD;
|
||||
break;
|
||||
default:
|
||||
locPref = null;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user