use of mage.abilities.icon.system.PlayableCountIcon in project mage by magefree.
the class MageLayer method updateCardIcons.
private void updateCardIcons(CardView card) {
Map<CardIconsPanel, List<CardIcon>> newIcons = new HashMap<>();
this.iconsPanels.forEach(panel -> newIcons.put(panel, new ArrayList<>()));
List<CardIcon> allIcons = new ArrayList<>();
// main icons
allIcons.addAll(card.getCardIcons());
// playable icons
if (card.getPlayableStats().getPlayableImportantAmount() > 0) {
allIcons.add(new PlayableCountIcon(card.getPlayableStats()));
}
// create panels
allIcons.forEach(cardIcon -> {
CardIconCategory category = cardIcon.getIconType().getCategory();
// debug panel must take all icons (position depends on render settings)
if (iconsDebugPanel != null) {
newIcons.get(iconsDebugPanel).add(cardIcon);
}
// playable panel (bottom left corner)
if (iconsPlayablePanel != null && category == CardIconCategory.PLAYABLE_COUNT) {
newIcons.get(iconsPlayablePanel).add(cardIcon);
}
// abilities panel (left side)
if (iconsAbilitiesPanel != null && category == CardIconCategory.ABILITY) {
newIcons.get(iconsAbilitiesPanel).add(cardIcon);
}
// commander panel (top center)
if (iconsCommanderPanel != null && category == CardIconCategory.COMMANDER) {
newIcons.get(iconsCommanderPanel).add(cardIcon);
}
});
this.iconsPanels.forEach(panel -> panel.updateIcons(newIcons.get(panel)));
}
Aggregations