Lobby no longer glitches out when a person disconnects and reconnects without restarting the program #story[1188]
This commit is contained in:
@@ -277,6 +277,7 @@ public class InGameLobbyController extends Controller {
|
|||||||
alert.setHeaderText("You are about to quit the race");
|
alert.setHeaderText("You are about to quit the race");
|
||||||
Optional<ButtonType> result = alert.showAndWait();
|
Optional<ButtonType> result = alert.showAndWait();
|
||||||
if(result.get() == ButtonType.OK){
|
if(result.get() == ButtonType.OK){
|
||||||
|
visualiserRaceEvent.terminate();
|
||||||
gameLobbyWrapper.setVisible(false);
|
gameLobbyWrapper.setVisible(false);
|
||||||
parent.enterTitle();
|
parent.enterTitle();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,8 +112,8 @@ public class VisualiserRaceEvent {
|
|||||||
* Terminates the server connection and race service.
|
* Terminates the server connection and race service.
|
||||||
*/
|
*/
|
||||||
public void terminate() {
|
public void terminate() {
|
||||||
this.serverConnectionThread.interrupt();
|
|
||||||
|
|
||||||
this.visualiserRaceServiceThread.interrupt();
|
this.visualiserRaceServiceThread.interrupt();
|
||||||
|
this.serverConnectionThread.interrupt();
|
||||||
|
serverConnection.terminate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -468,7 +468,15 @@ public class ServerConnection implements RunnableWithFramePeriod {
|
|||||||
this.visualiserRaceControllerThread.interrupt();
|
this.visualiserRaceControllerThread.interrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.socket != null) {
|
||||||
|
try {
|
||||||
|
this.socket.getInputStream().close();
|
||||||
|
this.socket.getOutputStream().close();
|
||||||
|
this.socket.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//TODO input controller?
|
//TODO input controller?
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user