mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
fixed issue 25 - server waits for all clients to confirm initialization before starting game
This commit is contained in:
parent
f81c238994
commit
3ca748e16d
9 changed files with 56 additions and 45 deletions
|
|
@ -508,8 +508,8 @@ public class MageFrame extends javax.swing.JFrame {
|
|||
if (g != null) {
|
||||
renderSplashFrame(g);
|
||||
}
|
||||
splash.update();
|
||||
}
|
||||
splash.update();
|
||||
|
||||
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||
public void uncaughtException(Thread t, Throwable e) {
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ public class Client implements CallbackClient {
|
|||
}
|
||||
else if (callback.getMethod().equals("gameInit")) {
|
||||
session.getGame().init((GameView) callback.getData());
|
||||
session.ack("gameInit");
|
||||
}
|
||||
else if (callback.getMethod().equals("gameOver")) {
|
||||
session.getGame().modalMessage((String) callback.getData());
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
package mage.client.remote;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.rmi.NotBoundException;
|
||||
import java.rmi.RemoteException;
|
||||
import java.rmi.registry.LocateRegistry;
|
||||
|
|
@ -46,7 +45,6 @@ import mage.Constants.RangeOfInfluence;
|
|||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.chat.ChatPanel;
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.components.MageUI;
|
||||
import mage.client.game.GamePanel;
|
||||
import mage.client.util.Config;
|
||||
|
|
@ -130,6 +128,16 @@ public class Session {
|
|||
}
|
||||
}
|
||||
|
||||
public void ack(String message) {
|
||||
try {
|
||||
server.ack(message, sessionId);
|
||||
} catch (RemoteException ex) {
|
||||
handleRemoteException(ex);
|
||||
} catch (MageException ex) {
|
||||
handleMageException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isConnected() {
|
||||
return server != null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue