mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Refactoring to remove all superflous classes related to the server
GameServerThread --> MainServerThread All server classes consolidated into the gameServer package and all others removed tags: #story[1055] #refactor #fix
This commit is contained in:
@@ -1,9 +1,6 @@
|
|||||||
package seng302.controllers;
|
package seng302.controllers;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
@@ -13,11 +10,8 @@ import javafx.scene.layout.AnchorPane;
|
|||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.scene.text.Text;
|
import javafx.scene.text.Text;
|
||||||
import seng302.gameServer.GameServerThread;
|
|
||||||
import seng302.gameServer.GameStages;
|
import seng302.gameServer.GameStages;
|
||||||
import seng302.gameServer.GameState;
|
import seng302.gameServer.GameState;
|
||||||
import seng302.gameServerWithThreading.MainServerThread;
|
|
||||||
import seng302.gameServerWithThreading.ServerToClientThread;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class describing the actions of the lobby screen
|
* A class describing the actions of the lobby screen
|
||||||
@@ -32,7 +26,6 @@ public class LobbyController {
|
|||||||
@FXML
|
@FXML
|
||||||
private Text lobbyIpText;
|
private Text lobbyIpText;
|
||||||
|
|
||||||
private GameServerThread gameServerThread;
|
|
||||||
private static ObservableList competitors;
|
private static ObservableList competitors;
|
||||||
|
|
||||||
private void setContentPane(String jfxUrl) {
|
private void setContentPane(String jfxUrl) {
|
||||||
@@ -62,21 +55,12 @@ public class LobbyController {
|
|||||||
setContentPane("/views/StartScreenView.fxml");
|
setContentPane("/views/StartScreenView.fxml");
|
||||||
System.out.println("Leaving lobby!");
|
System.out.println("Leaving lobby!");
|
||||||
GameState.setCurrentStage(GameStages.CANCELLED);
|
GameState.setCurrentStage(GameStages.CANCELLED);
|
||||||
gameServerThread.terminateGame();
|
// TODO: 20/07/17 wmu16 - Implement some way of terminating the game
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void refreshCompetitors(){
|
|
||||||
Collection<String> competitorsIps = MainServerThread.getServerToClientThreads();
|
|
||||||
competitors.clear();
|
|
||||||
competitors.addAll(competitorsIps);
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void readyButtonPressed() {
|
public void readyButtonPressed() {
|
||||||
GameState.setCurrentStage(GameStages.RACING);
|
GameState.setCurrentStage(GameStages.RACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setGameServerThread(GameServerThread gameServerThread) {
|
|
||||||
this.gameServerThread = gameServerThread;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,4 +135,5 @@ public class MainServerThread extends Thread implements PacketBufferDelegate, Cl
|
|||||||
GameState.removePlayer(player);
|
GameState.removePlayer(player);
|
||||||
// sendXml();
|
// sendXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user