mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Improved card render modes dialog (emblems and planes support);
This commit is contained in:
parent
06c9d7941c
commit
639c4fab13
7 changed files with 60 additions and 44 deletions
|
@ -20,6 +20,7 @@ import mage.client.draft.DraftPane;
|
|||
import mage.client.draft.DraftPanel;
|
||||
import mage.client.game.GamePane;
|
||||
import mage.client.game.GamePanel;
|
||||
import mage.client.game.PlayAreaPanel;
|
||||
import mage.client.plugins.adapters.MageActionCallback;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.preference.MagePreferences;
|
||||
|
@ -1387,6 +1388,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
return GAMES.get(gameId);
|
||||
}
|
||||
|
||||
public static Map<UUID, PlayAreaPanel> getGamePlayers(UUID gameId) {
|
||||
GamePanel p = GAMES.get(gameId);
|
||||
return p != null ? p.getPlayers() : new HashMap<>();
|
||||
}
|
||||
|
||||
public static void removeGame(UUID gameId) {
|
||||
GAMES.remove(gameId);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,3 @@
|
|||
|
||||
|
||||
/*
|
||||
* Card.java
|
||||
*
|
||||
* Created on 17-Dec-2009, 9:20:50 PM
|
||||
*/
|
||||
package mage.client.cards;
|
||||
|
||||
import mage.cards.CardDimensions;
|
||||
|
@ -37,7 +30,6 @@ import java.util.UUID;
|
|||
import static mage.client.constants.Constants.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
|
@ -367,13 +359,13 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
List<UUID> targets = card.getTargets();
|
||||
if (targets != null) {
|
||||
for (UUID uuid : targets) {
|
||||
PlayAreaPanel playAreaPanel = MageFrame.getGame(gameId).getPlayers().get(uuid);
|
||||
PlayAreaPanel playAreaPanel = MageFrame.getGamePlayers(gameId).get(uuid);
|
||||
if (playAreaPanel != null) {
|
||||
Point target = playAreaPanel.getLocationOnScreen();
|
||||
Point me = this.getLocationOnScreen();
|
||||
ArrowBuilder.getBuilder().addArrow(gameId, (int) me.getX() + 35, (int) me.getY(), (int) target.getX() + 40, (int) target.getY() - 40, Color.red, ArrowBuilder.Type.TARGET);
|
||||
} else {
|
||||
for (PlayAreaPanel pa : MageFrame.getGame(gameId).getPlayers().values()) {
|
||||
for (PlayAreaPanel pa : MageFrame.getGamePlayers(gameId).values()) {
|
||||
MagePermanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid);
|
||||
if (permanent != null) {
|
||||
Point target = permanent.getLocationOnScreen();
|
||||
|
|
|
@ -3,8 +3,8 @@ package mage.client.combat;
|
|||
import mage.cards.MagePermanent;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.game.PlayAreaPanel;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.SettingsManager;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
import mage.view.CardView;
|
||||
import mage.view.CombatGroupView;
|
||||
|
@ -67,7 +67,7 @@ public enum CombatManager {
|
|||
}
|
||||
|
||||
private void drawAttacker(CombatGroupView group, CardView attacker, UUID gameId) {
|
||||
for (PlayAreaPanel pa2 : MageFrame.getGame(gameId).getPlayers().values()) {
|
||||
for (PlayAreaPanel pa2 : MageFrame.getGamePlayers(gameId).values()) {
|
||||
MagePermanent attackerCard = pa2.getBattlefieldPanel().getPermanents().get(attacker.getId());
|
||||
if (attackerCard != null) {
|
||||
drawDefender(group, attackerCard, gameId);
|
||||
|
@ -80,7 +80,7 @@ public enum CombatManager {
|
|||
UUID defenderId = group.getDefenderId();
|
||||
if (defenderId != null) {
|
||||
parentPoint = getParentPoint(attackerCard);
|
||||
PlayAreaPanel p = MageFrame.getGame(gameId).getPlayers().get(defenderId);
|
||||
PlayAreaPanel p = MageFrame.getGamePlayers(gameId).get(defenderId);
|
||||
if (p != null) {
|
||||
Point target = p.getLocationOnScreen();
|
||||
target.translate(-parentPoint.x, -parentPoint.y);
|
||||
|
@ -88,7 +88,7 @@ public enum CombatManager {
|
|||
attackerPoint.translate(-parentPoint.x, -parentPoint.y);
|
||||
ArrowBuilder.getBuilder().addArrow(gameId, (int) attackerPoint.getX() + 45, (int) attackerPoint.getY() + 25, (int) target.getX() + 40, (int) target.getY() - 20, Color.red, ArrowBuilder.Type.COMBAT);
|
||||
} else {
|
||||
for (PlayAreaPanel pa : MageFrame.getGame(gameId).getPlayers().values()) {
|
||||
for (PlayAreaPanel pa : MageFrame.getGamePlayers(gameId).values()) {
|
||||
MagePermanent permanent = pa.getBattlefieldPanel().getPermanents().get(defenderId);
|
||||
if (permanent != null) {
|
||||
Point target = permanent.getLocationOnScreen();
|
||||
|
@ -104,7 +104,7 @@ public enum CombatManager {
|
|||
|
||||
private void drawBlockers(CombatGroupView group, MagePermanent attackerCard, UUID gameId) {
|
||||
for (CardView blocker : group.getBlockers().values()) {
|
||||
for (PlayAreaPanel pa : MageFrame.getGame(gameId).getPlayers().values()) {
|
||||
for (PlayAreaPanel pa : MageFrame.getGamePlayers(gameId).values()) {
|
||||
MagePermanent blockerCard = pa.getBattlefieldPanel().getPermanents().get(blocker.getId());
|
||||
if (blockerCard != null) {
|
||||
parentPoint = getParentPoint(blockerCard);
|
||||
|
|
|
@ -16,14 +16,17 @@ import mage.constants.MultiplayerAttackOption;
|
|||
import mage.constants.RangeOfInfluence;
|
||||
import mage.game.Game;
|
||||
import mage.game.GameImpl;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.command.Plane;
|
||||
import mage.game.command.emblems.AjaniAdversaryOfTyrantsEmblem;
|
||||
import mage.game.command.planes.AkoumPlane;
|
||||
import mage.game.match.MatchType;
|
||||
import mage.game.mulligan.Mulligan;
|
||||
import mage.game.mulligan.VancouverMulligan;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
import mage.players.Player;
|
||||
import mage.players.StubPlayer;
|
||||
import mage.view.CardsView;
|
||||
import mage.view.PermanentView;
|
||||
import mage.view.*;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -94,6 +97,18 @@ public class TestCardRenderDialog extends MageDialog {
|
|||
return cardView;
|
||||
}
|
||||
|
||||
private AbilityView createEmblem(Emblem emblem) {
|
||||
AbilityView emblemView = new AbilityView(emblem.getAbilities().get(0), emblem.getName(), new CardView(new EmblemView(emblem)));
|
||||
emblemView.setName(emblem.getName());
|
||||
return emblemView;
|
||||
}
|
||||
|
||||
private AbilityView createPlane(Plane plane) {
|
||||
AbilityView planeView = new AbilityView(plane.getAbilities().get(0), plane.getName(), new CardView(new PlaneView(plane)));
|
||||
planeView.setName(plane.getName());
|
||||
return planeView;
|
||||
}
|
||||
|
||||
private void reloadCards() {
|
||||
cardsPanel.cleanUp();
|
||||
cardsPanel.setCustomRenderMode(comboRenderMode.getSelectedIndex());
|
||||
|
@ -105,7 +120,7 @@ public class TestCardRenderDialog extends MageDialog {
|
|||
|
||||
BigCard big = new BigCard();
|
||||
CardsView view = new CardsView();
|
||||
PermanentView card;
|
||||
CardView card;
|
||||
card = createCard(game, player.getId(), "RNA", "263", 0, 0, 0); // mountain
|
||||
view.put(card.getId(), card);
|
||||
card = createCard(game, player.getId(), "RNA", "185", 0, 0, 0); // Judith, the Scourge Diva
|
||||
|
@ -120,11 +135,15 @@ public class TestCardRenderDialog extends MageDialog {
|
|||
view.put(card.getId(), card);
|
||||
card = createCard(game, player.getId(), "XLN", "234", 0, 0, 0); // Conqueror's Galleon
|
||||
view.put(card.getId(), card);
|
||||
card = createEmblem(new AjaniAdversaryOfTyrantsEmblem()); // Emblem Ajani
|
||||
view.put(card.getId(), card);
|
||||
card = createPlane(new AkoumPlane()); // Plane - Akoum
|
||||
view.put(card.getId(), card);
|
||||
|
||||
cardsPanel.setCustomCardSize(new Dimension(getCardWidth(), getCardHeight()));
|
||||
cardsPanel.changeGUISize();
|
||||
|
||||
cardsPanel.loadCards(view, big, null);
|
||||
cardsPanel.loadCards(view, big, game.getId());
|
||||
}
|
||||
|
||||
private int getCardWidth() {
|
||||
|
|
|
@ -363,8 +363,6 @@ public class MageActionCallback implements ActionCallback {
|
|||
if (!((GamePane) topPane).getGameId().equals(data.getGameId())) {
|
||||
return;
|
||||
}
|
||||
} else if (data.getGameId() != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
hideTooltipPopup();
|
||||
|
|
|
@ -16,14 +16,15 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class ArrowUtil {
|
||||
|
||||
private ArrowUtil() {}
|
||||
private ArrowUtil() {
|
||||
}
|
||||
|
||||
public static void drawArrowsForPairedCards(TransferData data, Point parentPoint) {
|
||||
if (data.getCard().getPairedCard() != null) {
|
||||
Point me = new Point(data.getLocationOnScreen());
|
||||
me.translate(-parentPoint.x, -parentPoint.y);
|
||||
UUID uuid = data.getCard().getPairedCard();
|
||||
for (PlayAreaPanel pa : MageFrame.getGame(data.getGameId()).getPlayers().values()) {
|
||||
for (PlayAreaPanel pa : MageFrame.getGamePlayers(data.getGameId()).values()) {
|
||||
MagePermanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid);
|
||||
if (permanent != null) {
|
||||
Point target = permanent.getLocationOnScreen();
|
||||
|
@ -38,7 +39,7 @@ public final class ArrowUtil {
|
|||
if (data.getCard().getBandedCards() != null && !data.getCard().getBandedCards().isEmpty()) {
|
||||
Point me = new Point(data.getLocationOnScreen());
|
||||
me.translate(-parentPoint.x, -parentPoint.y);
|
||||
for (PlayAreaPanel pa : MageFrame.getGame(data.getGameId()).getPlayers().values()) {
|
||||
for (PlayAreaPanel pa : MageFrame.getGamePlayers(data.getGameId()).values()) {
|
||||
for (UUID uuid : data.getCard().getBandedCards()) {
|
||||
MagePermanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid);
|
||||
if (permanent != null) {
|
||||
|
@ -53,7 +54,7 @@ public final class ArrowUtil {
|
|||
|
||||
public static void drawArrowsForEnchantPlayers(TransferData data, Point parentPoint) {
|
||||
if (data.getGameId() != null && MageFrame.getGame(data.getGameId()) != null) {
|
||||
for (PlayAreaPanel pa : MageFrame.getGame(data.getGameId()).getPlayers().values()) {
|
||||
for (PlayAreaPanel pa : MageFrame.getGamePlayers(data.getGameId()).values()) {
|
||||
PlayerPanelExt playAreaPanel = pa.getPlayerPanel();
|
||||
if (playAreaPanel != null && playAreaPanel.getPlayer() != null && playAreaPanel.getPlayer().hasAttachments()) {
|
||||
Point me = new Point(data.getLocationOnScreen());
|
||||
|
@ -75,7 +76,7 @@ public final class ArrowUtil {
|
|||
Point me = new Point(data.getLocationOnScreen());
|
||||
me.translate(-parentPoint.x, -parentPoint.y);
|
||||
UUID uuid = data.getCard().getParentId();
|
||||
for (PlayAreaPanel pa : MageFrame.getGame(data.getGameId()).getPlayers().values()) {
|
||||
for (PlayAreaPanel pa : MageFrame.getGamePlayers(data.getGameId()).values()) {
|
||||
MagePermanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid);
|
||||
if (permanent != null) {
|
||||
Point source = permanent.getLocationOnScreen();
|
||||
|
@ -96,7 +97,7 @@ public final class ArrowUtil {
|
|||
me.translate(-parentPoint.x, -parentPoint.y);
|
||||
for (UUID uuid : targets) {
|
||||
|
||||
PlayAreaPanel p = MageFrame.getGame(data.getGameId()).getPlayers().get(uuid);
|
||||
PlayAreaPanel p = MageFrame.getGamePlayers(data.getGameId()).get(uuid);
|
||||
if (p != null) {
|
||||
Point target = p.getLocationOnScreen();
|
||||
target.translate(-parentPoint.x, -parentPoint.y);
|
||||
|
@ -104,7 +105,7 @@ public final class ArrowUtil {
|
|||
continue;
|
||||
}
|
||||
|
||||
for (PlayAreaPanel panel : MageFrame.getGame(data.getGameId()).getPlayers().values()) {
|
||||
for (PlayAreaPanel panel : MageFrame.getGamePlayers(data.getGameId()).values()) {
|
||||
MagePermanent permanent = panel.getBattlefieldPanel().getPermanents().get(uuid);
|
||||
if (permanent != null) {
|
||||
Point target = permanent.getLocationOnScreen();
|
||||
|
@ -117,7 +118,7 @@ public final class ArrowUtil {
|
|||
if (view != null) {
|
||||
CardsView graveyard = view.getGraveyard();
|
||||
if (graveyard.containsKey(uuid)) {
|
||||
p = MageFrame.getGame(data.getGameId()).getPlayers().get(view.getPlayerId());
|
||||
p = MageFrame.getGamePlayers(data.getGameId()).get(view.getPlayerId());
|
||||
if (p != null) {
|
||||
Point target = p.getLocationOnScreen();
|
||||
target.translate(-parentPoint.x, -parentPoint.y);
|
||||
|
|
|
@ -52,7 +52,7 @@ public final class CardImageUtils {
|
|||
return filePath;
|
||||
}
|
||||
|
||||
log.warn("Token image file not found. Set: " + card.getSet() + " Token Set Code: " + card.getTokenSetCode() + " Name: " + card.getName() + " File path: " + getTokenImagePath(card));
|
||||
//log.warn("Token image file not found. Set: " + card.getSet() + " Token Set Code: " + card.getTokenSetCode() + " Name: " + card.getName() + " File path: " + getTokenImagePath(card));
|
||||
} else {
|
||||
log.warn("Trying to get token path for non token card. Set: " + card.getSet() + " Set Code: " + card.getTokenSetCode() + " Name: " + card.getName());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue