This commit is contained in:
Sem van der Hoeven
2020-06-07 14:50:29 +02:00
parent 360e2cb967
commit fd0c8ba765
3 changed files with 11 additions and 2 deletions

View File

@@ -353,10 +353,10 @@ public class MainGame extends Game implements ClientCallback {
@Override
public void onDataReceived(Data data) {
System.out.println("[MAINGAME CALLBACK] Got data: " + data.toString());
System.out.println("[MAINGAME" + this.username + "] Got data: " + data.toString());
if (data instanceof NameData) {
this.username = ((NameData) data).getName();
System.out.println("[MAINGAME CALLBACK] username is: " + username);
System.out.println("[MAINGAME" + this.username + "] username is: " + username);
} else if (data instanceof TeamData) {
// check if it is not our own message
if (!((TeamData) data).getUsername().equals(this.username)) {

View File

@@ -10,6 +10,7 @@ import com.badlogic.gdx.utils.TimeUtils;
import netwerkprog.game.client.MainGame;
import netwerkprog.game.client.game.GAMESTATE;
import netwerkprog.game.util.data.Data;
import netwerkprog.game.util.data.ReadyData;
import netwerkprog.game.util.data.TeamData;
import netwerkprog.game.util.game.Faction;
import netwerkprog.game.util.game.GameCharacter;
@@ -132,6 +133,7 @@ public class GameInputProcessor implements InputProcessor {
// camera.translate(-400, 0);
// mainGame.setGamestate(GAMESTATE.PLAYING);
}
mainGame.send(new ReadyData());
}
return false;

View File

@@ -0,0 +1,7 @@
package netwerkprog.game.util.data;
public class ReadyData extends Data {
public ReadyData() {
super("ready");
}
}