mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38: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);
|
add(lblVariants);
|
||||||
cbVariants = add(new FComboBox<Object>());
|
cbVariants = add(new FComboBox<Object>());
|
||||||
|
cbVariants.setEnabled(lobby.hasControl());
|
||||||
cbVariants.setFont(VARIANTS_FONT);
|
cbVariants.setFont(VARIANTS_FONT);
|
||||||
cbVariants.addItem("(None)");
|
cbVariants.addItem("(None)");
|
||||||
cbVariants.addItem(GameType.Vanguard);
|
cbVariants.addItem(GameType.Vanguard);
|
||||||
@@ -160,7 +161,7 @@ public abstract class LobbyScreen extends LaunchScreen implements ILobbyView {
|
|||||||
FThreads.invokeInEdtLater(new Runnable() {
|
FThreads.invokeInEdtLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
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) {
|
protected void initLobby(GameLobby lobby0) {
|
||||||
lobby = lobby0;
|
lobby = lobby0;
|
||||||
lobby.setListener(this);
|
lobby.setListener(this);
|
||||||
btnStart.setVisible(lobby.hasControl());
|
|
||||||
|
boolean hasControl = lobby.hasControl();
|
||||||
|
btnStart.setEnabled(hasControl);
|
||||||
|
if (cbVariants != null) {
|
||||||
|
cbVariants.setEnabled(hasControl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateVariantSelection() {
|
private void updateVariantSelection() {
|
||||||
|
|||||||
@@ -604,6 +604,7 @@ public class PlayerPanel extends FContainer {
|
|||||||
return isReady;
|
return isReady;
|
||||||
}
|
}
|
||||||
public void setIsReady(boolean isReady0) {
|
public void setIsReady(boolean isReady0) {
|
||||||
|
if (isReady == isReady0) { return; }
|
||||||
isReady = isReady0;
|
isReady = isReady0;
|
||||||
humanAiSwitch.setToggled(isReady);
|
humanAiSwitch.setToggled(isReady);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public final class ServerGameLobby extends GameLobby {
|
|||||||
final LobbySlot slot = getSlot(index);
|
final LobbySlot slot = getSlot(index);
|
||||||
slot.setType(LobbySlotType.OPEN);
|
slot.setType(LobbySlotType.OPEN);
|
||||||
slot.setName(StringUtils.EMPTY);
|
slot.setName(StringUtils.EMPTY);
|
||||||
|
slot.setIsReady(false);
|
||||||
updateView(false);
|
updateView(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user