- Ensure that players have equal player panel heights in a two-player game in Landscape mode

This commit is contained in:
Agetian
2018-04-10 10:56:33 +03:00
parent 7e58e204ed
commit 9a43c1b3ae

View File

@@ -544,27 +544,36 @@ public class MatchScreen extends FScreen {
} }
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);
} }