Fixed Issue 183

This commit is contained in:
magenoxx 2011-08-14 12:19:49 +04:00
parent 4c42abc9c6
commit ae52438c67
2 changed files with 7 additions and 12 deletions

View file

@ -56,6 +56,7 @@ import mage.client.cards.BigCard;
import mage.client.cards.Permanent; import mage.client.cards.Permanent;
import mage.client.plugins.impl.Plugins; import mage.client.plugins.impl.Plugins;
import mage.client.util.Config; import mage.client.util.Config;
import mage.game.permanent.Battlefield;
import mage.view.PermanentView; import mage.view.PermanentView;
/** /**
@ -69,9 +70,8 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
private BigCard bigCard; private BigCard bigCard;
private Map<String, JComponent> ui = new HashMap<String, JComponent>(); private Map<String, JComponent> ui = new HashMap<String, JComponent>();
protected static Map<UUID, PermanentView> battlefield; protected Map<UUID, PermanentView> battlefield;
protected static List<Thread> threads = new ArrayList<Thread>(); private Dimension cardDimension;
private static Dimension cardDimension;
/** Creates new form BattlefieldPanel */ /** Creates new form BattlefieldPanel */
public BattlefieldPanel(JScrollPane jScrollPane) { public BattlefieldPanel(JScrollPane jScrollPane) {
@ -127,17 +127,12 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
} }
if (changed) { if (changed) {
BattlefieldPanel.battlefield = battlefield; this.battlefield = battlefield;
sortLayout(); sortLayout();
synchronized (this) {
for (Thread t : threads) {
t.start();
}
threads.clear();
}
} }
} }
//TODO: review sorting stuff
public void sortLayout() { public void sortLayout() {
Plugins.getInstance().sortPermanents(ui, permanents.values()); Plugins.getInstance().sortPermanents(ui, permanents.values());
if (battlefield == null) {return;} if (battlefield == null) {return;}

View file

@ -487,7 +487,7 @@ public class CardPluginImpl implements CardPlugin {
@Override @Override
public void onRemoveCard(MagePermanent card, int count) { public void onRemoveCard(MagePermanent card, int count) {
if (card != null) { if (card != null) {
Animation.hideCard((CardPanel) card, count > 0 ? count : 1); Animation.hideCard(card, count > 0 ? count : 1);
try { try {
while ((card).getAlpha() - 0.05f > 0) { while ((card).getAlpha() - 0.05f > 0) {
Thread.sleep(30); Thread.sleep(30);