mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
client + server improvements
This commit is contained in:
parent
f37f2d8b63
commit
94c5a0cdfb
20 changed files with 594 additions and 321 deletions
|
|
@ -746,6 +746,16 @@ public class MageFrame extends javax.swing.JFrame {
|
|||
this.tablesPane.hideTables();
|
||||
}
|
||||
|
||||
public void hideGames() {
|
||||
JInternalFrame[] windows = desktopPane.getAllFramesInLayer(javax.swing.JLayeredPane.DEFAULT_LAYER);
|
||||
for (JInternalFrame window: windows) {
|
||||
if (window instanceof GamePane) {
|
||||
GamePane gamePane = (GamePane) window;
|
||||
gamePane.hideGame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void showDeckEditor(DeckEditorMode mode, Deck deck, UUID tableId, int time) {
|
||||
try {
|
||||
DeckEditorPane deckEditorPane = new DeckEditorPane();
|
||||
|
|
@ -826,6 +836,7 @@ public class MageFrame extends javax.swing.JFrame {
|
|||
public void setStatusText(String status) {
|
||||
this.lblStatus.setText(status);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class MagePaneMenuItem extends JCheckBoxMenuItem {
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public class ConnectDialog extends MageDialog {
|
|||
this.chkAutoConnect.setSelected(Boolean.parseBoolean(MageFrame.getPreferences().get("autoConnect", "false")));
|
||||
this.txtProxyServer.setText(MageFrame.getPreferences().get("proxyAddress", Config.serverName));
|
||||
this.txtProxyPort.setText(MageFrame.getPreferences().get("proxyPort", Integer.toString(Config.port)));
|
||||
this.cbProxyType.setSelectedItem(MageFrame.getPreferences().get("proxyType", Connection.ProxyType.NONE.toString()));
|
||||
this.cbProxyType.setSelectedItem(Connection.ProxyType.valueOf(MageFrame.getPreferences().get("proxyType", "NONE").toUpperCase()));
|
||||
this.showProxySettings();
|
||||
this.setModal(true);
|
||||
this.setLocation(50, 50);
|
||||
|
|
|
|||
|
|
@ -318,6 +318,10 @@ public class NewTableDialog extends MageDialog {
|
|||
options.setRange((RangeOfInfluence) this.cbRange.getSelectedItem());
|
||||
options.setWinsNeeded((Integer)this.spnNumWins.getValue());
|
||||
table = session.createTable(roomId, options);
|
||||
if (table == null) {
|
||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error creating table.", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (session.joinTable(roomId, table.getTableId(), this.player1Panel.getPlayerName(), "Human", 1, Sets.loadDeck(this.player1Panel.getDeckFile()))) {
|
||||
for (TablePlayerPanel player: players) {
|
||||
|
|
|
|||
|
|
@ -308,6 +308,10 @@ public class NewTournamentDialog extends MageDialog {
|
|||
tOptions.getMatchOptions().setAttackOption(MultiplayerAttackOption.LEFT);
|
||||
tOptions.getMatchOptions().setRange(RangeOfInfluence.ALL);
|
||||
table = session.createTournamentTable(roomId, tOptions);
|
||||
if (table == null) {
|
||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error creating table.", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
if (session.joinTournamentTable(roomId, table.getTableId(), this.txtPlayer1Name.getText(), "Human", 1)) {
|
||||
for (TournamentPlayerPanel player: players) {
|
||||
if (!player.getPlayerType().equals("Human")) {
|
||||
|
|
|
|||
|
|
@ -83,6 +83,10 @@ public class GamePane extends MagePane {
|
|||
this.toFront();
|
||||
}
|
||||
|
||||
public void hideGame() {
|
||||
gamePanel.hideGame();
|
||||
}
|
||||
|
||||
public void watchGame(UUID gameId) {
|
||||
this.setTitle("Watching " + gameId);
|
||||
gamePanel.watchGame(gameId);
|
||||
|
|
|
|||
|
|
@ -100,6 +100,8 @@ public class Session {
|
|||
}
|
||||
try {
|
||||
System.setSecurityManager(null);
|
||||
System.setProperty("http.nonProxyHosts", "code.google.com");
|
||||
System.setProperty("socksNonProxyHosts", "code.google.com");
|
||||
switch (connection.getProxyType()) {
|
||||
case SOCKS:
|
||||
System.setProperty("socksProxyHost", connection.getProxyHost());
|
||||
|
|
@ -157,7 +159,8 @@ public class Session {
|
|||
}
|
||||
try {
|
||||
//TODO: stop daemon
|
||||
server.deregisterClient(sessionId);
|
||||
if (server != null)
|
||||
server.deregisterClient(sessionId);
|
||||
} catch (RemoteException ex) {
|
||||
logger.fatal("Error disconnecting ...", ex);
|
||||
} catch (MageException ex) {
|
||||
|
|
@ -171,6 +174,7 @@ public class Session {
|
|||
if (future != null && !future.isDone())
|
||||
future.cancel(true);
|
||||
server = null;
|
||||
frame.hideGames();
|
||||
frame.hideTables();
|
||||
frame.setStatusText("Not connected");
|
||||
frame.disableButtons();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue