Merge remote-tracking branch 'origin/Application' into Application
This commit is contained in:
commit
39c0d4e52f
@ -31,8 +31,9 @@ public class HumanNPC extends Human {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a msg to the ServerGameInfoHandler.humanNpcParser to decide what has to happen now, if the
|
* Sends a msg to the ServerGameInfoHandler.humanNpcParser to decide what has to happen now, if
|
||||||
* npc hasn't been kicked off 8(should never happen to a human though)
|
* the npc hasn't been kicked off 8(should never happen to a human though)
|
||||||
|
*
|
||||||
* @param msg the message that is sent to this player.
|
* @param msg the message that is sent to this player.
|
||||||
* @param game the game the HumanNPC lives on (in game.gameState.passengerTrain)
|
* @param game the game the HumanNPC lives on (in game.gameState.passengerTrain)
|
||||||
*/
|
*/
|
||||||
@ -44,22 +45,23 @@ public class HumanNPC extends Human {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Currently returns a random integer for voting, but only for passengers that haven't been
|
* Currently returns a random integer for voting, but only for passengers that haven't been kicked
|
||||||
* kicked off yet
|
* off yet
|
||||||
|
*
|
||||||
* @param game the game this NPC lives on
|
* @param game the game this NPC lives on
|
||||||
*/
|
*/
|
||||||
public void vote(Game game) {
|
public void vote(Game game) {
|
||||||
Passenger[] passengers = game.getGameState().getPassengerTrain();
|
Passenger[] passengers = game.getGameState().getPassengerTrain();
|
||||||
int kickedOffCounter = 0;
|
int kickedOffCounter = 0;
|
||||||
for(Passenger passenger : passengers) {
|
for (Passenger passenger : passengers) {
|
||||||
if(passenger.getKickedOff()) {
|
if (passenger.getKickedOff()) {
|
||||||
kickedOffCounter++;
|
kickedOffCounter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int[] inGamePositions = new int[passengers.length - kickedOffCounter];
|
int[] inGamePositions = new int[passengers.length - kickedOffCounter];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(Passenger passenger : passengers) {
|
for (Passenger passenger : passengers) {
|
||||||
if(!passenger.getKickedOff()) {
|
if (!passenger.getKickedOff()) {
|
||||||
inGamePositions[i] = passenger.getPosition();
|
inGamePositions[i] = passenger.getPosition();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -67,7 +69,7 @@ public class HumanNPC extends Human {
|
|||||||
int randomNr = (int) (Math.random() * inGamePositions.length);
|
int randomNr = (int) (Math.random() * inGamePositions.length);
|
||||||
vote = inGamePositions[randomNr];
|
vote = inGamePositions[randomNr];
|
||||||
hasVoted = true;
|
hasVoted = true;
|
||||||
game.getGameState().getClientVoteData().setHasVoted(position,hasVoted);
|
game.getGameState().getClientVoteData().setHasVoted(position, hasVoted);
|
||||||
LOGGER.info("HumanNPC at Position: " + this.getPosition() + " has voted for: " + vote);
|
LOGGER.info("HumanNPC at Position: " + this.getPosition() + " has voted for: " + vote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -400,6 +400,8 @@ public class Client {
|
|||||||
case GuiParameters.newLobbyCreated:
|
case GuiParameters.newLobbyCreated:
|
||||||
makeNewLobby(data);
|
makeNewLobby(data);
|
||||||
break;
|
break;
|
||||||
|
case GuiParameters.newPlayerOnServer:
|
||||||
|
addNewPlayerToGui(data);
|
||||||
default:
|
default:
|
||||||
notificationTextDisplay(data);
|
notificationTextDisplay(data);
|
||||||
//TODO(Sebi,Seraina): should the gameController be in the Application just like the ChatController?
|
//TODO(Sebi,Seraina): should the gameController be in the Application just like the ChatController?
|
||||||
@ -412,17 +414,22 @@ public class Client {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addNewPlayerToGui(String data) {
|
||||||
|
loungeSceneViewController.addClientToList(data);
|
||||||
|
LOGGER.debug("addNewPlayerToGui() seems to have finished");
|
||||||
|
}
|
||||||
|
|
||||||
private void makeNewLobby(String data) {
|
private void makeNewLobby(String data) {
|
||||||
String[] params = data.split(":");
|
String[] params = data.split(":");
|
||||||
loungeSceneViewController.newLobby(params[0], params[1]);
|
loungeSceneViewController.newLobby(params[0], params[1]);
|
||||||
LOGGER.debug("makeNewLobby() seems to have finnished");
|
LOGGER.debug("makeNewLobby() seems to have finished");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPlayerToLobby(String data) {
|
private void addPlayerToLobby(String data) {
|
||||||
String[] params = data.split(":");
|
String[] params = data.split(":");
|
||||||
loungeSceneViewController.addPlayerToLobby(params[0], params[1]);
|
loungeSceneViewController.addPlayerToLobby(params[0], params[1]);
|
||||||
LOGGER.debug("addPlayerToLobby() seems to have finnished");
|
LOGGER.debug("addPlayerToLobby() seems to have finished");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLobbyMembers(String data) {
|
private void updateLobbyMembers(String data) {
|
||||||
|
|||||||
@ -27,7 +27,8 @@ import javafx.scene.text.TextFlow;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
public class GameController implements Initializable{
|
public class GameController implements Initializable {
|
||||||
|
|
||||||
public static final Logger LOGGER = LogManager.getLogger(GameController.class);
|
public static final Logger LOGGER = LogManager.getLogger(GameController.class);
|
||||||
public static final BudaLogConfig l = new BudaLogConfig(LOGGER);
|
public static final BudaLogConfig l = new BudaLogConfig(LOGGER);
|
||||||
|
|
||||||
@ -39,6 +40,7 @@ public class GameController implements Initializable{
|
|||||||
public GameController() {
|
public GameController() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO(Seraina, Sebi): Same issue as ChatController? do with setters?
|
//TODO(Seraina, Sebi): Same issue as ChatController? do with setters?
|
||||||
public GameController(ClientModel c, GameStateModel g) {
|
public GameController(ClientModel c, GameStateModel g) {
|
||||||
client = c;
|
client = c;
|
||||||
@ -173,11 +175,12 @@ public class GameController implements Initializable{
|
|||||||
LOGGER.info("Do you even get here");
|
LOGGER.info("Do you even get here");
|
||||||
LOGGER.info(client.getClient());
|
LOGGER.info(client.getClient());
|
||||||
LOGGER.info(client.getClient().getPosition());
|
LOGGER.info(client.getClient().getPosition());
|
||||||
if(client.getClient() == null) {
|
if (client.getClient() == null) {
|
||||||
LOGGER.info("But why???");
|
LOGGER.info("But why???");
|
||||||
}
|
}
|
||||||
client.getClient().sendMsgToServer(
|
client.getClient().sendMsgToServer(
|
||||||
Protocol.sendMessageToAllClients + "$" + Protocol.printToGUI + "$" +GuiParameters.noiseHeardAtPosition + "$"
|
Protocol.sendMessageToAllClients + "$" + Protocol.printToGUI + "$"
|
||||||
|
+ GuiParameters.noiseHeardAtPosition + "$"
|
||||||
+ client.getClient().getPosition()); //TODO: Test!!
|
+ client.getClient().getPosition()); //TODO: Test!!
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,14 +194,15 @@ public class GameController implements Initializable{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes a given message and displays it in the notificationText Flow in the game Scene
|
* Takes a given message and displays it in the notificationText Flow in the game Scene
|
||||||
|
*
|
||||||
* @param msg the message to be displayed
|
* @param msg the message to be displayed
|
||||||
*/
|
*/
|
||||||
public void addMessageToNotificationText(String msg){
|
public void addMessageToNotificationText(String msg) {
|
||||||
LOGGER.trace("addMessage " + msg);
|
LOGGER.trace("addMessage " + msg);
|
||||||
Text notification = new Text(msg);
|
Text notification = new Text(msg);
|
||||||
notification.setFill(Color.BLACK);
|
notification.setFill(Color.BLACK);
|
||||||
notification.setStyle("-fx-font: 50 arial;");
|
notification.setStyle("-fx-font: 50 arial;");
|
||||||
Platform.runLater(new Runnable(){
|
Platform.runLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
@ -217,7 +221,7 @@ public class GameController implements Initializable{
|
|||||||
*/
|
*/
|
||||||
public void clearNotificationText() {
|
public void clearNotificationText() {
|
||||||
LOGGER.trace("clear notify");
|
LOGGER.trace("clear notify");
|
||||||
Platform.runLater(new Runnable(){
|
Platform.runLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
@ -257,7 +261,7 @@ public class GameController implements Initializable{
|
|||||||
name5.setStyle("-fx-font: 25 arial;");
|
name5.setStyle("-fx-font: 25 arial;");
|
||||||
name5.setFill(Color.WHITE);
|
name5.setFill(Color.WHITE);
|
||||||
Text role0;
|
Text role0;
|
||||||
if(kickedOff[0]) {
|
if (kickedOff[0]) {
|
||||||
role0 = new Text("\nkicked off");
|
role0 = new Text("\nkicked off");
|
||||||
} else {
|
} else {
|
||||||
role0 = new Text("\n" + roles[0]);
|
role0 = new Text("\n" + roles[0]);
|
||||||
@ -265,7 +269,7 @@ public class GameController implements Initializable{
|
|||||||
role0.setStyle("-fx-font: 25 arial;");
|
role0.setStyle("-fx-font: 25 arial;");
|
||||||
role0.setFill(Color.WHITE);
|
role0.setFill(Color.WHITE);
|
||||||
Text role1;
|
Text role1;
|
||||||
if(kickedOff[1]) {
|
if (kickedOff[1]) {
|
||||||
role1 = new Text("\nkicked off");
|
role1 = new Text("\nkicked off");
|
||||||
} else {
|
} else {
|
||||||
role1 = new Text("\n" + roles[1]);
|
role1 = new Text("\n" + roles[1]);
|
||||||
@ -273,7 +277,7 @@ public class GameController implements Initializable{
|
|||||||
role1.setStyle("-fx-font: 25 arial;");
|
role1.setStyle("-fx-font: 25 arial;");
|
||||||
role1.setFill(Color.WHITE);
|
role1.setFill(Color.WHITE);
|
||||||
Text role2;
|
Text role2;
|
||||||
if(kickedOff[2]) {
|
if (kickedOff[2]) {
|
||||||
role2 = new Text("\nkicked off");
|
role2 = new Text("\nkicked off");
|
||||||
} else {
|
} else {
|
||||||
role2 = new Text("\n" + roles[2]);
|
role2 = new Text("\n" + roles[2]);
|
||||||
@ -281,7 +285,7 @@ public class GameController implements Initializable{
|
|||||||
role2.setStyle("-fx-font: 25 arial;");
|
role2.setStyle("-fx-font: 25 arial;");
|
||||||
role2.setFill(Color.WHITE);
|
role2.setFill(Color.WHITE);
|
||||||
Text role3;
|
Text role3;
|
||||||
if(kickedOff[3]) {
|
if (kickedOff[3]) {
|
||||||
role3 = new Text("\nkicked off");
|
role3 = new Text("\nkicked off");
|
||||||
} else {
|
} else {
|
||||||
role3 = new Text("\n" + roles[3]);
|
role3 = new Text("\n" + roles[3]);
|
||||||
@ -289,7 +293,7 @@ public class GameController implements Initializable{
|
|||||||
role3.setStyle("-fx-font: 25 arial;");
|
role3.setStyle("-fx-font: 25 arial;");
|
||||||
role3.setFill(Color.WHITE);
|
role3.setFill(Color.WHITE);
|
||||||
Text role4;
|
Text role4;
|
||||||
if(kickedOff[4]) {
|
if (kickedOff[4]) {
|
||||||
role4 = new Text("\nkicked off");
|
role4 = new Text("\nkicked off");
|
||||||
} else {
|
} else {
|
||||||
role4 = new Text("\n" + roles[4]);
|
role4 = new Text("\n" + roles[4]);
|
||||||
@ -297,7 +301,7 @@ public class GameController implements Initializable{
|
|||||||
role4.setStyle("-fx-font: 25 arial;");
|
role4.setStyle("-fx-font: 25 arial;");
|
||||||
role4.setFill(Color.WHITE);
|
role4.setFill(Color.WHITE);
|
||||||
Text role5;
|
Text role5;
|
||||||
if(kickedOff[5]) {
|
if (kickedOff[5]) {
|
||||||
role5 = new Text("\nkicked off");
|
role5 = new Text("\nkicked off");
|
||||||
} else {
|
} else {
|
||||||
role5 = new Text("\n" + roles[5]);
|
role5 = new Text("\n" + roles[5]);
|
||||||
@ -305,7 +309,7 @@ public class GameController implements Initializable{
|
|||||||
role5.setStyle("-fx-font: 25 arial;");
|
role5.setStyle("-fx-font: 25 arial;");
|
||||||
role5.setFill(Color.WHITE);
|
role5.setFill(Color.WHITE);
|
||||||
|
|
||||||
Platform.runLater(new Runnable(){
|
Platform.runLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
@ -334,7 +338,7 @@ public class GameController implements Initializable{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image loadBellImage(){
|
public Image loadBellImage() {
|
||||||
Image bell = new Image("ch/unibas/dmi/dbis/cs108/multiplayer/client/gui/game/DayOpen/bell.png");
|
Image bell = new Image("ch/unibas/dmi/dbis/cs108/multiplayer/client/gui/game/DayOpen/bell.png");
|
||||||
return bell;
|
return bell;
|
||||||
}
|
}
|
||||||
@ -342,9 +346,9 @@ public class GameController implements Initializable{
|
|||||||
/**
|
/**
|
||||||
* Adds an image of a bell on top of button0
|
* Adds an image of a bell on top of button0
|
||||||
*/
|
*/
|
||||||
public void noiseDisplay0(){
|
public void noiseDisplay0() {
|
||||||
LOGGER.debug("noise0 called");
|
LOGGER.debug("noise0 called");
|
||||||
Platform.runLater(new Runnable(){
|
Platform.runLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
@ -360,9 +364,9 @@ public class GameController implements Initializable{
|
|||||||
/**
|
/**
|
||||||
* Adds an image of a bell on top of button1
|
* Adds an image of a bell on top of button1
|
||||||
*/
|
*/
|
||||||
public void noiseDisplay1(){
|
public void noiseDisplay1() {
|
||||||
LOGGER.debug("noise1 called");
|
LOGGER.debug("noise1 called");
|
||||||
Platform.runLater(new Runnable(){
|
Platform.runLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
@ -377,15 +381,16 @@ public class GameController implements Initializable{
|
|||||||
/**
|
/**
|
||||||
* Adds an image of a bell on top of button2
|
* Adds an image of a bell on top of button2
|
||||||
*/
|
*/
|
||||||
public void noiseDisplay2(){
|
public void noiseDisplay2() {
|
||||||
LOGGER.debug("noise2 called");
|
LOGGER.debug("noise2 called");
|
||||||
Platform.runLater(new Runnable(){
|
Platform.runLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
noiseImage2.setImage(loadBellImage());
|
noiseImage2.setImage(loadBellImage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.debug(e.getMessage());;
|
LOGGER.debug(e.getMessage());
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -432,7 +437,7 @@ public class GameController implements Initializable{
|
|||||||
*/
|
*/
|
||||||
public void noiseDisplay5() {
|
public void noiseDisplay5() {
|
||||||
LOGGER.debug("noise5 called");
|
LOGGER.debug("noise5 called");
|
||||||
Platform.runLater(new Runnable(){
|
Platform.runLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
@ -448,7 +453,7 @@ public class GameController implements Initializable{
|
|||||||
* Clears all bells from the view
|
* Clears all bells from the view
|
||||||
*/
|
*/
|
||||||
public void clearAllNoiseDisplay() {
|
public void clearAllNoiseDisplay() {
|
||||||
Platform.runLater(new Runnable(){
|
Platform.runLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -9,6 +9,7 @@ public class ClientListItem {
|
|||||||
private final int id;
|
private final int id;
|
||||||
|
|
||||||
private static int uid = 0;
|
private static int uid = 0;
|
||||||
|
|
||||||
public ClientListItem(String name, int id) {
|
public ClientListItem(String name, int id) {
|
||||||
this.name = new SimpleStringProperty(name);
|
this.name = new SimpleStringProperty(name);
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -19,7 +20,7 @@ public class ClientListItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
public String toString() {
|
||||||
return name + " ID: " + id;
|
return name + " ID: " + id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,8 +26,7 @@ public class LobbyListItem {
|
|||||||
private final int MAX_CAPACITY = 6;
|
private final int MAX_CAPACITY = 6;
|
||||||
private SimpleIntegerProperty noOfPlayersInLobby;
|
private SimpleIntegerProperty noOfPlayersInLobby;
|
||||||
|
|
||||||
public LobbyListItem(SimpleStringProperty lobbyID,
|
public LobbyListItem(SimpleStringProperty lobbyID, SimpleStringProperty adminName,
|
||||||
SimpleStringProperty adminName,
|
|
||||||
SimpleBooleanProperty ownedByClient, SimpleBooleanProperty isOpen,
|
SimpleBooleanProperty ownedByClient, SimpleBooleanProperty isOpen,
|
||||||
SimpleIntegerProperty noOfPlayersInLobby) {
|
SimpleIntegerProperty noOfPlayersInLobby) {
|
||||||
this.lobbyID = lobbyID;
|
this.lobbyID = lobbyID;
|
||||||
@ -66,8 +65,7 @@ public class LobbyListItem {
|
|||||||
return clientsInLobby;
|
return clientsInLobby;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClientsInLobby(
|
public void setClientsInLobby(ObservableList<SimpleStringProperty> clientsInLobby) {
|
||||||
ObservableList<SimpleStringProperty> clientsInLobby) {
|
|
||||||
this.clientsInLobby = clientsInLobby;
|
this.clientsInLobby = clientsInLobby;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,14 +111,9 @@ public class LobbyListItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "LobbyListItem{" +
|
return "LobbyListItem{" + "lobbyID=" + lobbyID + ", adminName=" + adminName
|
||||||
"lobbyID=" + lobbyID +
|
+ ", clientsInLobby=" + clientsInLobby + ", ownedByClient=" + ownedByClient + ", isOpen="
|
||||||
", adminName=" + adminName +
|
+ isOpen + ", MAX_CAPACITY=" + MAX_CAPACITY + ", noOfPlayersInLobby=" + noOfPlayersInLobby
|
||||||
", clientsInLobby=" + clientsInLobby +
|
+ '}';
|
||||||
", ownedByClient=" + ownedByClient +
|
|
||||||
", isOpen=" + isOpen +
|
|
||||||
", MAX_CAPACITY=" + MAX_CAPACITY +
|
|
||||||
", noOfPlayersInLobby=" + noOfPlayersInLobby +
|
|
||||||
'}';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -339,15 +339,6 @@ public class LoungeSceneViewController implements Initializable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateClientListView(ObservableList<ClientListItem> names) {
|
|
||||||
ObservableList<ClientListItem> clientsLeft = ClientListView.getItems();
|
|
||||||
clientsLeft.removeAll(names);
|
|
||||||
this.ClientListView.setItems(names);
|
|
||||||
for (ClientListItem gone : clientsLeft) {
|
|
||||||
//TODO
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds players to a lobby
|
* Adds players to a lobby
|
||||||
* "NMEMB" {@link ch.unibas.dmi.dbis.cs108.multiplayer.helpers.GuiParameters}
|
* "NMEMB" {@link ch.unibas.dmi.dbis.cs108.multiplayer.helpers.GuiParameters}
|
||||||
@ -439,6 +430,20 @@ public class LoungeSceneViewController implements Initializable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeClientFromList(String name){
|
||||||
|
Iterator<ClientListItem> it = clients.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
String uid = it.next().getName();
|
||||||
|
if (uid.equals(name)) {
|
||||||
|
it.remove();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} }
|
||||||
|
|
||||||
|
public void removeClientFromLobby(String s){
|
||||||
|
//todo
|
||||||
|
}
|
||||||
|
|
||||||
public void newGame() {
|
public void newGame() {
|
||||||
client.getClient().sendMsgToServer(Protocol.createNewLobby);
|
client.getClient().sendMsgToServer(Protocol.createNewLobby);
|
||||||
}
|
}
|
||||||
@ -457,17 +462,6 @@ public class LoungeSceneViewController implements Initializable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePlayer(String id) {
|
|
||||||
Iterator<SimpleStringProperty> it = client.getAllClients().iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
String uid = it.next().getValue();
|
|
||||||
if (uid.equals(id)) {
|
|
||||||
it.remove();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility to set the client model for this class
|
* Utility to set the client model for this class
|
||||||
*
|
*
|
||||||
|
|||||||
@ -79,4 +79,10 @@ public class GuiParameters {
|
|||||||
* Indicates a player has joined the server. Form: {@code NPLOS$<playerName>}
|
* Indicates a player has joined the server. Form: {@code NPLOS$<playerName>}
|
||||||
*/
|
*/
|
||||||
public static final String newPlayerOnServer = "NPLOS";
|
public static final String newPlayerOnServer = "NPLOS";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells gui to remove a certain player from the list of clients based on user name. Form: {@code
|
||||||
|
* RMVLST$<playerName>}
|
||||||
|
*/
|
||||||
|
public static final String removePlayerFromList = "RMVLST";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -475,8 +475,9 @@ public class ClientHandler implements Runnable {
|
|||||||
public void createNewLobby() {
|
public void createNewLobby() {
|
||||||
if (Lobby.clientIsInLobby(this) == -1) {
|
if (Lobby.clientIsInLobby(this) == -1) {
|
||||||
Lobby newGame = new Lobby(this);
|
Lobby newGame = new Lobby(this);
|
||||||
guiUpdateAll(Protocol.printToGUI + "$" + GuiParameters.newLobbyCreated + "$" + getLobby()
|
guiUpdateAll(
|
||||||
.getLobbyID() + ":" + getClientUserName());
|
Protocol.printToGUI + "$" + GuiParameters.newLobbyCreated + "$" + getLobby().getLobbyID()
|
||||||
|
+ ":" + getClientUserName());
|
||||||
LOGGER.debug("Lobby: " + getLobby().getLobbyID() + ". In method createNewLobby()");
|
LOGGER.debug("Lobby: " + getLobby().getLobbyID() + ". In method createNewLobby()");
|
||||||
} else {
|
} else {
|
||||||
sendAnnouncementToClient("You are already in lobby nr. " + Lobby.clientIsInLobby(this));
|
sendAnnouncementToClient("You are already in lobby nr. " + Lobby.clientIsInLobby(this));
|
||||||
|
|||||||
@ -65,6 +65,7 @@ public class JServerProtocolParser {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
h.setUsernameOnLogin("U.N. Owen");
|
h.setUsernameOnLogin("U.N. Owen");
|
||||||
}
|
}
|
||||||
|
h.guiUpdateAll(Protocol.printToGUI+"$"+GuiParameters.newPlayerOnServer+"$"+h.getClientUserName());
|
||||||
break;
|
break;
|
||||||
case Protocol.nameChange:
|
case Protocol.nameChange:
|
||||||
h.changeUsername(msg.substring(6));
|
h.changeUsername(msg.substring(6));
|
||||||
|
|||||||
Reference in New Issue
Block a user