1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-03-29 11:43:34 -09:00

some fixes.

This commit is contained in:
magenoxx 2010-11-22 03:53:34 +00:00
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

View file

@ -34,18 +34,14 @@
package mage.client.cards;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.MouseListener;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
import javax.swing.BorderFactory;
import mage.cards.CardDimensions;
import mage.cards.MageCard;
import mage.client.plugins.adapters.MageMouseAdapter;
@ -98,11 +94,8 @@ public class Cards extends javax.swing.JPanel {
synchronized (this) {
if (!mouseHandlingEnabled) {
mouseHandlingEnabled = true;
//cardArea.addMouseListener(new MageMouseAdapter(this, gameId));
//cardArea.addMouseMotionListener(new MageMouseMotionAdapter(this, bigCard));
jScrollPane1.addMouseListener(new MageMouseAdapter(cardArea, gameId));
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);
cards.put(card.getId(), cardImg);
cardArea.add(cardImg);
/*if (Plugins.getInstance().isCardPluginLoaded()) {
cardImg.setBorder(BorderFactory.createLineBorder(Color.red));
}*/
}
private void removeCard(UUID cardId) {
@ -134,7 +124,7 @@ public class Cards extends javax.swing.JPanel {
cardArea.remove(comp);
}
} else if (comp instanceof MageCard) {
if (((MageCard)comp).getOriginal().equals(cardId)) {
if (((MageCard)comp).getOriginal().getId().equals(cardId)) {
cardArea.remove(comp);
}
}
@ -152,7 +142,6 @@ public class Cards extends javax.swing.JPanel {
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is

View file

@ -282,7 +282,15 @@ public class GamePanel extends javax.swing.JPanel {
this.txtPriority.setText(game.getPriorityPlayerName());
this.txtTurn.setText(Integer.toString(game.getTurn()));
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);

View file

@ -28,5 +28,5 @@ public interface MagePlugins {
void sortPermanents(Map<String, JComponent> ui, Collection<MagePermanent> permanents);
void downloadImage(Set<Card> allCards);
int getGamesPlayed();
int addGamesPlayed();
void addGamesPlayed();
}

View file

@ -122,7 +122,7 @@ public class Plugins implements MagePlugins {
}
@Override
public int addGamesPlayed() {
public void addGamesPlayed() {
if (this.counterPlugin != null) {
synchronized(Plugins.class) {
try {
@ -133,7 +133,6 @@ public class Plugins implements MagePlugins {
}
}
}
return 0;
}
@Override

View file

@ -220,4 +220,9 @@ public class CardView implements Serializable {
public List<UUID> getTargets() {
return targets;
}
@Override
public String toString() {
return getName() + " [" + getId() + "]";
}
}