mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
GUI: fixed that attack/block arrows was visible after disconnect (closes #12258)
This commit is contained in:
parent
f53c9da3e4
commit
bd1ab573f1
2 changed files with 12 additions and 19 deletions
|
|
@ -681,25 +681,29 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
if (activeFrame != null) {
|
||||
activeFrame.deactivated();
|
||||
}
|
||||
activeFrame = null;
|
||||
|
||||
// If null, no new frame to activate, return early
|
||||
// clean resources
|
||||
ArrowBuilder.getBuilder().hideAllPanels();
|
||||
MusicPlayer.stopBGM();
|
||||
|
||||
// if no new frame to activate (example: disconnection)
|
||||
if (frame == null) {
|
||||
activeFrame = null;
|
||||
return;
|
||||
}
|
||||
|
||||
LOGGER.debug("Setting " + frame.getTitle() + " active");
|
||||
|
||||
activeFrame = frame;
|
||||
desktopPane.moveToFront(frame);
|
||||
desktopPane.moveToFront(activeFrame);
|
||||
activeFrame.setBounds(0, 0, desktopPane.getWidth(), desktopPane.getHeight());
|
||||
activeFrame.revalidate();
|
||||
activeFrame.activated();
|
||||
activeFrame.setVisible(true);
|
||||
ArrowBuilder.getBuilder().hideAllPanels();
|
||||
if (frame instanceof GamePane) {
|
||||
ArrowBuilder.getBuilder().showPanel(((GamePane) frame).getGameId());
|
||||
|
||||
if (activeFrame instanceof GamePane) {
|
||||
ArrowBuilder.getBuilder().showPanel(((GamePane) activeFrame).getGameId());
|
||||
MusicPlayer.playBGM();
|
||||
} else {
|
||||
MusicPlayer.stopBGM();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,17 +69,6 @@ public class ArrowBuilder {
|
|||
return arrowPanels.get(gameId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Not synchronized method for arrows panel.
|
||||
* Doesn't create JPanel in case the panel doesn't exist.
|
||||
* Works faster.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
/*public JPanel getPanelRef() {
|
||||
return arrowsManagerPanel;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Adds new arrow.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue