mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Fix enabled state of certain controls when mobile player joins or leaves server
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user