Add new round state
This commit is contained in:
parent
2f33036837
commit
490c03d7b4
@ -9,7 +9,8 @@ public interface NetworkListener {
|
||||
public static final int
|
||||
ON_CONNECT = 1,
|
||||
ON_SEED_RECEIVED = 2,
|
||||
ON_MOVE_RECEIVED = 3;
|
||||
ON_MOVE_RECEIVED = 3,
|
||||
ON_NEW_ROUND = 4;
|
||||
|
||||
public void onStatusChanged(int status, Object data);
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ public class SocketHelper extends Thread {
|
||||
final int status = dis.readInt();
|
||||
switch (status) {
|
||||
case NetworkListener.ON_SEED_RECEIVED:
|
||||
case NetworkListener.ON_NEW_ROUND:
|
||||
listener.onStatusChanged(status, receiveSeed());
|
||||
break;
|
||||
case NetworkListener.ON_MOVE_RECEIVED:
|
||||
@ -76,6 +77,13 @@ public class SocketHelper extends Thread {
|
||||
return t;
|
||||
}
|
||||
|
||||
public void sendNewRoundSeed(long seed) {
|
||||
try {
|
||||
dos.writeInt(NetworkListener.ON_NEW_ROUND);
|
||||
dos.writeLong(seed);
|
||||
} catch (IOException ex) {}
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
if (dis != null) dis.close();
|
||||
if (dos != null) dos.close();
|
||||
|
Loading…
Reference in New Issue
Block a user