mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Add Card-type counter for graveyard label hover and in graveyard Dialog window. (To mirror magic online and to make delirium easier to check)
This commit is contained in:
parent
8758c2de36
commit
8675e47c88
2 changed files with 39 additions and 3 deletions
|
@ -36,6 +36,9 @@ package mage.client.dialog;
|
|||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
@ -46,6 +49,8 @@ import mage.client.util.GUISizeHelper;
|
|||
import mage.client.util.ImageHelper;
|
||||
import mage.client.util.SettingsManager;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
import mage.constants.CardType;
|
||||
import mage.view.CardView;
|
||||
import mage.view.CardsView;
|
||||
import mage.view.ExileView;
|
||||
import mage.view.SimpleCardsView;
|
||||
|
@ -158,7 +163,8 @@ public class CardInfoWindowDialog extends MageDialog {
|
|||
public void loadCards(CardsView showCards, BigCard bigCard, UUID gameId, boolean revertOrder) {
|
||||
cards.loadCards(showCards, bigCard, gameId, revertOrder);
|
||||
if (showType.equals(ShowType.GRAVEYARD)) {
|
||||
String titel = name + "'s Graveyard (" + showCards.size() + ")";
|
||||
int qty = qtyCardTypes(showCards);
|
||||
String titel = name + "'s Graveyard (" + showCards.size() + ") - " + qty + ((qty == 1) ? " Card Type" : " Card Types");
|
||||
setTitle(titel);
|
||||
this.setTitelBarToolTip(titel);
|
||||
}
|
||||
|
@ -199,6 +205,17 @@ public class CardInfoWindowDialog extends MageDialog {
|
|||
});
|
||||
}
|
||||
|
||||
private int qtyCardTypes(mage.view.CardsView cardsView){
|
||||
Set<String> cardTypesPresent = new LinkedHashSet<String>() {};
|
||||
for (CardView card : cardsView.values()){
|
||||
List<CardType> cardTypes = card.getCardTypes();
|
||||
for (CardType cardType : cardTypes){
|
||||
cardTypesPresent.add(cardType.toString());
|
||||
}
|
||||
}
|
||||
if (cardTypesPresent.isEmpty()) return 0;
|
||||
else return cardTypesPresent.size();
|
||||
}
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
|
|
|
@ -42,7 +42,10 @@ import java.awt.event.ActionEvent;
|
|||
import java.awt.event.ActionListener;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.GroupLayout;
|
||||
|
@ -69,6 +72,7 @@ import mage.client.util.ImageHelper;
|
|||
import mage.client.util.gui.BufferedImageBuilder;
|
||||
import mage.client.util.gui.countryBox.CountryUtil;
|
||||
import mage.components.ImagePanel;
|
||||
import mage.constants.CardType;
|
||||
import static mage.constants.Constants.DEFAULT_AVATAR_ID;
|
||||
import static mage.constants.Constants.MAX_AVATAR_ID;
|
||||
import static mage.constants.Constants.MIN_AVATAR_ID;
|
||||
|
@ -78,6 +82,8 @@ import mage.utils.timer.PriorityTimer;
|
|||
import mage.view.ManaPoolView;
|
||||
import mage.view.PlayerView;
|
||||
import org.mage.card.arcane.ManaSymbols;
|
||||
import mage.players.Player;
|
||||
import mage.view.CardView;
|
||||
|
||||
/**
|
||||
* Enhanced player pane.
|
||||
|
@ -215,6 +221,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
changedFontGrave = false;
|
||||
}
|
||||
graveLabel.setText(Integer.toString(graveCards));
|
||||
graveLabel.setToolTipText("Card Types: " + qtyCardTypes(player.getGraveyard()));
|
||||
|
||||
int exileCards = player.getExile().size();
|
||||
if (exileCards > 99) {
|
||||
|
@ -439,7 +446,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
|
||||
// Grave count and open graveyard button
|
||||
r = new Rectangle(21, 21);
|
||||
graveLabel.setToolTipText("Graveyard");
|
||||
graveLabel.setToolTipText("Card Types: 0");
|
||||
Image imageGrave = ImageHelper.getImageFromResources("/info/grave.png");
|
||||
BufferedImage resizedGrave = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageGrave, BufferedImage.TYPE_INT_ARGB), r);
|
||||
|
||||
|
@ -858,6 +865,18 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
return player;
|
||||
}
|
||||
|
||||
private int qtyCardTypes(mage.view.CardsView cardsView){
|
||||
Set<String> cardTypesPresent = new LinkedHashSet<String>() {};
|
||||
for (CardView card : cardsView.values()){
|
||||
List<CardType> cardTypes = card.getCardTypes();
|
||||
for (CardType cardType : cardTypes){
|
||||
cardTypesPresent.add(cardType.toString());
|
||||
}
|
||||
}
|
||||
if (cardTypesPresent.isEmpty()) return 0;
|
||||
else return cardTypesPresent.size();
|
||||
}
|
||||
|
||||
private HoverButton avatar;
|
||||
private JLabel avatarFlag;
|
||||
private JButton btnPlayer;
|
||||
|
|
Loading…
Reference in a new issue