mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Tweak how mobile user sets that they're ready
This commit is contained in:
@@ -245,9 +245,6 @@ public abstract class LobbyScreen extends LaunchScreen implements ILobbyView {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startMatch() {
|
protected void startMatch() {
|
||||||
if (lobby.isAllowNetworking()) { //flag that player 1 is ready when Start button tapped
|
|
||||||
lobby.getSlot(0).setIsReady(true);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < getNumPlayers(); i++) {
|
for (int i = 0; i < getNumPlayers(); i++) {
|
||||||
updateDeck(i);
|
updateDeck(i);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class PlayerPanel extends FContainer {
|
|||||||
private int avatarIndex;
|
private int avatarIndex;
|
||||||
|
|
||||||
private final FTextField txtPlayerName = new FTextField("Player name");
|
private final FTextField txtPlayerName = new FTextField("Player name");
|
||||||
private final FToggleSwitch humanAiSwitch = new FToggleSwitch("Human", "AI");
|
private final FToggleSwitch humanAiSwitch;
|
||||||
|
|
||||||
private FComboBox<Object> cbTeam = new FComboBox<Object>();
|
private FComboBox<Object> cbTeam = new FComboBox<Object>();
|
||||||
private FComboBox<Object> cbArchenemyTeam = new FComboBox<Object>();
|
private FComboBox<Object> cbArchenemyTeam = new FComboBox<Object>();
|
||||||
@@ -80,6 +80,12 @@ public class PlayerPanel extends FContainer {
|
|||||||
super();
|
super();
|
||||||
screen = screen0;
|
screen = screen0;
|
||||||
allowNetworking = allowNetworking0;
|
allowNetworking = allowNetworking0;
|
||||||
|
if (allowNetworking) {
|
||||||
|
humanAiSwitch = new FToggleSwitch("Not Ready", "Ready");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
humanAiSwitch = new FToggleSwitch("Human", "AI");
|
||||||
|
}
|
||||||
index = index0;
|
index = index0;
|
||||||
populateTeamsComboBoxes();
|
populateTeamsComboBoxes();
|
||||||
setTeam(slot.getTeam());
|
setTeam(slot.getTeam());
|
||||||
@@ -284,22 +290,13 @@ public class PlayerPanel extends FContainer {
|
|||||||
private final FEventHandler humanAiSwitched = new FEventHandler() {
|
private final FEventHandler humanAiSwitched = new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
boolean wasAi = isAi();
|
boolean toggled = humanAiSwitch.isToggled();
|
||||||
boolean isAi = humanAiSwitch.isToggled();
|
if (allowNetworking) {
|
||||||
if (isAi) {
|
setIsReady(toggled);
|
||||||
type = LobbySlotType.AI;
|
|
||||||
}
|
|
||||||
else if (allowNetworking && index > 0) {
|
|
||||||
type = isReady ? LobbySlotType.REMOTE : LobbySlotType.OPEN;
|
|
||||||
humanAiSwitch.setOffText(isReady ? "Ready" : "Open");
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
type = LobbySlotType.LOCAL;
|
type = toggled ? LobbySlotType.AI : LobbySlotType.LOCAL;
|
||||||
}
|
onIsAiChanged(toggled);
|
||||||
|
|
||||||
if (wasAi != isAi) {
|
|
||||||
onIsAiChanged(isAi);
|
|
||||||
}
|
|
||||||
|
|
||||||
LobbySlot slot = screen.getLobby().getSlot(index);
|
LobbySlot slot = screen.getLobby().getSlot(index);
|
||||||
slot.setType(type);
|
slot.setType(type);
|
||||||
@@ -309,6 +306,7 @@ public class PlayerPanel extends FContainer {
|
|||||||
setAvatarIndex(slot.getAvatarIndex());
|
setAvatarIndex(slot.getAvatarIndex());
|
||||||
setPlayerName(slot.getName());
|
setPlayerName(slot.getName());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private void onIsAiChanged(boolean isAi) {
|
private void onIsAiChanged(boolean isAi) {
|
||||||
@@ -552,12 +550,11 @@ public class PlayerPanel extends FContainer {
|
|||||||
humanAiSwitch.setToggled(true);
|
humanAiSwitch.setToggled(true);
|
||||||
break;
|
break;
|
||||||
case OPEN:
|
case OPEN:
|
||||||
humanAiSwitch.setOffText("Open");
|
isReady = false;
|
||||||
humanAiSwitch.setToggled(false);
|
humanAiSwitch.setToggled(false);
|
||||||
break;
|
break;
|
||||||
case REMOTE:
|
case REMOTE:
|
||||||
humanAiSwitch.setOffText("Ready");
|
humanAiSwitch.setToggled(isReady);
|
||||||
humanAiSwitch.setToggled(false);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -597,11 +594,8 @@ 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;
|
||||||
|
humanAiSwitch.setToggled(isReady);
|
||||||
if (type == LobbySlotType.LOCAL) {
|
|
||||||
humanAiSwitch.setOffText(isReady ? "Ready" : "Human");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMayEdit(boolean mayEdit0) {
|
public void setMayEdit(boolean mayEdit0) {
|
||||||
@@ -610,6 +604,7 @@ public class PlayerPanel extends FContainer {
|
|||||||
avatarLabel.setEnabled(mayEdit);
|
avatarLabel.setEnabled(mayEdit);
|
||||||
txtPlayerName.setEnabled(mayEdit);
|
txtPlayerName.setEnabled(mayEdit);
|
||||||
nameRandomiser.setEnabled(mayEdit);
|
nameRandomiser.setEnabled(mayEdit);
|
||||||
|
humanAiSwitch.setEnabled(mayEdit && mayControl);
|
||||||
updateVariantControlsVisibility();
|
updateVariantControlsVisibility();
|
||||||
|
|
||||||
//if panel has height already, ensure height updated to account for button visibility changes
|
//if panel has height already, ensure height updated to account for button visibility changes
|
||||||
@@ -621,7 +616,7 @@ public class PlayerPanel extends FContainer {
|
|||||||
public void setMayControl(boolean mayControl0) {
|
public void setMayControl(boolean mayControl0) {
|
||||||
if (mayControl == mayControl0) { return; }
|
if (mayControl == mayControl0) { return; }
|
||||||
mayControl = mayControl0;
|
mayControl = mayControl0;
|
||||||
humanAiSwitch.setEnabled(mayControl);
|
humanAiSwitch.setEnabled(mayEdit && mayControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMayRemove(boolean mayRemove0) {
|
public void setMayRemove(boolean mayRemove0) {
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ public abstract class GameLobby {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data.slots.add(slot);
|
data.slots.add(slot);
|
||||||
if (StringUtils.isEmpty(slot.getName())) {
|
if (StringUtils.isEmpty(slot.getName()) && slot.getType() != LobbySlotType.OPEN) {
|
||||||
slot.setName(randomName());
|
slot.setName(randomName());
|
||||||
}
|
}
|
||||||
if (data.slots.size() == 1) {
|
if (data.slots.size() == 1) {
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ public final class OfflineLobby extends GameLobby {
|
|||||||
final String humanName = localName();
|
final String humanName = localName();
|
||||||
final int[] avatarIndices = localAvatarIndices();
|
final int[] avatarIndices = localAvatarIndices();
|
||||||
|
|
||||||
final LobbySlot slot0 = new LobbySlot(LobbySlotType.LOCAL, humanName, avatarIndices[0], 0, true, true, Collections.<AIOption>emptySet());
|
final LobbySlot slot0 = new LobbySlot(LobbySlotType.LOCAL, humanName, avatarIndices[0], 0, true, false, Collections.<AIOption>emptySet());
|
||||||
addSlot(slot0);
|
addSlot(slot0);
|
||||||
|
|
||||||
final LobbySlot slot1 = new LobbySlot(LobbySlotType.OPEN, "Open", avatarIndices[1], 1, false, false, Collections.<AIOption>emptySet());
|
final LobbySlot slot1 = new LobbySlot(LobbySlotType.OPEN, null, -1, -1, false, false, Collections.<AIOption>emptySet());
|
||||||
addSlot(slot1);
|
addSlot(slot1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user