Don't show command zone if game type doesn't need it

This commit is contained in:
drdev
2013-11-29 02:51:55 +00:00
parent ebb0a4b2bc
commit e8e5ac2ca7
2 changed files with 33 additions and 7 deletions

View File

@@ -513,6 +513,21 @@ public class Game {
return type; return type;
} }
/**
* @return whether command zone is needed for this game
*/
@SuppressWarnings("incomplete-switch")
public boolean isCommandZoneNeeded() {
switch (type) {
case Archenemy:
case Commander:
case Planechase:
case Vanguard:
return true;
}
return false;
}
/** /**
* @return the activePlane * @return the activePlane
*/ */

View File

@@ -94,6 +94,7 @@ public enum VMatchUI implements IVTopLevelUI {
} }
} }
if (Singletons.getControl().getObservedGame().isCommandZoneNeeded()) {
// Add extra players alternatively to existing user/AI field panels. // Add extra players alternatively to existing user/AI field panels.
for (int i = 2; i < lstCommands.size(); i++) { for (int i = 2; i < lstCommands.size(); i++) {
// If already in layout, no need to add again. // If already in layout, no need to add again.
@@ -102,6 +103,16 @@ public enum VMatchUI implements IVTopLevelUI {
lstCommands.get(i % 2).getParentCell().addDoc(cmdView); lstCommands.get(i % 2).getParentCell().addDoc(cmdView);
} }
} }
}
else {
//If game goesn't need command zone, remove it from existing field panels
for (int i = 0; i < 2; i++) {
VCommand cmdView = lstCommands.get(i);
if (cmdView.getParentCell() != null) {
cmdView.getParentCell().removeDoc(cmdView);
}
}
}
// Add extra hands to existing hand panel. // Add extra hands to existing hand panel.
for (int i = 1; i < lstHands.size(); i++) { for (int i = 1; i < lstHands.size(); i++) {