Merge remote-tracking branch 'upstream/master'

This commit is contained in:
CCTV-1
2020-04-08 08:47:11 +08:00
19 changed files with 182 additions and 35 deletions

View File

@@ -83,9 +83,13 @@ public class MatchScreen extends FScreen {
scroller = add(new FieldScroller());
int humanCount = 0;
for (VPlayerPanel playerPanel : playerPanels0) {
playerPanels.put(playerPanel.getPlayer(), scroller.add(playerPanel));
playerPanel.setFlipped(true);
if(!playerPanel.getPlayer().isAI())
humanCount++;
}
bottomPlayerPanel = playerPanels0.get(0);
bottomPlayerPanel.setFlipped(false);
@@ -110,31 +114,26 @@ public class MatchScreen extends FScreen {
}
}));
if (MatchController.instance.getLocalPlayerCount() <= 1 || MatchController.instance.hotSeatMode()) {
if (humanCount < 2 || MatchController.instance.hotSeatMode() || GuiBase.isNetworkplay())
topPlayerPrompt = null;
}
else {
if (GuiBase.isNetworkplay()) {
topPlayerPrompt = null;
} else {
//show top prompt if multiple human players and not playing in Hot Seat mode and not in network play
topPlayerPrompt = add(new VPrompt("", "",
new FEventHandler() {
@Override
public void handleEvent(FEvent e) {
getGameController().selectButtonOk();
}
},
new FEventHandler() {
@Override
public void handleEvent(FEvent e) {
getGameController().selectButtonCancel();
}
}));
topPlayerPrompt.setRotate180(true);
topPlayerPanel.setRotate180(true);
getHeader().setRotate90(true);
}
//show top prompt if multiple human players and not playing in Hot Seat mode and not in network play
topPlayerPrompt = add(new VPrompt("", "",
new FEventHandler() {
@Override
public void handleEvent(FEvent e) {
getGameController().selectButtonOk();
}
},
new FEventHandler() {
@Override
public void handleEvent(FEvent e) {
getGameController().selectButtonCancel();
}
}));
topPlayerPrompt.setRotate180(true);
topPlayerPanel.setRotate180(true);
getHeader().setRotate90(true);
}
gameMenu = new VGameMenu();

View File

@@ -24,7 +24,7 @@ public class OnlineLobbyScreen extends LobbyScreen implements IOnlineLobby {
private static GameLobby gameLobby;
public GameLobby getGameLobby() {
public static GameLobby getGameLobby() {
return gameLobby;
}
@@ -114,6 +114,8 @@ public class OnlineLobbyScreen extends LobbyScreen implements IOnlineLobby {
}
});
}
//update menu buttons
OnlineScreen.Lobby.update();
}
});
}

View File

@@ -16,11 +16,13 @@ import forge.toolbox.FOptionPane;
import forge.util.Callback;
import forge.util.Localizer;
import static forge.screens.online.OnlineLobbyScreen.getGameLobby;
public class OnlineMenu extends FPopupMenu {
public enum OnlineScreen {
Lobby("lblLobby", FSkinImage.FAVICON, OnlineLobbyScreen.class),
Chat("lblChat", FSkinImage.QUEST_NOTES, OnlineChatScreen.class),
Disconnect("lblDisconnect", FSkinImage.EXILE, null);
Disconnect("lblDisconnect", FSkinImage.DELETE, null);
private final FMenuItem item;
private final Class<? extends FScreen> screenClass;
@@ -73,6 +75,7 @@ public class OnlineMenu extends FPopupMenu {
return;
}
}
update();
}
public void open() {
@@ -89,6 +92,17 @@ public class OnlineMenu extends FPopupMenu {
initializeScreen();
return screen;
}
public void update(){
for (OnlineScreen ngs : OnlineScreen.values()) {
if (ngs.ordinal() == 2){ //disconect
if (getGameLobby() == null)
ngs.item.setEnabled(false);
else
ngs.item.setEnabled(true);
}
}
}
}
private static final ForgePreferences prefs = FModel.getPreferences();