mirror of
https://github.com/correl/mage.git
synced 2025-04-10 01:01:05 -09:00
some fixes.
This commit is contained in:
parent
63d8231928
commit
ec51f30d37
6 changed files with 17 additions and 16 deletions
Mage.Client
plugins
src/main/java/mage/client
Mage.Common/src/mage/view
Binary file not shown.
|
@ -34,18 +34,14 @@
|
||||||
|
|
||||||
package mage.client.cards;
|
package mage.client.cards;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.event.MouseListener;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
|
|
||||||
import mage.cards.CardDimensions;
|
import mage.cards.CardDimensions;
|
||||||
import mage.cards.MageCard;
|
import mage.cards.MageCard;
|
||||||
import mage.client.plugins.adapters.MageMouseAdapter;
|
import mage.client.plugins.adapters.MageMouseAdapter;
|
||||||
|
@ -98,11 +94,8 @@ public class Cards extends javax.swing.JPanel {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (!mouseHandlingEnabled) {
|
if (!mouseHandlingEnabled) {
|
||||||
mouseHandlingEnabled = true;
|
mouseHandlingEnabled = true;
|
||||||
//cardArea.addMouseListener(new MageMouseAdapter(this, gameId));
|
|
||||||
//cardArea.addMouseMotionListener(new MageMouseMotionAdapter(this, bigCard));
|
|
||||||
jScrollPane1.addMouseListener(new MageMouseAdapter(cardArea, gameId));
|
jScrollPane1.addMouseListener(new MageMouseAdapter(cardArea, gameId));
|
||||||
jScrollPane1.addMouseMotionListener(new MageMouseMotionAdapter(cardArea, bigCard));
|
jScrollPane1.addMouseMotionListener(new MageMouseMotionAdapter(cardArea, bigCard));
|
||||||
//addMouseListener(new MageMouseAdapter(this, gameId));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,9 +115,6 @@ public class Cards extends javax.swing.JPanel {
|
||||||
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, Config.dimensions, gameId);
|
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, Config.dimensions, gameId);
|
||||||
cards.put(card.getId(), cardImg);
|
cards.put(card.getId(), cardImg);
|
||||||
cardArea.add(cardImg);
|
cardArea.add(cardImg);
|
||||||
/*if (Plugins.getInstance().isCardPluginLoaded()) {
|
|
||||||
cardImg.setBorder(BorderFactory.createLineBorder(Color.red));
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeCard(UUID cardId) {
|
private void removeCard(UUID cardId) {
|
||||||
|
@ -134,7 +124,7 @@ public class Cards extends javax.swing.JPanel {
|
||||||
cardArea.remove(comp);
|
cardArea.remove(comp);
|
||||||
}
|
}
|
||||||
} else if (comp instanceof MageCard) {
|
} else if (comp instanceof MageCard) {
|
||||||
if (((MageCard)comp).getOriginal().equals(cardId)) {
|
if (((MageCard)comp).getOriginal().getId().equals(cardId)) {
|
||||||
cardArea.remove(comp);
|
cardArea.remove(comp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,7 +142,6 @@ public class Cards extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/** This method is called from within the constructor to
|
||||||
* initialize the form.
|
* initialize the form.
|
||||||
* WARNING: Do NOT modify this code. The content of this method is
|
* WARNING: Do NOT modify this code. The content of this method is
|
||||||
|
|
|
@ -282,7 +282,15 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
this.txtPriority.setText(game.getPriorityPlayerName());
|
this.txtPriority.setText(game.getPriorityPlayerName());
|
||||||
this.txtTurn.setText(Integer.toString(game.getTurn()));
|
this.txtTurn.setText(Integer.toString(game.getTurn()));
|
||||||
for (PlayerView player: game.getPlayers()) {
|
for (PlayerView player: game.getPlayers()) {
|
||||||
players.get(player.getPlayerId()).update(player);
|
if (player != null) {
|
||||||
|
if (players.containsKey(player.getPlayerId())) {
|
||||||
|
players.get(player.getPlayerId()).update(player);
|
||||||
|
} else {
|
||||||
|
logger.warning("Couldn't find player.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.warning("Player object is null.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.stack.loadCards(game.getStack(), bigCard, gameId);
|
this.stack.loadCards(game.getStack(), bigCard, gameId);
|
||||||
|
|
|
@ -28,5 +28,5 @@ public interface MagePlugins {
|
||||||
void sortPermanents(Map<String, JComponent> ui, Collection<MagePermanent> permanents);
|
void sortPermanents(Map<String, JComponent> ui, Collection<MagePermanent> permanents);
|
||||||
void downloadImage(Set<Card> allCards);
|
void downloadImage(Set<Card> allCards);
|
||||||
int getGamesPlayed();
|
int getGamesPlayed();
|
||||||
int addGamesPlayed();
|
void addGamesPlayed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class Plugins implements MagePlugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int addGamesPlayed() {
|
public void addGamesPlayed() {
|
||||||
if (this.counterPlugin != null) {
|
if (this.counterPlugin != null) {
|
||||||
synchronized(Plugins.class) {
|
synchronized(Plugins.class) {
|
||||||
try {
|
try {
|
||||||
|
@ -133,7 +133,6 @@ public class Plugins implements MagePlugins {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -220,4 +220,9 @@ public class CardView implements Serializable {
|
||||||
public List<UUID> getTargets() {
|
public List<UUID> getTargets() {
|
||||||
return targets;
|
return targets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return getName() + " [" + getId() + "]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue