mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Fix so extra hand panes removed after losing control of another player
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package forge.control;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
|
||||
import forge.FThreads;
|
||||
import forge.game.Game;
|
||||
import forge.game.card.Card;
|
||||
@@ -26,6 +27,7 @@ import forge.gui.toolbox.special.PhaseLabel;
|
||||
import forge.net.FServer;
|
||||
import forge.util.Lang;
|
||||
import forge.util.maps.MapOfLists;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.util.*;
|
||||
@@ -118,14 +120,17 @@ public class FControlGameEventHandler extends IGameEventVisitor.Base<Void> {
|
||||
return null;
|
||||
}
|
||||
|
||||
FThreads.invokeInEdtNowOrLater(new Runnable() { @Override public void run() {
|
||||
CMatchUI.SINGLETON_INSTANCE.initHandViews(FServer.instance.getLobby().getGuiPlayer());
|
||||
SLayoutIO.loadLayout(null);
|
||||
VMatchUI.SINGLETON_INSTANCE.populate();
|
||||
for (VHand h : VMatchUI.SINGLETON_INSTANCE.getHands()) {
|
||||
h.getLayoutControl().updateHand();
|
||||
FThreads.invokeInEdtNowOrLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CMatchUI.SINGLETON_INSTANCE.initHandViews(FServer.instance.getLobby().getGuiPlayer());
|
||||
SLayoutIO.loadLayout(null);
|
||||
VMatchUI.SINGLETON_INSTANCE.populate();
|
||||
for (VHand h : VMatchUI.SINGLETON_INSTANCE.getHands()) {
|
||||
h.getLayoutControl().updateHand();
|
||||
}
|
||||
}
|
||||
} });
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,6 +119,15 @@ public enum VMatchUI implements IVTopLevelUI {
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any hand panels that aren't needed anymore
|
||||
for (int i = EDocID.Hands.length - 1; i >= lstHands.size(); i--) {
|
||||
DragCell cellWithHand = EDocID.Hands[i].getDoc().getParentCell();
|
||||
if (cellWithHand != null) {
|
||||
cellWithHand.removeDoc(EDocID.Hands[i].getDoc());
|
||||
EDocID.Hands[i].setDoc(new VEmptyDoc(EDocID.Hands[i]));
|
||||
}
|
||||
}
|
||||
|
||||
// Fill in gaps
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user