mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
GUI: added info about combat arrows bug on re-connect
This commit is contained in:
parent
00411b4a9b
commit
c9c1bc2b90
2 changed files with 277 additions and 269 deletions
|
@ -1,39 +1,32 @@
|
|||
package mage.client.game;
|
||||
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.cards.Permanent;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.ClientDefaultSettings;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.layout.CardLayoutStrategy;
|
||||
import mage.client.util.layout.impl.OldCardLayoutStrategy;
|
||||
import mage.view.CounterView;
|
||||
import mage.view.PermanentView;
|
||||
|
||||
/*
|
||||
* BattlefieldPanel.java
|
||||
*
|
||||
* Created on 10-Jan-2010, 10:43:14 PM
|
||||
*/
|
||||
package mage.client.game;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.cards.Permanent;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.ClientDefaultSettings;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.layout.CardLayoutStrategy;
|
||||
import mage.client.util.layout.impl.OldCardLayoutStrategy;
|
||||
import mage.view.CounterView;
|
||||
import mage.view.PermanentView;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
||||
public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
||||
|
||||
private final Map<UUID, MagePermanent> permanents = new LinkedHashMap<>();
|
||||
private UUID gameId;
|
||||
|
@ -45,7 +38,6 @@
|
|||
|
||||
private JLayeredPane jPanel;
|
||||
private JScrollPane jScrollPane;
|
||||
private int width;
|
||||
|
||||
private final CardLayoutStrategy layoutStrategy = new OldCardLayoutStrategy();
|
||||
|
||||
|
@ -70,15 +62,16 @@
|
|||
addComponentListener(new ComponentAdapter() {
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
int width = e.getComponent().getWidth();
|
||||
int height = e.getComponent().getHeight();
|
||||
BattlefieldPanel.this.jScrollPane.setSize(width, height);
|
||||
BattlefieldPanel.this.width = width;
|
||||
sortLayout();
|
||||
updateSize();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateSize() {
|
||||
this.jScrollPane.setSize(this.getWidth(), this.getHeight());
|
||||
sortLayout();
|
||||
}
|
||||
|
||||
public void init(UUID gameId, BigCard bigCard) {
|
||||
this.gameId = gameId;
|
||||
this.bigCard = bigCard;
|
||||
|
@ -215,7 +208,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
layoutStrategy.doLayout(this, width);
|
||||
layoutStrategy.doLayout(this, this.getWidth());
|
||||
|
||||
this.jScrollPane.repaint();
|
||||
this.jScrollPane.revalidate();
|
||||
|
@ -321,4 +314,4 @@
|
|||
public Map<String, JComponent> getUiComponentsList() {
|
||||
return uiComponentsList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -611,6 +611,21 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
this.pnlBattlefield.add(topPanel, panelC);
|
||||
panelC.gridy = 1;
|
||||
this.pnlBattlefield.add(bottomPanel, panelC);
|
||||
|
||||
// TODO: combat arrows aren't visible on re-connect, must click on avatar to update correctrly
|
||||
// reason: panels aren't visible/located here, so battlefieldpanel see wrong sizes
|
||||
// recalc all component sizes and update permanents/arrows positions
|
||||
// if you don't do it here then will catch wrong arrows drawing on re-connect (no sortLayout calls)
|
||||
/*
|
||||
this.validate();
|
||||
for (Map.Entry<UUID, PlayAreaPanel> p : players.entrySet()) {
|
||||
PlayerView playerView = game.getPlayers().stream().filter(view -> view.getPlayerId().equals(p.getKey())).findFirst().orElse(null);
|
||||
if (playerView != null) {
|
||||
p.getValue().getBattlefieldPanel().updateSize();
|
||||
p.getValue().update(null, playerView, null);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public synchronized void updateGame(GameView game) {
|
||||
|
|
Loading…
Reference in a new issue