mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 02:08:00 +00:00
Merge branch 'master' into historicformats
This commit is contained in:
@@ -158,10 +158,10 @@ public abstract class LobbyScreen extends LaunchScreen implements ILobbyView {
|
||||
public void run() {
|
||||
playerPanels.get(0).initialize(FPref.CONSTRUCTED_P1_DECK_STATE, FPref.COMMANDER_P1_DECK_STATE, FPref.TINY_LEADER_P1_DECK_STATE, FPref.BRAWL_P1_DECK_STATE, DeckType.PRECONSTRUCTED_DECK);
|
||||
playerPanels.get(1).initialize(FPref.CONSTRUCTED_P2_DECK_STATE, FPref.COMMANDER_P2_DECK_STATE, FPref.TINY_LEADER_P2_DECK_STATE, FPref.BRAWL_P2_DECK_STATE, DeckType.COLOR_DECK);
|
||||
if(getNumPlayers()>2) {
|
||||
if (getNumPlayers() > 2) {
|
||||
playerPanels.get(2).initialize(FPref.CONSTRUCTED_P3_DECK_STATE, FPref.COMMANDER_P3_DECK_STATE, FPref.TINY_LEADER_P3_DECK_STATE, FPref.BRAWL_P3_DECK_STATE, DeckType.COLOR_DECK);
|
||||
}
|
||||
if(getNumPlayers()>3) {
|
||||
if (getNumPlayers() > 3) {
|
||||
playerPanels.get(3).initialize(FPref.CONSTRUCTED_P4_DECK_STATE, FPref.COMMANDER_P4_DECK_STATE, FPref.TINY_LEADER_P4_DECK_STATE, FPref.BRAWL_P4_DECK_STATE, DeckType.COLOR_DECK);
|
||||
}
|
||||
/*playerPanels.get(4).initialize(FPref.CONSTRUCTED_P5_DECK_STATE, DeckType.COLOR_DECK);
|
||||
@@ -193,7 +193,7 @@ public abstract class LobbyScreen extends LaunchScreen implements ILobbyView {
|
||||
btnStart.setEnabled(hasControl);
|
||||
lblVariants.setEnabled(hasControl);
|
||||
cbVariants.setEnabled(hasControl);
|
||||
while(lobby.getNumberOfSlots()<getNumPlayers()){
|
||||
while (lobby.getNumberOfSlots() < getNumPlayers()){
|
||||
lobby.addSlot();
|
||||
}
|
||||
}
|
||||
@@ -492,10 +492,9 @@ public abstract class LobbyScreen extends LaunchScreen implements ILobbyView {
|
||||
}
|
||||
else {
|
||||
panel = new PlayerPanel(this, allowNetworking, i, slot, lobby.mayEdit(i), lobby.hasControl());
|
||||
if(i==2) {
|
||||
if (i == 2) {
|
||||
panel.initialize(FPref.CONSTRUCTED_P3_DECK_STATE, FPref.COMMANDER_P3_DECK_STATE, FPref.TINY_LEADER_P3_DECK_STATE, FPref.BRAWL_P3_DECK_STATE, DeckType.COLOR_DECK);
|
||||
}
|
||||
if(i==3) {
|
||||
} else if (i == 3) {
|
||||
panel.initialize(FPref.CONSTRUCTED_P4_DECK_STATE, FPref.COMMANDER_P4_DECK_STATE, FPref.TINY_LEADER_P4_DECK_STATE, FPref.BRAWL_P4_DECK_STATE, DeckType.COLOR_DECK);
|
||||
}
|
||||
playerPanels.add(panel);
|
||||
|
||||
@@ -82,7 +82,7 @@ public class MatchScreen extends FScreen {
|
||||
bottomPlayerPanel = playerPanels0.get(0);
|
||||
bottomPlayerPanel.setFlipped(false);
|
||||
topPlayerPanel = playerPanels0.get(1);
|
||||
playerPanelsList=playerPanels0;
|
||||
playerPanelsList = playerPanels0;
|
||||
//reorder list so bottom player is at the end of the list ensuring top to bottom turn order
|
||||
playerPanelsList.remove(bottomPlayerPanel);
|
||||
playerPanelsList.add(bottomPlayerPanel);
|
||||
@@ -158,11 +158,11 @@ public class MatchScreen extends FScreen {
|
||||
}
|
||||
|
||||
private boolean is4Player(){
|
||||
return playerPanels.keySet().size()==4;
|
||||
return playerPanels.keySet().size() == 4;
|
||||
}
|
||||
|
||||
private boolean is3Player(){
|
||||
return playerPanels.keySet().size()==3;
|
||||
return playerPanels.keySet().size() == 3;
|
||||
}
|
||||
|
||||
private IGameController getGameController() {
|
||||
@@ -517,7 +517,7 @@ public class MatchScreen extends FScreen {
|
||||
for (VPlayerPanel playerPanel: playerPanelsList){
|
||||
midField = playerPanel.getTop();
|
||||
y = midField - playerPanel.getField().getHeight();
|
||||
if(playerPanel.getSelectedTab() == null) {
|
||||
if (playerPanel.getSelectedTab() == null) {
|
||||
y++;
|
||||
}
|
||||
g.drawLine(1, BORDER_COLOR, x, y, w, y);
|
||||
@@ -539,32 +539,41 @@ public class MatchScreen extends FScreen {
|
||||
protected ScrollBounds layoutAndGetScrollBounds(float visibleWidth, float visibleHeight) {
|
||||
float totalHeight = visibleHeight + extraHeight;
|
||||
float avatarHeight = VAvatar.HEIGHT;
|
||||
if(is4Player() || is3Player()){
|
||||
if (is4Player() || is3Player()){
|
||||
avatarHeight *= 0.5f;
|
||||
}
|
||||
float playerCount = getPlayerPanels().keySet().size();
|
||||
|
||||
//determine player panel heights based on visibility of zone displays
|
||||
float cardRowsHeight = totalHeight - playerCount * avatarHeight;
|
||||
float totalCardRows=0;
|
||||
for(VPlayerPanel playerPanel:playerPanelsList){
|
||||
if(playerPanel.getSelectedTab() != null){
|
||||
totalCardRows += 1;
|
||||
if (Forge.isLandscapeMode() && playerCount == 2) {
|
||||
// Ensure that players have equal player panel heights in two player Forge in Landscape mode
|
||||
float topPlayerPanelHeight = totalHeight / 2;
|
||||
float bottomPlayerPanelHeight = topPlayerPanelHeight;
|
||||
topPlayerPanel.setBounds(0, 0, visibleWidth, topPlayerPanelHeight);
|
||||
bottomPlayerPanel.setBounds(0, totalHeight - bottomPlayerPanelHeight, visibleWidth, bottomPlayerPanelHeight);
|
||||
} else {
|
||||
// Determine player panel heights based on visibility of zone displays
|
||||
float cardRowsHeight = totalHeight - playerCount * avatarHeight;
|
||||
float totalCardRows = 0;
|
||||
for (VPlayerPanel playerPanel : playerPanelsList) {
|
||||
if (playerPanel.getSelectedTab() != null) {
|
||||
totalCardRows += 1;
|
||||
}
|
||||
totalCardRows += 2;
|
||||
}
|
||||
totalCardRows += 2;
|
||||
}
|
||||
float y=0;
|
||||
for(VPlayerPanel playerPanel:playerPanelsList){
|
||||
float panelHeight;
|
||||
if(playerPanel.getSelectedTab() != null){
|
||||
panelHeight = cardRowsHeight * 3f / totalCardRows;
|
||||
}else{
|
||||
panelHeight = cardRowsHeight * 2f / totalCardRows;
|
||||
float y = 0;
|
||||
for (VPlayerPanel playerPanel : playerPanelsList) {
|
||||
float panelHeight;
|
||||
if (playerPanel.getSelectedTab() != null) {
|
||||
panelHeight = cardRowsHeight * 3f / totalCardRows;
|
||||
} else {
|
||||
panelHeight = cardRowsHeight * 2f / totalCardRows;
|
||||
}
|
||||
panelHeight += avatarHeight;
|
||||
playerPanel.setBounds(0, y, visibleWidth, panelHeight);
|
||||
y += panelHeight;
|
||||
}
|
||||
panelHeight += avatarHeight;
|
||||
playerPanel.setBounds(0, y, visibleWidth, panelHeight);
|
||||
y += panelHeight;
|
||||
}
|
||||
|
||||
return new ScrollBounds(visibleWidth, totalHeight);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ public class VPlayerPanel extends FContainer {
|
||||
player = player0;
|
||||
phaseIndicator = add(new VPhaseIndicator());
|
||||
|
||||
if(playerCount>2){
|
||||
forMultiPlayer=true;
|
||||
if(playerCount > 2){
|
||||
forMultiPlayer = true;
|
||||
avatarHeight *= 0.5f;
|
||||
//displayAreaHeightFactor *= 0.7f;
|
||||
}
|
||||
@@ -473,7 +473,7 @@ public class VPlayerPanel extends FContainer {
|
||||
else {
|
||||
g.startClip(-1, y, w + 2, yAcross - y);
|
||||
}
|
||||
if(forMultiPlayer) {
|
||||
if (forMultiPlayer) {
|
||||
g.drawLine(1, MatchScreen.BORDER_COLOR, 0, yAcross, w, yAcross);
|
||||
g.drawLine(1, MatchScreen.BORDER_COLOR, 0, y, 0, h);
|
||||
g.drawLine(1, MatchScreen.BORDER_COLOR, w, y, w, h);
|
||||
|
||||
@@ -238,8 +238,8 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
|
||||
// Don't immediately close, wait for win/lose screen
|
||||
return false;
|
||||
} else {
|
||||
for(PlayerView player: getLocalPlayers()){
|
||||
if(!player.isAI()){
|
||||
for (PlayerView player : getLocalPlayers()){
|
||||
if (!player.isAI()){
|
||||
getGameController(player).nextGameDecision(NextGameDecision.QUIT);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user