Add (for now nonfunctional) ready buttons to network lobby.

This commit is contained in:
elcnesh
2015-03-16 08:11:55 +00:00
parent 2094976b37
commit 82deb0c537
7 changed files with 66 additions and 14 deletions

View File

@@ -115,8 +115,8 @@ public abstract class GameLobby {
}
otherSlot.setIsArchenemy(becomesArchenemy);
}
updateView();
}
updateView();
}
public IGameController getController(final int index) {
@@ -134,7 +134,8 @@ public abstract class GameLobby {
public void addSlot() {
final int newIndex = getNumberOfSlots();
addSlot(new LobbySlot(allowNetworking ? LobbySlotType.OPEN : LobbySlotType.LOCAL, null, newIndex, newIndex, false, Collections.<AIOption>emptySet()));
final LobbySlotType type = allowNetworking ? LobbySlotType.OPEN : LobbySlotType.LOCAL;
addSlot(new LobbySlot(type, null, newIndex, newIndex, false, !allowNetworking, Collections.<AIOption>emptySet()));
}
protected final void addSlot(final LobbySlot slot) {
if (data.slots.size() >= MAX_PLAYERS) {

View File

@@ -18,15 +18,17 @@ public final class LobbySlot implements Serializable {
private int avatarIndex;
private int team;
private boolean isArchenemy;
private boolean isReady;
private Deck deck;
private ImmutableSet<AIOption> aiOptions;
public LobbySlot(final LobbySlotType type, final String name, final int avatarIndex, final int team, final boolean isArchenemy, final Set<AIOption> aiOptions) {
public LobbySlot(final LobbySlotType type, final String name, final int avatarIndex, final int team, final boolean isArchenemy, final boolean isReady, final Set<AIOption> aiOptions) {
this.type = type;
this.name = name;
this.avatarIndex = avatarIndex;
this.team = team;
this.isArchenemy = isArchenemy;
this.isReady = isReady;
this.setAiOptions(aiOptions);
}
@@ -46,6 +48,9 @@ public final class LobbySlot implements Serializable {
if (data.getArchenemy() != null) {
setIsArchenemy(data.getArchenemy().booleanValue());
}
if (data.getReady() != null) {
setIsReady(data.getReady().booleanValue());
}
if (data.getAiOptions() != null) {
setAiOptions(data.getAiOptions());
}
@@ -91,6 +96,13 @@ public final class LobbySlot implements Serializable {
this.isArchenemy = isArchenemy;
}
public boolean isReady() {
return isReady;
}
public void setIsReady(final boolean isReady) {
this.isReady = isReady;
}
public Deck getDeck() {
return deck;
}

View File

@@ -15,10 +15,10 @@ public final class LocalLobby extends GameLobby {
final String humanName = localName();
final int[] avatarIndices = localAvatarIndices();
final LobbySlot slot0 = new LobbySlot(LobbySlotType.LOCAL, humanName, avatarIndices[0], 0, true, Collections.<AIOption>emptySet());
final LobbySlot slot0 = new LobbySlot(LobbySlotType.LOCAL, humanName, avatarIndices[0], 0, true, true, Collections.<AIOption>emptySet());
addSlot(slot0);
final LobbySlot slot1 = new LobbySlot(LobbySlotType.AI, null, avatarIndices[1], 1, false, Collections.<AIOption>emptySet());
final LobbySlot slot1 = new LobbySlot(LobbySlotType.AI, null, avatarIndices[1], 1, false, true, Collections.<AIOption>emptySet());
addSlot(slot1);
}

View File

@@ -14,8 +14,8 @@ public final class ServerGameLobby extends GameLobby {
public ServerGameLobby() {
super(true);
addSlot(new LobbySlot(LobbySlotType.LOCAL, localName(), localAvatarIndices()[0], 0, true, Collections.<AIOption>emptySet()));
addSlot(new LobbySlot(LobbySlotType.OPEN, null, -1, 1, false, Collections.<AIOption>emptySet()));
addSlot(new LobbySlot(LobbySlotType.LOCAL, localName(), localAvatarIndices()[0], 0, true, false, Collections.<AIOption>emptySet()));
addSlot(new LobbySlot(LobbySlotType.OPEN, null, -1, 1, false, false, Collections.<AIOption>emptySet()));
}
public int connectPlayer(final String name, final int avatarIndex) {