MoveData Initial stuff

This commit is contained in:
MickWerf
2020-06-07 15:22:15 +02:00
parent 63b1f66567
commit 3adf271cfe
2 changed files with 23 additions and 13 deletions

View File

@@ -24,7 +24,9 @@ import netwerkprog.game.client.game.map.GameTile;
import netwerkprog.game.client.game.map.Map;
import netwerkprog.game.client.game.map.MapRenderer;
import netwerkprog.game.util.data.Data;
import netwerkprog.game.util.data.character.MoveData;
import netwerkprog.game.util.data.connection.NameData;
import netwerkprog.game.util.data.connection.ReadyData;
import netwerkprog.game.util.data.connection.TeamData;
import netwerkprog.game.util.game.Faction;
import netwerkprog.game.util.game.GameCharacter;
@@ -390,6 +392,13 @@ public class MainGame extends Game implements ClientCallback {
if (readyData.getUsername().equals(this.username)) {
}
} else if (data instanceof MoveData) {
MoveData moveData = (MoveData) data;
if (moveData.getUsername().equals(this.username)) {
moveData.getTile().visit();
} else {
moveData.getTile().visit();
}
}
}

View File

@@ -1,29 +1,30 @@
package netwerkprog.game.util.data.character;
import netwerkprog.game.client.game.map.GameTile;
import netwerkprog.game.util.data.Data;
public class MoveData extends Data {
private final String name;
private final int x;
private final int y;
private final String username;
private final String characterName;
private final GameTile tile;
public MoveData(String name, int x, int y) {
public MoveData(String username, String characterName, GameTile tile) {
super("Move");
super.setPayload(this);
this.name = name;
this.x = x;
this.y = y;
this.username = username;
this.characterName = characterName;
this.tile = tile;
}
public String getName() {
return name;
public String getUsername() {
return username;
}
public int getX() {
return x;
public String getCharacterName() {
return characterName;
}
public int getY() {
return y;
public GameTile getTile() {
return tile;
}
}