forked from External/mage
added some client window management + suppress calls when TablesPane is not visible
This commit is contained in:
parent
79583a6ec2
commit
d8fca737fd
27 changed files with 239 additions and 196 deletions
|
|
@ -36,8 +36,6 @@ package mage.client.game;
|
|||
|
||||
import mage.client.*;
|
||||
import java.util.UUID;
|
||||
import javax.swing.event.InternalFrameEvent;
|
||||
import javax.swing.event.InternalFrameListener;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -48,39 +46,11 @@ public class GamePane extends MagePane {
|
|||
/** Creates new form GamePane */
|
||||
public GamePane() {
|
||||
initComponents();
|
||||
addInternalFrameListener(new InternalFrameListener()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void internalFrameOpened(InternalFrameEvent e) { }
|
||||
|
||||
@Override
|
||||
public void internalFrameClosing(InternalFrameEvent e) {
|
||||
gamePanel.cleanUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void internalFrameClosed(InternalFrameEvent e) { }
|
||||
|
||||
@Override
|
||||
public void internalFrameIconified(InternalFrameEvent e) { }
|
||||
|
||||
@Override
|
||||
public void internalFrameDeiconified(InternalFrameEvent e) { }
|
||||
|
||||
@Override
|
||||
public void internalFrameActivated(InternalFrameEvent e) { }
|
||||
|
||||
@Override
|
||||
public void internalFrameDeactivated(InternalFrameEvent e) { }
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void showGame(UUID gameId, UUID playerId) {
|
||||
this.setTitle("Game " + gameId);
|
||||
gamePanel.showGame(gameId, playerId);
|
||||
this.toFront();
|
||||
}
|
||||
|
||||
public void hideGame() {
|
||||
|
|
@ -90,13 +60,11 @@ public class GamePane extends MagePane {
|
|||
public void watchGame(UUID gameId) {
|
||||
this.setTitle("Watching " + gameId);
|
||||
gamePanel.watchGame(gameId);
|
||||
this.toFront();
|
||||
}
|
||||
|
||||
public void replayGame(UUID gameId) {
|
||||
this.setTitle("Replaying " + gameId);
|
||||
gamePanel.replayGame(gameId);
|
||||
this.toFront();
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
|
|
@ -133,4 +101,9 @@ public class GamePane extends MagePane {
|
|||
private javax.swing.JScrollPane jScrollPane1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
@Override
|
||||
public void deactivated() {
|
||||
gamePanel.cleanUp();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,13 +139,17 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
public void cleanUp() {
|
||||
this.chatPanel.disconnect();
|
||||
this.players.clear();
|
||||
logger.debug("players clear.");
|
||||
this.pnlBattlefield.removeAll();
|
||||
combat.hideDialog();
|
||||
pickNumber.hide();
|
||||
pickNumber.hideDialog();
|
||||
for (ExileZoneDialog exile: exiles.values()) {
|
||||
exile.hide();
|
||||
exile.hideDialog();
|
||||
}
|
||||
for (ShowCardsDialog reveal: revealed.values()) {
|
||||
reveal.hide();
|
||||
reveal.hideDialog();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +164,6 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
this.btnConcede.setVisible(true);
|
||||
this.pnlReplay.setVisible(false);
|
||||
this.btnStopWatching.setVisible(false);
|
||||
this.setVisible(true);
|
||||
this.chatPanel.clear();
|
||||
this.chatPanel.connect(session.getGameChatId(gameId));
|
||||
if (!session.joinGame(gameId))
|
||||
|
|
@ -177,7 +180,6 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
this.btnConcede.setVisible(false);
|
||||
this.btnStopWatching.setVisible(true);
|
||||
this.pnlReplay.setVisible(false);
|
||||
this.setVisible(true);
|
||||
this.chatPanel.clear();
|
||||
this.chatPanel.connect(session.getGameChatId(gameId));
|
||||
if (!session.watchGame(gameId))
|
||||
|
|
@ -193,24 +195,19 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
this.btnConcede.setVisible(false);
|
||||
this.btnStopWatching.setVisible(false);
|
||||
this.pnlReplay.setVisible(true);
|
||||
this.setVisible(true);
|
||||
this.chatPanel.clear();
|
||||
if (!session.startReplay(gameId))
|
||||
hideGame();
|
||||
}
|
||||
|
||||
public void hideGame() {
|
||||
this.chatPanel.disconnect();
|
||||
this.players.clear();
|
||||
logger.debug("players clear.");
|
||||
this.pnlBattlefield.removeAll();
|
||||
combat.hideDialog();
|
||||
cleanUp();
|
||||
Component c = this.getParent();
|
||||
while (c != null && !(c instanceof GamePane)) {
|
||||
c = c.getParent();
|
||||
}
|
||||
if (c != null)
|
||||
c.setVisible(false);
|
||||
((GamePane)c).hideFrame();
|
||||
}
|
||||
|
||||
public synchronized void init(GameView game) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue