mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Don't show command zone if game type doesn't need it
This commit is contained in:
@@ -513,6 +513,21 @@ public class Game {
|
||||
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
|
||||
*/
|
||||
|
||||
@@ -94,13 +94,24 @@ public enum VMatchUI implements IVTopLevelUI {
|
||||
}
|
||||
}
|
||||
|
||||
// Add extra players alternatively to existing user/AI field panels.
|
||||
for (int i = 2; i < lstCommands.size(); i++) {
|
||||
// If already in layout, no need to add again.
|
||||
VCommand cmdView = lstCommands.get(i);
|
||||
if (cmdView.getParentCell() == null) {
|
||||
lstCommands.get(i % 2).getParentCell().addDoc(cmdView);
|
||||
}
|
||||
if (Singletons.getControl().getObservedGame().isCommandZoneNeeded()) {
|
||||
// Add extra players alternatively to existing user/AI field panels.
|
||||
for (int i = 2; i < lstCommands.size(); i++) {
|
||||
// If already in layout, no need to add again.
|
||||
VCommand cmdView = lstCommands.get(i);
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user