mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
* UI: added playable card marks in look-at windows;
This commit is contained in:
parent
ff1299cca9
commit
cde9957f54
15 changed files with 200 additions and 122 deletions
|
|
@ -517,7 +517,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(boolean selected) {
|
||||
public void setSelected(boolean isSelected) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1205,11 +1205,11 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
needSelectable = new HashSet<>();
|
||||
}
|
||||
|
||||
Set<UUID> needPlayable;
|
||||
Map<UUID, Integer> needPlayable;
|
||||
if (showPlayable && gameView.getCanPlayObjects() != null) {
|
||||
needPlayable = gameView.getCanPlayObjects();
|
||||
} else {
|
||||
needPlayable = new HashSet<>();
|
||||
needPlayable = new HashMap<>();
|
||||
}
|
||||
|
||||
if (needChoosen.isEmpty() && needSelectable.isEmpty() && needPlayable.isEmpty()) {
|
||||
|
|
@ -1225,8 +1225,9 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
if (needChoosen.contains(card.getId())) {
|
||||
card.setSelected(true);
|
||||
}
|
||||
if (needPlayable.contains(card.getId())) {
|
||||
if (needPlayable.containsKey(card.getId())) {
|
||||
card.setPlayable(true);
|
||||
card.setPlayableAmount(needPlayable.get(card.getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1254,8 +1255,9 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
if (needChoosen.contains(perm.getKey())) {
|
||||
perm.getValue().setSelected(true);
|
||||
}
|
||||
if (needPlayable.contains(perm.getKey())) {
|
||||
if (needPlayable.containsKey(perm.getKey())) {
|
||||
perm.getValue().setPlayable(true);
|
||||
perm.getValue().setPlayableAmount(needPlayable.get(perm.getKey()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1271,8 +1273,9 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
if (needChoosen.contains(card.getKey())) {
|
||||
card.getValue().setSelected(true);
|
||||
}
|
||||
if (needPlayable.contains(card.getKey())) {
|
||||
if (needPlayable.containsKey(card.getKey())) {
|
||||
card.getValue().setPlayable(true);
|
||||
card.getValue().setPlayableAmount(needPlayable.get(card.getKey()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1288,8 +1291,9 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
if (needChoosen.contains(card.getKey())) {
|
||||
card.getValue().setSelected(true);
|
||||
}
|
||||
if (needPlayable.contains(card.getKey())) {
|
||||
if (needPlayable.containsKey(card.getKey())) {
|
||||
card.getValue().setPlayable(true);
|
||||
card.getValue().setPlayableAmount(needPlayable.get(card.getKey()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1305,8 +1309,9 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
if (needChoosen.contains(com.getId())) {
|
||||
com.setSelected(true);
|
||||
}
|
||||
if (needPlayable.contains(com.getId())) {
|
||||
if (needPlayable.containsKey(com.getId())) {
|
||||
com.setPlayable(true);
|
||||
com.setPlayableAmount(needPlayable.get(com.getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1321,8 +1326,19 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
if (needChoosen.contains(card.getKey())) {
|
||||
card.getValue().setSelected(true);
|
||||
}
|
||||
if (needPlayable.contains(card.getKey())) {
|
||||
if (needPlayable.containsKey(card.getKey())) {
|
||||
card.getValue().setPlayable(true);
|
||||
card.getValue().setPlayableAmount(needPlayable.get(card.getKey()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// looked at
|
||||
for (LookedAtView look : gameView.getLookedAt()) {
|
||||
for (Map.Entry<UUID, SimpleCardView> card : look.getCards().entrySet()) {
|
||||
if (needPlayable.containsKey(card.getKey())) {
|
||||
card.getValue().setPlayable(true);
|
||||
card.getValue().setPlayableAmount(needPlayable.get(card.getKey()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
// can play
|
||||
if (gameView != null && gameView.getCanPlayObjects() != null && !gameView.getCanPlayObjects().isEmpty()) {
|
||||
for (CardView card : cards) {
|
||||
if (gameView.getCanPlayObjects().contains(card.getId())) {
|
||||
if (gameView.getCanPlayObjects().containsKey(card.getId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -239,7 +239,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
|
||||
Color commandColor = Color.BLACK;
|
||||
for (CommandObjectView com : player.getCommandObjectList()) {
|
||||
if (game != null && game.getCanPlayObjects() != null && game.getCanPlayObjects().contains(com.getId())) {
|
||||
if (game != null && game.getCanPlayObjects() != null && game.getCanPlayObjects().containsKey(com.getId())) {
|
||||
commandColor = activeValueColor;
|
||||
break;
|
||||
}
|
||||
|
|
@ -269,7 +269,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
|
||||
if (!MageFrame.isLite()) {
|
||||
int id = player.getUserData().getAvatarId();
|
||||
if (!(id >= 1000) && (id <= 0 || (id <= MIN_AVATAR_ID && id > MAX_AVATAR_ID))) {
|
||||
if (!(id > 1000) && (id != 64) && (id < MIN_AVATAR_ID || id > MAX_AVATAR_ID)) {
|
||||
id = DEFAULT_AVATAR_ID;
|
||||
}
|
||||
if (id != avatarId) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public final class CardsViewUtil {
|
|||
CardInfo cardInfo = CardRepository.instance.findCard(simple.getExpansionSetCode(), simple.getCardNumber());
|
||||
Card card = cardInfo != null ? cardInfo.getMockCard() : null;
|
||||
if (card != null) {
|
||||
cards.put(simple.getId(), new CardView(card, simple.getId()));
|
||||
cards.put(simple.getId(), new CardView(card, simple));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ public final class CardsViewUtil {
|
|||
loadedCards.put(key, card);
|
||||
}
|
||||
if (card != null) {
|
||||
cards.put(simple.getId(), new CardView(card, simple.getId()));
|
||||
cards.put(simple.getId(), new CardView(card, simple));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue