mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Fix card display being wrong when opening floating card windows.
This commit is contained in:
@@ -513,6 +513,7 @@ public final class CMatchUI
|
|||||||
layoutControl.initialize();
|
layoutControl.initialize();
|
||||||
layoutControl.update();
|
layoutControl.update();
|
||||||
}
|
}
|
||||||
|
FloatingCardArea.closeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -541,6 +542,7 @@ public final class CMatchUI
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean resetForNewGame() {
|
public boolean resetForNewGame() {
|
||||||
|
FloatingCardArea.closeAll();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ public class FloatingCardArea extends CardArea {
|
|||||||
return 40 * player.getId() + zone.hashCode();
|
return 40 * player.getId() + zone.hashCode();
|
||||||
}
|
}
|
||||||
public static void show(final CMatchUI matchUI, final PlayerView player, final ZoneType zone) {
|
public static void show(final CMatchUI matchUI, final PlayerView player, final ZoneType zone) {
|
||||||
int key = getKey(player, zone);
|
final int key = getKey(player, zone);
|
||||||
FloatingCardArea cardArea = floatingAreas.get(key);
|
FloatingCardArea cardArea = floatingAreas.get(key);
|
||||||
if (cardArea == null) {
|
if (cardArea == null || cardArea.getMatchUI() != matchUI) {
|
||||||
cardArea = new FloatingCardArea(matchUI, player, zone);
|
cardArea = new FloatingCardArea(matchUI, player, zone);
|
||||||
floatingAreas.put(key, cardArea);
|
floatingAreas.put(key, cardArea);
|
||||||
} else {
|
} else {
|
||||||
@@ -71,7 +71,7 @@ public class FloatingCardArea extends CardArea {
|
|||||||
}
|
}
|
||||||
cardArea.showWindow();
|
cardArea.showWindow();
|
||||||
}
|
}
|
||||||
public static void refresh(PlayerView player, ZoneType zone) {
|
public static void refresh(final PlayerView player, final ZoneType zone) {
|
||||||
FloatingCardArea cardArea = floatingAreas.get(getKey(player, zone));
|
FloatingCardArea cardArea = floatingAreas.get(getKey(player, zone));
|
||||||
if (cardArea != null) {
|
if (cardArea != null) {
|
||||||
cardArea.setPlayer(player); //ensure player is updated if needed
|
cardArea.setPlayer(player); //ensure player is updated if needed
|
||||||
@@ -90,12 +90,10 @@ public class FloatingCardArea extends CardArea {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void closeAll() {
|
public static void closeAll() {
|
||||||
for (FloatingCardArea cardArea : floatingAreas.values()) {
|
for (final FloatingCardArea cardArea : floatingAreas.values()) {
|
||||||
cardArea.clear();
|
|
||||||
cardArea.player = null; //avoid keeping around reference to player between games
|
|
||||||
cardArea.title = null;
|
|
||||||
cardArea.window.setVisible(false);
|
cardArea.window.setVisible(false);
|
||||||
}
|
}
|
||||||
|
floatingAreas.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ZoneType zone;
|
private final ZoneType zone;
|
||||||
|
|||||||
Reference in New Issue
Block a user