Add Ante and Sideboard label to PlayerDetailsPanel to allow view cards in them

This commit is contained in:
Alumi
2021-07-06 16:07:31 +00:00
committed by Bug Hunter
parent 49a85dbe55
commit fcdb9b25bd
16 changed files with 102 additions and 21 deletions

View File

@@ -436,6 +436,13 @@ public class PlayerView extends GameEntityView {
return getZoneSize(TrackableProperty.Library);
}
public FCollectionView<CardView> getSideboard() {
return get(TrackableProperty.Sideboard);
}
public int getSideboardSize() {
return getZoneSize(TrackableProperty.Sideboard);
}
public FCollectionView<CardView> getCards(final ZoneType zone) {
TrackableProperty prop = getZoneProp(zone);
if (prop != null) {

View File

@@ -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:

View File

@@ -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() {

View File

@@ -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() {

View File

@@ -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;

View File

@@ -34,6 +34,8 @@ public enum FSkinImage implements FImage {
GRAVEYARD (FSkinProp.IMG_ZONE_GRAVEYARD, SourceFile.ICONS),
HDGRAVEYARD (FSkinProp.IMG_HDZONE_GRAVEYARD, SourceFile.BUTTONS),
SIDEBOARD (FSkinProp.IMG_ZONE_SIDEBOARD, SourceFile.ICONS),
HDMANAPOOL (FSkinProp.IMG_HDZONE_MANAPOOL, SourceFile.BUTTONS),
POISON (FSkinProp.IMG_ZONE_POISON, SourceFile.ICONS),
@@ -482,7 +484,7 @@ public enum FSkinImage implements FImage {
// If any return true, image exists.
int x0 = 0, y0 = 0;
Color c;
// Center
x0 = (x + w / 2);
y0 = (y + h / 2);
@@ -491,7 +493,7 @@ public enum FSkinImage implements FImage {
textureRegion = new TextureRegion(texture, x, y, w, h);
return;
}
x0 += 2;
y0 += 2;
c = new Color(preferredIcons.getPixel(x0, y0));
@@ -499,21 +501,21 @@ public enum FSkinImage implements FImage {
textureRegion = new TextureRegion(texture, x, y, w, h);
return;
}
x0 -= 4;
c = new Color(preferredIcons.getPixel(x0, y0));
if (c.a != 0) {
textureRegion = new TextureRegion(texture, x, y, w, h);
return;
}
y0 -= 4;
c = new Color(preferredIcons.getPixel(x0, y0));
if (c.a != 0) {
textureRegion = new TextureRegion(texture, x, y, w, h);
return;
}
x0 += 4;
c = new Color(preferredIcons.getPixel(x0, y0));
if (c.a != 0) {

View File

@@ -76,6 +76,7 @@ public class VPlayerPanel extends FContainer {
tabs.add(tabManaPool);
addZoneDisplay(ZoneType.Exile, Forge.hdbuttons ? FSkinImage.HDEXILE : FSkinImage.EXILE);
addZoneDisplay(ZoneType.Sideboard, Forge.hdbuttons ? FSkinImage.HDSIDEBOARD :FSkinImage.SIDEBOARD);
commandZone = add(new CommandZoneDisplay(player));
@@ -441,7 +442,7 @@ public class VPlayerPanel extends FContainer {
if (vibrateDuration > 0 && MatchController.instance.isLocalPlayer(player) &&
FModel.getPreferences().getPrefBoolean(FPref.UI_VIBRATE_ON_LIFE_LOSS)) {
//never vibrate more than two seconds regardless of life lost or poison counters gained
Gdx.input.vibrate(Math.min(vibrateDuration, 2000));
Gdx.input.vibrate(Math.min(vibrateDuration, 2000));
}
}

View File

@@ -2558,6 +2558,8 @@ lblLibraryNCards=Bibliothek ({0})
lblExileNCards=Exil ({0})
lblFlashbackNCards=Rückblende-Karten ({0})
lblCommandZoneNCards=Komandozone ({0})
lblAnteZoneNCards=Ante zone ({0})
lblSideboardNCards=Sideboard ({0})
lblWhiteManaOfN=Weißes Mana ({0})
lblBlueManaOfN=Blaues Mana ({0})
lblBlackManaOfN=Schwarzes Mana ({0})

View File

@@ -2558,6 +2558,8 @@ lblLibraryNCards=Library ({0})
lblExileNCards=Exile ({0})
lblFlashbackNCards=Flashback cards ({0})
lblCommandZoneNCards=Command zone ({0})
lblAnteZoneNCards=Ante zone ({0})
lblSideboardNCards=Sideboard ({0})
lblWhiteManaOfN=White mana ({0})
lblBlueManaOfN=Blue mana ({0})
lblBlackManaOfN=Black mana ({0})

View File

@@ -2557,6 +2557,8 @@ lblLibraryNCards=Biblioteca ({0})
lblExileNCards=Exilio ({0})
lblFlashbackNCards=Cartas con retrospectiva ({0})
lblCommandZoneNCards=Zona de comando ({0})
lblAnteZoneNCards=Ante zone ({0})
lblSideboardNCards=Sideboard ({0})
lblWhiteManaOfN=Maná blanco ({0})
lblBlueManaOfN=Maná azul ({0})
lblBlackManaOfN=Maná negro ({0})

View File

@@ -2557,6 +2557,8 @@ lblLibraryNCards=Grimorio ({0})
lblExileNCards=Esilio ({0})
lblFlashbackNCards=Carte Flashback ({0})
lblCommandZoneNCards=Zona di Comando ({0})
lblAnteZoneNCards=Ante zone ({0})
lblSideboardNCards=Sideboard ({0})
lblWhiteManaOfN=Mana Bianco ({0})
lblBlueManaOfN=Mana Blu ({0})
lblBlackManaOfN=Mana Nero ({0})

View File

@@ -2558,6 +2558,8 @@ lblLibraryNCards=ライブラリー ({0})
lblExileNCards=追放 ({0})
lblFlashbackNCards=フラッシュバックカード ({0})
lblCommandZoneNCards=統率領域 ({0})
lblAnteZoneNCards=アンティ領域 ({0})
lblSideboardNCards=サイドボード ({0})
lblWhiteManaOfN=白マナ ({0})
lblBlueManaOfN=青マナ ({0})
lblBlackManaOfN=黒マナ ({0})

View File

@@ -2558,6 +2558,8 @@ lblLibraryNCards=牌库 ({0})
lblExileNCards=放逐区 ({0})
lblFlashbackNCards=可返照 ({0})
lblCommandZoneNCards=指挥官区 ({0})
lblAnteZoneNCards=Ante zone ({0})
lblSideboardNCards=Sideboard ({0})
lblWhiteManaOfN=白色法术力 ({0})
lblBlueManaOfN=蓝色法术力 ({0})
lblBlackManaOfN=黑色法术力 ({0})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 328 KiB

After

Width:  |  Height:  |  Size: 306 KiB

View File

@@ -86,7 +86,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
UI_IMAGE_CACHE_MAXIMUM("400"),
UI_OVERLAY_FOIL_EFFECT ("true"),
UI_HIDE_REMINDER_TEXT ("false"),
UI_SR_OPTIMIZE ("false"),
UI_SR_OPTIMIZE ("false"),
UI_OPEN_PACKS_INDIV ("false"),
UI_STACK_CREATURES ("false"),
UI_UPLOAD_DRAFT ("false"),
@@ -238,12 +238,18 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
ZONE_LOC_HUMAN_GRAVEYARD(""),
ZONE_LOC_HUMAN_EXILE(""),
ZONE_LOC_HUMAN_FLASHBACK(""),
ZONE_LOC_HUMAN_COMMAND(""),
ZONE_LOC_HUMAN_ANTE(""),
ZONE_LOC_HUMAN_SIDEBOARD(""),
ZONE_LOC_AI_HAND(""),
ZONE_LOC_AI_LIBRARY(""),
ZONE_LOC_AI_GRAVEYARD(""),
ZONE_LOC_AI_EXILE(""),
ZONE_LOC_AI_FLASHBACK(""),
ZONE_LOC_AI_COMMAND(""),
ZONE_LOC_AI_ANTE(""),
ZONE_LOC_AI_SIDEBOARD(""),
CHAT_WINDOW_LOC(""),

View File

@@ -20,7 +20,7 @@ package forge.localinstance.skin;
/**
* Assembles settings from selected or default theme as appropriate. Saves in a
* hashtable, access using .get(settingName) method.
*
*
*/
public enum FSkinProp {
//backgrounds
@@ -62,6 +62,11 @@ public enum FSkinProp {
IMG_ZONE_GRAVEYARD (new int[] {320, 0, 40, 40}, PropType.IMAGE),
IMG_HDZONE_GRAVEYARD (new int[] {132, 6, 128, 128}, PropType.BUTTONS),
IMG_ZONE_ANTE (new int[] {360, 0, 40, 40}, PropType.IMAGE),
IMG_ZONE_SIDEBOARD (new int[] {360, 40, 40, 40}, PropType.IMAGE),
IMG_HDZONE_SIDEBOARD (new int[] {132, 1792, 128, 128}, PropType.BUTTONS),
IMG_HDZONE_MANAPOOL (new int[] {2, 6, 128, 128}, PropType.BUTTONS),
IMG_ZONE_POISON (new int[] {320, 80, 40, 40}, PropType.IMAGE),
@@ -143,7 +148,7 @@ public enum FSkinProp {
IMG_COUNTERS_MULTI (new int[] {80, 400, 80, 80}, PropType.IMAGE),
IMG_ENERGY (new int[] {320, 120, 40, 40}, PropType.IMAGE),
IMG_EXPERIENCE (new int[] {280, 120, 40, 30}, PropType.IMAGE),
//foils
FOIL_01 (new int[] {0, 0, 400, 570}, PropType.FOIL),
FOIL_02 (new int[] {400, 0, 400, 570}, PropType.FOIL),
@@ -395,7 +400,7 @@ public enum FSkinProp {
IMG_FAV4 (new int[] {300, 0, 100, 100}, PropType.FAVICON),
IMG_FAV5 (new int[] {400, 0, 100, 100}, PropType.FAVICON),
IMG_FAVNONE (new int[] {500, 0, 100, 100}, PropType.FAVICON),
IMG_QUEST_DRAFT_DECK (new int[] {0, 0, 680, 475}, PropType.IMAGE),
//COMMANDER
IMG_ABILITY_COMMANDER (new int[] {330, 576, 80, 80}, PropType.ABILITY),
@@ -452,7 +457,7 @@ public enum FSkinProp {
IMG_ABILITY_PROTECT_U (new int[] {2, 330, 80, 80}, PropType.ABILITY),
IMG_ABILITY_PROTECT_UW (new int[] {84, 330, 80, 80}, PropType.ABILITY),
IMG_ABILITY_PROTECT_W (new int[] {166, 330, 80, 80}, PropType.ABILITY);
private int[] coords;
private PropType type;