Merge branch 'master' into historicformats

This commit is contained in:
maustin
2018-04-10 14:07:06 +01:00
4 changed files with 42 additions and 34 deletions

View File

@@ -158,10 +158,10 @@ public abstract class LobbyScreen extends LaunchScreen implements ILobbyView {
public void run() { 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(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); 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); 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(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); /*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); btnStart.setEnabled(hasControl);
lblVariants.setEnabled(hasControl); lblVariants.setEnabled(hasControl);
cbVariants.setEnabled(hasControl); cbVariants.setEnabled(hasControl);
while(lobby.getNumberOfSlots()<getNumPlayers()){ while (lobby.getNumberOfSlots() < getNumPlayers()){
lobby.addSlot(); lobby.addSlot();
} }
} }
@@ -492,10 +492,9 @@ public abstract class LobbyScreen extends LaunchScreen implements ILobbyView {
} }
else { else {
panel = new PlayerPanel(this, allowNetworking, i, slot, lobby.mayEdit(i), lobby.hasControl()); 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); 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);
} } else if (i == 3) {
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); 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); playerPanels.add(panel);

View File

@@ -82,7 +82,7 @@ public class MatchScreen extends FScreen {
bottomPlayerPanel = playerPanels0.get(0); bottomPlayerPanel = playerPanels0.get(0);
bottomPlayerPanel.setFlipped(false); bottomPlayerPanel.setFlipped(false);
topPlayerPanel = playerPanels0.get(1); 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 //reorder list so bottom player is at the end of the list ensuring top to bottom turn order
playerPanelsList.remove(bottomPlayerPanel); playerPanelsList.remove(bottomPlayerPanel);
playerPanelsList.add(bottomPlayerPanel); playerPanelsList.add(bottomPlayerPanel);
@@ -158,11 +158,11 @@ public class MatchScreen extends FScreen {
} }
private boolean is4Player(){ private boolean is4Player(){
return playerPanels.keySet().size()==4; return playerPanels.keySet().size() == 4;
} }
private boolean is3Player(){ private boolean is3Player(){
return playerPanels.keySet().size()==3; return playerPanels.keySet().size() == 3;
} }
private IGameController getGameController() { private IGameController getGameController() {
@@ -517,7 +517,7 @@ public class MatchScreen extends FScreen {
for (VPlayerPanel playerPanel: playerPanelsList){ for (VPlayerPanel playerPanel: playerPanelsList){
midField = playerPanel.getTop(); midField = playerPanel.getTop();
y = midField - playerPanel.getField().getHeight(); y = midField - playerPanel.getField().getHeight();
if(playerPanel.getSelectedTab() == null) { if (playerPanel.getSelectedTab() == null) {
y++; y++;
} }
g.drawLine(1, BORDER_COLOR, x, y, w, 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) { protected ScrollBounds layoutAndGetScrollBounds(float visibleWidth, float visibleHeight) {
float totalHeight = visibleHeight + extraHeight; float totalHeight = visibleHeight + extraHeight;
float avatarHeight = VAvatar.HEIGHT; float avatarHeight = VAvatar.HEIGHT;
if(is4Player() || is3Player()){ if (is4Player() || is3Player()){
avatarHeight *= 0.5f; avatarHeight *= 0.5f;
} }
float playerCount = getPlayerPanels().keySet().size(); float playerCount = getPlayerPanels().keySet().size();
//determine player panel heights based on visibility of zone displays if (Forge.isLandscapeMode() && playerCount == 2) {
float cardRowsHeight = totalHeight - playerCount * avatarHeight; // Ensure that players have equal player panel heights in two player Forge in Landscape mode
float totalCardRows=0; float topPlayerPanelHeight = totalHeight / 2;
for(VPlayerPanel playerPanel:playerPanelsList){ float bottomPlayerPanelHeight = topPlayerPanelHeight;
if(playerPanel.getSelectedTab() != null){ topPlayerPanel.setBounds(0, 0, visibleWidth, topPlayerPanelHeight);
totalCardRows += 1; 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 y=0; float panelHeight;
for(VPlayerPanel playerPanel:playerPanelsList){ if (playerPanel.getSelectedTab() != null) {
float panelHeight; panelHeight = cardRowsHeight * 3f / totalCardRows;
if(playerPanel.getSelectedTab() != null){ } else {
panelHeight = cardRowsHeight * 3f / totalCardRows; panelHeight = cardRowsHeight * 2f / 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); return new ScrollBounds(visibleWidth, totalHeight);
} }

View File

@@ -53,8 +53,8 @@ public class VPlayerPanel extends FContainer {
player = player0; player = player0;
phaseIndicator = add(new VPhaseIndicator()); phaseIndicator = add(new VPhaseIndicator());
if(playerCount>2){ if(playerCount > 2){
forMultiPlayer=true; forMultiPlayer = true;
avatarHeight *= 0.5f; avatarHeight *= 0.5f;
//displayAreaHeightFactor *= 0.7f; //displayAreaHeightFactor *= 0.7f;
} }
@@ -473,7 +473,7 @@ public class VPlayerPanel extends FContainer {
else { else {
g.startClip(-1, y, w + 2, yAcross - y); 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, yAcross, w, yAcross);
g.drawLine(1, MatchScreen.BORDER_COLOR, 0, y, 0, h); g.drawLine(1, MatchScreen.BORDER_COLOR, 0, y, 0, h);
g.drawLine(1, MatchScreen.BORDER_COLOR, w, y, w, h); g.drawLine(1, MatchScreen.BORDER_COLOR, w, y, w, h);

View File

@@ -238,8 +238,8 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
// Don't immediately close, wait for win/lose screen // Don't immediately close, wait for win/lose screen
return false; return false;
} else { } else {
for(PlayerView player: getLocalPlayers()){ for (PlayerView player : getLocalPlayers()){
if(!player.isAI()){ if (!player.isAI()){
getGameController(player).nextGameDecision(NextGameDecision.QUIT); getGameController(player).nextGameDecision(NextGameDecision.QUIT);
} }
} }