Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,12 +12,12 @@ import java.util.Arrays;
|
|||||||
public class Client implements Runnable {
|
public class Client implements Runnable {
|
||||||
private final int port;
|
private final int port;
|
||||||
private final String hostname;
|
private final String hostname;
|
||||||
private boolean isConnected;
|
private final ClientCallback callback;
|
||||||
private Socket socket;
|
private Socket socket;
|
||||||
private Thread receiveThread;
|
|
||||||
private ClientCallback callback;
|
|
||||||
private ObjectOutputStream outputStream;
|
private ObjectOutputStream outputStream;
|
||||||
|
private Thread receiveThread;
|
||||||
private boolean connecting;
|
private boolean connecting;
|
||||||
|
private boolean isConnected;
|
||||||
|
|
||||||
public Client(String hostname, ClientCallback callback) {
|
public Client(String hostname, ClientCallback callback) {
|
||||||
this.port = Data.port();
|
this.port = Data.port();
|
||||||
@@ -67,8 +67,7 @@ public class Client implements Runnable {
|
|||||||
|
|
||||||
public void register(ObjectInputStream in) {
|
public void register(ObjectInputStream in) {
|
||||||
while (connecting) {
|
while (connecting) {
|
||||||
String username = "DEV";
|
writeData(new ConnectionData("Connect", "Request"));
|
||||||
writeData(new ConnectionData("Connect", username));
|
|
||||||
try {
|
try {
|
||||||
Object object = in.readObject();
|
Object object = in.readObject();
|
||||||
if (object instanceof Data) {
|
if (object instanceof Data) {
|
||||||
@@ -128,9 +127,7 @@ public class Client implements Runnable {
|
|||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
writeData(new ConnectionData("Disconnect", "Request"));
|
||||||
writeData(new ConnectionData("Disconnect", "DEV"));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.socket.close();
|
this.socket.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ public class ServerClient implements Runnable, DataSource {
|
|||||||
while (this.isConnected) {
|
while (this.isConnected) {
|
||||||
try {
|
try {
|
||||||
Object object = this.in.readObject();
|
Object object = this.in.readObject();
|
||||||
System.out.println("[SERVERCLIENT] got object " + object);
|
|
||||||
if (object instanceof Data) {
|
if (object instanceof Data) {
|
||||||
Data data = (Data) object;
|
Data data = (Data) object;
|
||||||
if (data.getPayload() instanceof ConnectionData) {
|
if (data.getPayload() instanceof ConnectionData) {
|
||||||
|
|||||||
Reference in New Issue
Block a user