foul-magics/Mage.Client/src/main/java/mage/client/tournament/TournamentPane.java
Oleg Agafonov 960e896903
Network upgrade and new reconnection mode (#11527)
Network upgrade and new reconnection mode:
* users can disconnect or close app without game progress loose now;
* disconnect dialog will show active tables stats and additional options;
* all active tables will be restored on reconnect (tables, tourneys, games, drafts, sideboarding, constructing);
* user must use same server and username on next connection;
* there are few minutes for reconnect until server kick off a disconnected player from all player's tables (concede/loose);
* now you can safety reconnect after IP change (after proxy/vpn/wifi/router restart);

Other improvements and fixes:
* gui: main menu - improved switch panel button, added stats about current tables/panels;
* gui: improved data sync and updates (fixes many use cases with empty battlefield, not started games/drafts/tourneys, not updatable drafts, etc);
* gui: improved stability on game updates (fixes some random errors related to wrong threads);
* server: fixed miss messages about player's disconnection problems for other players in the chat;
* refactor: simplified and improved connection and network related code, deleted outdated code, added docs;
* tests: improved load test to support lands only set for more stable performance/network testing (set TEST_AI_RANDOM_DECK_SETS = PELP and run test_TwoAIPlayGame_Multiple);
2023-12-07 20:56:52 +04:00

86 lines
2.4 KiB
Java

package mage.client.tournament;
import java.util.UUID;
import mage.client.MagePane;
/**
* Game GUI: tournament frame
*
* @author BetaSteward_at_googlemail.com
*/
public class TournamentPane extends MagePane {
UUID tournamentId = null;
public TournamentPane() {
initComponents();
}
public void showTournament(UUID tournamentId) {
this.tournamentId = tournamentId;
this.setTitle("Tournament " + tournamentId);
this.tournamentPanel.showTournament(tournamentId);
this.repaint();
}
@Override
public boolean isActiveTable() {
return this.tournamentId != null;
}
public void removeTournament() {
tournamentPanel.cleanUp();
removeFrame();
}
@Override
public void changeGUISize() {
tournamentPanel.changeGUISize();
}
public UUID getTournamentId() {
if (this.tournamentPanel == null) {
return null;
}
return tournamentPanel.getTournamentId();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
tournamentPanel = new mage.client.tournament.TournamentPanel();
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tournamentPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 758, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tournamentPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 526, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private mage.client.tournament.TournamentPanel tournamentPanel;
// End of variables declaration//GEN-END:variables
@Override
public void activated() {
tournamentPanel.startTasks();
}
@Override
public void deactivated() {
tournamentPanel.stopTasks();
}
}