Merge remote-tracking branch 'origin/master'

This commit is contained in:
Sem van der Hoeven
2020-06-07 17:16:19 +02:00
5 changed files with 5 additions and 40 deletions

View File

@@ -1,11 +0,0 @@
package netwerkprog.game.client.game.characters;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import netwerkprog.game.util.game.Faction;
import netwerkprog.game.util.game.GameCharacter;
public class DevTest1 extends GameCharacter {
public DevTest1() {
super("DevTest1", Faction.HACKER, new TextureRegion());
}
}

View File

@@ -1,10 +0,0 @@
package netwerkprog.game.client.game.characters;
import netwerkprog.game.util.game.Faction;
import netwerkprog.game.util.game.GameCharacter;
public class DevTest2 extends GameCharacter {
public DevTest2() {
super("DevTest2", Faction.MEGACORPORATION, null);
}
}

View File

@@ -1,10 +0,0 @@
package netwerkprog.game.client.game.characters;
import netwerkprog.game.util.game.Faction;
import netwerkprog.game.util.game.GameCharacter;
public class DevTest3 extends GameCharacter {
public DevTest3() {
super("DevTest3", Faction.AI, null);
}
}

View File

@@ -12,12 +12,12 @@ import java.util.Arrays;
public class Client implements Runnable {
private final int port;
private final String hostname;
private boolean isConnected;
private final ClientCallback callback;
private Socket socket;
private Thread receiveThread;
private ClientCallback callback;
private ObjectOutputStream outputStream;
private Thread receiveThread;
private boolean connecting;
private boolean isConnected;
public Client(String hostname, ClientCallback callback) {
this.port = Data.port();
@@ -67,8 +67,7 @@ public class Client implements Runnable {
public void register(ObjectInputStream in) {
while (connecting) {
String username = "DEV";
writeData(new ConnectionData("Connect", username));
writeData(new ConnectionData("Connect", "Request"));
try {
Object object = in.readObject();
if (object instanceof Data) {
@@ -128,9 +127,7 @@ public class Client implements Runnable {
} catch (InterruptedException e) {
e.printStackTrace();
}
writeData(new ConnectionData("Disconnect", "DEV"));
writeData(new ConnectionData("Disconnect", "Request"));
try {
this.socket.close();
} catch (IOException e) {

View File

@@ -41,7 +41,6 @@ public class ServerClient implements Runnable, DataSource {
while (this.isConnected) {
try {
Object object = this.in.readObject();
System.out.println("[SERVERCLIENT] got object " + object);
if (object instanceof Data) {
Data data = (Data) object;
if (data.getPayload() instanceof ConnectionData) {