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,13 +94,24 @@ public enum VMatchUI implements IVTopLevelUI {
} }
} }
// Add extra players alternatively to existing user/AI field panels. if (Singletons.getControl().getObservedGame().isCommandZoneNeeded()) {
for (int i = 2; i < lstCommands.size(); i++) { // Add extra players alternatively to existing user/AI field panels.
// If already in layout, no need to add again. for (int i = 2; i < lstCommands.size(); i++) {
VCommand cmdView = lstCommands.get(i); // If already in layout, no need to add again.
if (cmdView.getParentCell() == null) { VCommand cmdView = lstCommands.get(i);
lstCommands.get(i % 2).getParentCell().addDoc(cmdView); if (cmdView.getParentCell() == null) {
} 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.