mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
Replace poison in player details panel with Command zone button
This commit is contained in:
@@ -68,6 +68,7 @@ public class CField implements ICDoc {
|
|||||||
final ZoneAction exileAction = new ZoneAction(matchUI, player, ZoneType.Exile, MatchConstants.HUMANEXILED);
|
final ZoneAction exileAction = new ZoneAction(matchUI, player, ZoneType.Exile, MatchConstants.HUMANEXILED);
|
||||||
final ZoneAction graveAction = new ZoneAction(matchUI, player, ZoneType.Graveyard, MatchConstants.HUMANGRAVEYARD);
|
final ZoneAction graveAction = new ZoneAction(matchUI, player, ZoneType.Graveyard, MatchConstants.HUMANGRAVEYARD);
|
||||||
final ZoneAction flashBackAction = new ZoneAction(matchUI, player, ZoneType.Flashback, MatchConstants.HUMANFLASHBACK);
|
final ZoneAction flashBackAction = new ZoneAction(matchUI, player, ZoneType.Flashback, MatchConstants.HUMANFLASHBACK);
|
||||||
|
final ZoneAction commandAction = new ZoneAction(matchUI, player, ZoneType.Command, MatchConstants.HUMANCOMMAND);
|
||||||
|
|
||||||
final Function<Byte, Boolean> manaAction = new Function<Byte, Boolean>() {
|
final Function<Byte, Boolean> manaAction = new Function<Byte, Boolean>() {
|
||||||
public Boolean apply(Byte colorCode) {
|
public Boolean apply(Byte colorCode) {
|
||||||
@@ -78,7 +79,7 @@ public class CField implements ICDoc {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
view.getDetailsPanel().setupMouseActions(handAction, libraryAction, exileAction, graveAction, flashBackAction, manaAction);
|
view.getDetailsPanel().setupMouseActions(handAction, libraryAction, exileAction, graveAction, flashBackAction, commandAction, manaAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final CMatchUI getMatchUI() {
|
public final CMatchUI getMatchUI() {
|
||||||
|
|||||||
@@ -228,7 +228,6 @@ public class VField implements IVDoc<CField> {
|
|||||||
|
|
||||||
public void updateDetails() {
|
public void updateDetails() {
|
||||||
control.getMatchUI().getCPlayers().update();
|
control.getMatchUI().getCPlayers().update();
|
||||||
detailsPanel.updateDetails();
|
|
||||||
|
|
||||||
// Update life total
|
// Update life total
|
||||||
final int life = player.getLife();
|
final int life = player.getLife();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package forge.toolbox.special;
|
package forge.toolbox.special;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
@@ -39,7 +38,7 @@ public class PlayerDetailsPanel extends JPanel {
|
|||||||
private final DetailLabel lblLibrary = new DetailLabel(FSkinProp.IMG_ZONE_LIBRARY, "Library (%s)");
|
private final DetailLabel lblLibrary = new DetailLabel(FSkinProp.IMG_ZONE_LIBRARY, "Library (%s)");
|
||||||
private final DetailLabel lblExile = new DetailLabel(FSkinProp.IMG_ZONE_EXILE, "Exile (%s)");
|
private final DetailLabel lblExile = new DetailLabel(FSkinProp.IMG_ZONE_EXILE, "Exile (%s)");
|
||||||
private final DetailLabel lblFlashback = new DetailLabel(FSkinProp.IMG_ZONE_FLASHBACK, "Flashback cards (%s)");
|
private final DetailLabel lblFlashback = new DetailLabel(FSkinProp.IMG_ZONE_FLASHBACK, "Flashback cards (%s)");
|
||||||
private final DetailLabel lblPoison = new DetailLabel(FSkinProp.IMG_ZONE_POISON, "Poison counters (%s)");
|
private final DetailLabel lblCommand = new DetailLabel(FSkinProp.IMG_PLANESWALKER, "Command zone (%s)");
|
||||||
private final List<Pair<DetailLabel, Byte>> manaLabels = new ArrayList<Pair<DetailLabel, Byte>>();
|
private final List<Pair<DetailLabel, Byte>> manaLabels = new ArrayList<Pair<DetailLabel, Byte>>();
|
||||||
|
|
||||||
public PlayerDetailsPanel(final PlayerView player0) {
|
public PlayerDetailsPanel(final PlayerView player0) {
|
||||||
@@ -76,7 +75,7 @@ public class PlayerDetailsPanel extends JPanel {
|
|||||||
row5.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
row5.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||||
row6.setOpaque(false);
|
row6.setOpaque(false);
|
||||||
|
|
||||||
// Hand, library, graveyard, exile, flashback, poison labels
|
// Hand, library, graveyard, exile, flashback, command
|
||||||
final String constraintsCell = "w 50%-4px!, h 100%!, gapleft 2px, gapright 2px";
|
final String constraintsCell = "w 50%-4px!, h 100%!, gapleft 2px, gapright 2px";
|
||||||
|
|
||||||
row1.add(lblHand, constraintsCell);
|
row1.add(lblHand, constraintsCell);
|
||||||
@@ -86,7 +85,7 @@ public class PlayerDetailsPanel extends JPanel {
|
|||||||
row2.add(lblExile, constraintsCell);
|
row2.add(lblExile, constraintsCell);
|
||||||
|
|
||||||
row3.add(lblFlashback, constraintsCell);
|
row3.add(lblFlashback, constraintsCell);
|
||||||
row3.add(lblPoison, constraintsCell);
|
row3.add(lblCommand, constraintsCell);
|
||||||
|
|
||||||
row4.add(manaLabels.get(0).getLeft(), constraintsCell);
|
row4.add(manaLabels.get(0).getLeft(), constraintsCell);
|
||||||
row4.add(manaLabels.get(1).getLeft(), constraintsCell);
|
row4.add(manaLabels.get(1).getLeft(), constraintsCell);
|
||||||
@@ -120,7 +119,8 @@ public class PlayerDetailsPanel extends JPanel {
|
|||||||
graveyardSize = String.valueOf(player.getGraveyardSize()),
|
graveyardSize = String.valueOf(player.getGraveyardSize()),
|
||||||
librarySize = String.valueOf(player.getLibrarySize()),
|
librarySize = String.valueOf(player.getLibrarySize()),
|
||||||
flashbackSize = String.valueOf(player.getFlashbackSize()),
|
flashbackSize = String.valueOf(player.getFlashbackSize()),
|
||||||
exileSize = String.valueOf(player.getExileSize());
|
exileSize = String.valueOf(player.getExileSize()),
|
||||||
|
commandSize = String.valueOf(player.getCommandSize());
|
||||||
lblHand.setText(handSize);
|
lblHand.setText(handSize);
|
||||||
lblHand.setToolTip(handSize, player.getMaxHandString());
|
lblHand.setToolTip(handSize, player.getMaxHandString());
|
||||||
lblGraveyard.setText(graveyardSize);
|
lblGraveyard.setText(graveyardSize);
|
||||||
@@ -131,21 +131,8 @@ public class PlayerDetailsPanel extends JPanel {
|
|||||||
lblFlashback.setToolTip(flashbackSize);
|
lblFlashback.setToolTip(flashbackSize);
|
||||||
lblExile.setText(exileSize);
|
lblExile.setText(exileSize);
|
||||||
lblExile.setToolTip(exileSize);
|
lblExile.setToolTip(exileSize);
|
||||||
}
|
lblCommand.setText(commandSize);
|
||||||
|
lblCommand.setToolTip(commandSize);
|
||||||
/**
|
|
||||||
* Handles observer update of non-Zone details (poison).
|
|
||||||
*/
|
|
||||||
public void updateDetails() {
|
|
||||||
// Poison
|
|
||||||
final int poison = player.getPoisonCounters();
|
|
||||||
lblPoison.setText(String.valueOf(poison));
|
|
||||||
lblPoison.setToolTip(String.valueOf(poison));
|
|
||||||
if (poison < 8) {
|
|
||||||
lblPoison.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
|
||||||
} else {
|
|
||||||
lblPoison.setForeground(Color.red);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -160,7 +147,8 @@ public class PlayerDetailsPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setupMouseActions(final ForgeAction handAction, final ForgeAction libraryAction, final ForgeAction exileAction,
|
public void setupMouseActions(final ForgeAction handAction, final ForgeAction libraryAction, final ForgeAction exileAction,
|
||||||
final ForgeAction graveAction, final ForgeAction flashBackAction, final Function<Byte, Boolean> manaAction) {
|
final ForgeAction graveAction, final ForgeAction flashBackAction, final ForgeAction commandAction,
|
||||||
|
final Function<Byte, Boolean> manaAction) {
|
||||||
// Detail label listeners
|
// Detail label listeners
|
||||||
lblGraveyard.addMouseListener(new FMouseAdapter() {
|
lblGraveyard.addMouseListener(new FMouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
@@ -192,6 +180,12 @@ public class PlayerDetailsPanel extends JPanel {
|
|||||||
flashBackAction.actionPerformed(null);
|
flashBackAction.actionPerformed(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
lblCommand.addMouseListener(new FMouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onLeftClick(final MouseEvent e) {
|
||||||
|
commandAction.actionPerformed(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
for (final Pair<DetailLabel, Byte> labelPair : manaLabels) {
|
for (final Pair<DetailLabel, Byte> labelPair : manaLabels) {
|
||||||
labelPair.getLeft().addMouseListener(new FMouseAdapter() {
|
labelPair.getLeft().addMouseListener(new FMouseAdapter() {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ public enum MatchConstants {
|
|||||||
ALWAYSACCEPT ("Always accept this trigger"),
|
ALWAYSACCEPT ("Always accept this trigger"),
|
||||||
ALWAYSDECLINE ("Always decline this trigger"),
|
ALWAYSDECLINE ("Always decline this trigger"),
|
||||||
ALWAYSASK ("Always ask"),
|
ALWAYSASK ("Always ask"),
|
||||||
|
HUMANCOMMAND ("Player's Command zone", "Command: ", "Player - View Command"),
|
||||||
HUMANEXILED ("Player's Exile", "Exile:", "Player - View Exile"),
|
HUMANEXILED ("Player's Exile", "Exile:", "Player - View Exile"),
|
||||||
HUMANFLASHBACK("Play card with Flashback", "Flashback:", "Player - View Cards with Flashback"),
|
HUMANFLASHBACK("Play card with Flashback", "Flashback:", "Player - View Cards with Flashback"),
|
||||||
HUMANGRAVEYARD("Player's Graveyard", "Graveyard:", "Player - View Graveyard"),
|
HUMANGRAVEYARD("Player's Graveyard", "Graveyard:", "Player - View Graveyard"),
|
||||||
|
|||||||
Reference in New Issue
Block a user