Fix enabled state of certain controls when mobile player joins or leaves server

This commit is contained in:
drdev
2015-06-13 18:24:54 +00:00
parent ff3bdcc676
commit b437d12892
3 changed files with 10 additions and 2 deletions

View File

@@ -111,6 +111,7 @@ public abstract class LobbyScreen extends LaunchScreen implements ILobbyView {
add(lblVariants);
cbVariants = add(new FComboBox<Object>());
cbVariants.setEnabled(lobby.hasControl());
cbVariants.setFont(VARIANTS_FONT);
cbVariants.addItem("(None)");
cbVariants.addItem(GameType.Vanguard);
@@ -160,7 +161,7 @@ public abstract class LobbyScreen extends LaunchScreen implements ILobbyView {
FThreads.invokeInEdtLater(new Runnable() {
@Override
public void run() {
btnStart.setEnabled(true);
btnStart.setEnabled(lobby.hasControl());
}
});
}
@@ -177,7 +178,12 @@ public abstract class LobbyScreen extends LaunchScreen implements ILobbyView {
protected void initLobby(GameLobby lobby0) {
lobby = lobby0;
lobby.setListener(this);
btnStart.setVisible(lobby.hasControl());
boolean hasControl = lobby.hasControl();
btnStart.setEnabled(hasControl);
if (cbVariants != null) {
cbVariants.setEnabled(hasControl);
}
}
private void updateVariantSelection() {

View File

@@ -604,6 +604,7 @@ public class PlayerPanel extends FContainer {
return isReady;
}
public void setIsReady(boolean isReady0) {
if (isReady == isReady0) { return; }
isReady = isReady0;
humanAiSwitch.setToggled(isReady);
}

View File

@@ -39,6 +39,7 @@ public final class ServerGameLobby extends GameLobby {
final LobbySlot slot = getSlot(index);
slot.setType(LobbySlotType.OPEN);
slot.setName(StringUtils.EMPTY);
slot.setIsReady(false);
updateView(false);
}