forked from External/mage
[card.plugin] now cards displayed on hand and stack (some stuff still needs to be updated). PLEASE DO REBUILD PLUGIN IF U USE mage-card-plugins.jar.
This commit is contained in:
parent
06b7e63843
commit
63d8231928
13 changed files with 168 additions and 62 deletions
|
|
@ -9,8 +9,10 @@ import javax.swing.JComponent;
|
|||
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardDimensions;
|
||||
import mage.cards.MageCard;
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.view.CardView;
|
||||
import mage.view.PermanentView;
|
||||
|
||||
public interface MagePlugins {
|
||||
|
|
@ -19,6 +21,7 @@ public interface MagePlugins {
|
|||
void updateGamePanel(Map<String, JComponent> ui);
|
||||
JComponent updateTablePanel(Map<String, JComponent> ui);
|
||||
MagePermanent getMagePermanent(PermanentView card, BigCard bigCard, CardDimensions dimension, UUID gameId);
|
||||
MageCard getMageCard(CardView card, BigCard bigCard, CardDimensions dimension, UUID gameId);
|
||||
boolean isThemePluginLoaded();
|
||||
boolean isCardPluginLoaded();
|
||||
boolean isCounterPluginLoaded();
|
||||
|
|
|
|||
|
|
@ -1,23 +1,14 @@
|
|||
package mage.client.plugins.adapters;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.swing.Popup;
|
||||
import javax.swing.PopupFactory;
|
||||
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.cards.MageCard;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.game.PlayAreaPanel;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.DefaultActionCallback;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
|
||||
public class MageMouseAdapter extends MouseAdapter {
|
||||
|
||||
|
|
@ -38,8 +29,8 @@ public class MageMouseAdapter extends MouseAdapter {
|
|||
int count = e.getClickCount();
|
||||
if (count > 0) {
|
||||
Object o = parent.getComponentAt(e.getPoint());
|
||||
if (o instanceof MagePermanent) {
|
||||
MagePermanent selectedCard = (MagePermanent) o;
|
||||
if (o instanceof MageCard) {
|
||||
MageCard selectedCard = (MageCard) o;
|
||||
// TODO: uncomment when attached cards works in plugin
|
||||
/*
|
||||
* int x = e.getX() - selectedCard.getX(); int y = e.getY()
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import java.awt.event.MouseEvent;
|
|||
import java.awt.event.MouseMotionAdapter;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import mage.cards.MageCard;
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
|
|
@ -29,8 +30,8 @@ public class MageMouseMotionAdapter extends MouseMotionAdapter {
|
|||
if (!Plugins.getInstance().isCardPluginLoaded()) {return;}
|
||||
if (bigCard == null) {return;}
|
||||
Object o = parent.getComponentAt(e.getPoint());
|
||||
if (o instanceof MagePermanent) {
|
||||
MagePermanent card = (MagePermanent) o;
|
||||
if (o instanceof MageCard) {
|
||||
MageCard card = (MageCard) o;
|
||||
if (card.getOriginal().getId() != bigCard.getCardId()) {
|
||||
synchronized (MageMouseAdapter.class) {
|
||||
if (card.getOriginal().getId() != bigCard.getCardId()) {
|
||||
|
|
|
|||
|
|
@ -10,11 +10,12 @@ import java.util.logging.Logger;
|
|||
|
||||
import javax.swing.JComponent;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardDimensions;
|
||||
import mage.cards.MageCard;
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.cards.action.impl.EmptyCallback;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.cards.Card;
|
||||
import mage.client.cards.Permanent;
|
||||
import mage.client.plugins.MagePlugins;
|
||||
import mage.client.util.Config;
|
||||
|
|
@ -25,10 +26,10 @@ import mage.interfaces.plugin.CardPlugin;
|
|||
import mage.interfaces.plugin.CounterPlugin;
|
||||
import mage.interfaces.plugin.ThemePlugin;
|
||||
import mage.util.Logging;
|
||||
import mage.view.CardView;
|
||||
import mage.view.PermanentView;
|
||||
import net.xeoh.plugins.base.PluginManager;
|
||||
import net.xeoh.plugins.base.impl.PluginManagerFactory;
|
||||
import net.xeoh.plugins.base.util.PluginManagerUtil;
|
||||
|
||||
|
||||
public class Plugins implements MagePlugins {
|
||||
|
|
@ -73,7 +74,7 @@ public class Plugins implements MagePlugins {
|
|||
}
|
||||
|
||||
@Override
|
||||
public MagePermanent getMagePermanent(final PermanentView card, BigCard bigCard, CardDimensions dimension, final UUID gameId) {
|
||||
public MagePermanent getMagePermanent(PermanentView card, BigCard bigCard, CardDimensions dimension, UUID gameId) {
|
||||
if (cardPlugin != null) {
|
||||
return cardPlugin.getMagePermanent(card, dimension, gameId, emptyCallback);
|
||||
} else {
|
||||
|
|
@ -81,6 +82,15 @@ public class Plugins implements MagePlugins {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MageCard getMageCard(CardView card, BigCard bigCard, CardDimensions dimension, UUID gameId) {
|
||||
if (cardPlugin != null) {
|
||||
return cardPlugin.getMageCard(card, dimension, gameId, emptyCallback);
|
||||
} else {
|
||||
return new Card(card, bigCard, Config.dimensions, gameId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCardPluginLoaded() {
|
||||
return this.cardPlugin != null;
|
||||
|
|
@ -92,7 +102,7 @@ public class Plugins implements MagePlugins {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void downloadImage(Set<Card> allCards) {
|
||||
public void downloadImage(Set<mage.cards.Card> allCards) {
|
||||
if (this.cardPlugin != null) this.cardPlugin.downloadImages(allCards);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue