mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- Planechase variant now launched from Constructed match setup screen.
- moved random deck checkboxes into deck panel. Only show them when a random deck type is selected. They are still global settings however. - when player 1 name is changed in preferences, switching back to constructed setup screen will reflect the change
This commit is contained in:
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -15374,11 +15374,9 @@ forge-gui/src/main/java/forge/gui/home/settings/VSubmenuReleaseNotes.java -text
|
||||
forge-gui/src/main/java/forge/gui/home/settings/package-info.java svneol=native#text/plain
|
||||
forge-gui/src/main/java/forge/gui/home/variant/CSubmenuArchenemy.java -text
|
||||
forge-gui/src/main/java/forge/gui/home/variant/CSubmenuCommander.java -text
|
||||
forge-gui/src/main/java/forge/gui/home/variant/CSubmenuPlanechase.java -text
|
||||
forge-gui/src/main/java/forge/gui/home/variant/CSubmenuVanguard.java -text
|
||||
forge-gui/src/main/java/forge/gui/home/variant/VSubmenuArchenemy.java -text
|
||||
forge-gui/src/main/java/forge/gui/home/variant/VSubmenuCommander.java -text
|
||||
forge-gui/src/main/java/forge/gui/home/variant/VSubmenuPlanechase.java -text
|
||||
forge-gui/src/main/java/forge/gui/home/variant/VSubmenuVanguard.java -text
|
||||
forge-gui/src/main/java/forge/gui/input/Input.java -text
|
||||
forge-gui/src/main/java/forge/gui/input/InputAttack.java svneol=native#text/plain
|
||||
|
||||
@@ -170,27 +170,6 @@ public enum DeckFormat {
|
||||
|
||||
break;
|
||||
|
||||
case Planechase: //Must contain at least 10 planes/phenomenons, but max 2 phenomenons. Singleton.
|
||||
final CardPool planes = deck.get(DeckSection.Planes);
|
||||
if (planes == null || planes.countAll() < 10) {
|
||||
return "should have at least 10 planes";
|
||||
}
|
||||
int phenoms = 0;
|
||||
for (Entry<PaperCard, Integer> cp : planes) {
|
||||
|
||||
if (cp.getKey().getRules().getType().typeContains(CardType.CoreType.Phenomenon)) {
|
||||
phenoms++;
|
||||
}
|
||||
if (cp.getValue() > 1) {
|
||||
return "must not contain multiple copies of any Plane or Phenomena";
|
||||
}
|
||||
|
||||
}
|
||||
if (phenoms > 2) {
|
||||
return "must not contain more than 2 Phenomena";
|
||||
}
|
||||
break;
|
||||
|
||||
case Archenemy: //Must contain at least 20 schemes, max 2 of each.
|
||||
final CardPool schemes = deck.get(DeckSection.Schemes);
|
||||
if (schemes == null || schemes.countAll() < 20) {
|
||||
@@ -242,4 +221,25 @@ public enum DeckFormat {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getPlaneSectionConformanceProblem(CardPool planes) {
|
||||
//Must contain at least 10 planes/phenomenons, but max 2 phenomenons. Singleton.
|
||||
if (planes == null || planes.countAll() < 10) {
|
||||
return "should have at least 10 planes";
|
||||
}
|
||||
int phenoms = 0;
|
||||
for (Entry<PaperCard, Integer> cp : planes) {
|
||||
if (cp.getKey().getRules().getType().typeContains(CardType.CoreType.Phenomenon)) {
|
||||
phenoms++;
|
||||
}
|
||||
if (cp.getValue() > 1) {
|
||||
return "must not contain multiple copies of any Plane or Phenomena";
|
||||
}
|
||||
|
||||
}
|
||||
if (phenoms > 2) {
|
||||
return "must not contain more than 2 Phenomena";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1474,6 +1474,7 @@ public class GameAction {
|
||||
public void startGame(GameOutcome lastGameOutcome) {
|
||||
Player first = determineFirstTurnPlayer(lastGameOutcome);
|
||||
|
||||
List<GameType> variants = game.getRules().getAppliedVariants();
|
||||
GameType gameType = game.getRules().getGameType();
|
||||
do {
|
||||
if (game.isGameOver()) { break; } // conceded during "play or draw"
|
||||
@@ -1493,7 +1494,7 @@ public class GameAction {
|
||||
game.setAge(GameStage.Play);
|
||||
|
||||
//<THIS CODE WILL WORK WITH PHASE = NULL>
|
||||
if (gameType == GameType.Planechase) {
|
||||
if (variants.contains(GameType.Planechase)) {
|
||||
first.initPlane();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package forge.game;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GameRules {
|
||||
private GameType gameType;
|
||||
private boolean manaBurn;
|
||||
@@ -7,6 +10,7 @@ public class GameRules {
|
||||
private int gamesPerMatch = 3;
|
||||
private int gamesToWinMatch = 2;
|
||||
private boolean playForAnte = false;
|
||||
private List<GameType> appliedVariants = new ArrayList<GameType>(4);
|
||||
|
||||
public GameRules(GameType type) {
|
||||
this.gameType = type;
|
||||
@@ -62,6 +66,14 @@ public class GameRules {
|
||||
return gamesToWinMatch;
|
||||
}
|
||||
|
||||
public void setAppliedVariants(List<GameType> appliedVariants) {
|
||||
this.appliedVariants = appliedVariants;
|
||||
}
|
||||
|
||||
public List<GameType> getAppliedVariants() {
|
||||
return appliedVariants;
|
||||
}
|
||||
|
||||
// it's a preference, not rule... but I could hardly find a better place for it
|
||||
public boolean canCloneUseTargetsImage;
|
||||
}
|
||||
|
||||
@@ -751,7 +751,7 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
|
||||
Player next = getNextActivePlayer();
|
||||
|
||||
if (game.getRules().getGameType() == GameType.Planechase) {
|
||||
if (game.getRules().getAppliedVariants().contains(GameType.Planechase)) {
|
||||
for (Card p :game.getActivePlanes()) {
|
||||
if (p != null) {
|
||||
p.setController(next, 0);
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckSection;
|
||||
import forge.game.GameType;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
|
||||
@@ -122,11 +123,11 @@ public class RegisteredPlayer {
|
||||
return start;
|
||||
}
|
||||
|
||||
public static RegisteredPlayer forPlanechase(final Deck deck, final Iterable<PaperCard> planes) {
|
||||
/*public static RegisteredPlayer forPlanechase(final Deck deck, final Iterable<PaperCard> planes) {
|
||||
RegisteredPlayer start = new RegisteredPlayer(deck);
|
||||
start.planes = planes;
|
||||
return start;
|
||||
}
|
||||
}*/
|
||||
|
||||
public static RegisteredPlayer forCommander(final Deck deck) {
|
||||
RegisteredPlayer start = new RegisteredPlayer(deck);
|
||||
@@ -135,6 +136,36 @@ public class RegisteredPlayer {
|
||||
return start;
|
||||
}
|
||||
|
||||
public static RegisteredPlayer forVariants(
|
||||
final List<GameType> appliedVariants, final Deck deck, final int team, //General vars
|
||||
final Iterable<PaperCard> schemes, final boolean isPlayerArchenemy, //Archenemy specific vars
|
||||
final Iterable<PaperCard> planes, final PaperCard vanguardAvatar) { //Planechase and Vanguard
|
||||
RegisteredPlayer start = new RegisteredPlayer(deck);
|
||||
if (appliedVariants.contains(GameType.Archenemy)) {
|
||||
if (isPlayerArchenemy) {
|
||||
start.setStartingLife(40); // 904.5: The Archenemy has 40 life.
|
||||
}
|
||||
start.schemes = schemes;
|
||||
}
|
||||
if (appliedVariants.contains(GameType.ArchenemyRumble)) {
|
||||
start.setStartingLife(start.getStartingLife() + 20); // Allow
|
||||
start.schemes = schemes;
|
||||
}
|
||||
if (appliedVariants.contains(GameType.Commander)) {
|
||||
start.commander = deck.get(DeckSection.Commander).get(0);
|
||||
start.setStartingLife(40); // 903.7: ...each player sets his or her life total to 40
|
||||
}
|
||||
if (appliedVariants.contains(GameType.Planechase)) {
|
||||
start.planes = planes;
|
||||
}
|
||||
if (appliedVariants.contains(GameType.Vanguard)) {
|
||||
start.setStartingLife(start.getStartingLife() + vanguardAvatar.getRules().getLife());
|
||||
start.setStartingHand(start.getStartingHand() + vanguardAvatar.getRules().getHand());
|
||||
start.addCardsInCommand(vanguardAvatar);
|
||||
}
|
||||
return start;
|
||||
}
|
||||
|
||||
public LobbyPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@@ -567,12 +567,17 @@ public enum FControl implements KeyEventDispatcher {
|
||||
}
|
||||
|
||||
public void startMatch(GameType gameType, List<RegisteredPlayer> players) {
|
||||
startMatch(gameType, new ArrayList<GameType>(0), players);
|
||||
}
|
||||
|
||||
public void startMatch(GameType gameType, List<GameType> appliedVariants, List<RegisteredPlayer> players) {
|
||||
boolean useRandomFoil = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_RANDOM_FOIL);
|
||||
for(RegisteredPlayer rp : players) {
|
||||
rp.setRandomFoil(useRandomFoil);
|
||||
}
|
||||
|
||||
GameRules rules = new GameRules(gameType);
|
||||
rules.setAppliedVariants(appliedVariants);
|
||||
rules.setPlayForAnte(Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE));
|
||||
rules.setManaBurn(Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_MANABURN));
|
||||
rules.canCloneUseTargetsImage = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_CLONE_MODE_SOURCE);
|
||||
|
||||
@@ -445,7 +445,7 @@ public final class GuiDisplayUtil {
|
||||
|
||||
public static void devModePlaneswalkTo() {
|
||||
final Game game = getGame();
|
||||
if (game.getRules().getGameType() != GameType.Planechase) { return; }
|
||||
if (!game.getRules().getAppliedVariants().contains(GameType.Planechase)) { return; }
|
||||
final Player p = game.getPhaseHandler().getPlayerTurn();
|
||||
|
||||
final List<PaperCard> allPlanars = new ArrayList<PaperCard>();
|
||||
|
||||
@@ -379,4 +379,8 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
}
|
||||
|
||||
public DecksComboBox getDecksComboBox() {
|
||||
return decksComboBox;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import forge.gui.home.settings.VSubmenuPreferences;
|
||||
import forge.gui.home.settings.VSubmenuReleaseNotes;
|
||||
import forge.gui.home.variant.VSubmenuArchenemy;
|
||||
import forge.gui.home.variant.VSubmenuCommander;
|
||||
import forge.gui.home.variant.VSubmenuPlanechase;
|
||||
//import forge.gui.home.variant.VSubmenuPlanechase;
|
||||
import forge.gui.home.variant.VSubmenuVanguard;
|
||||
import forge.gui.match.views.VAntes;
|
||||
import forge.gui.match.views.VCombat;
|
||||
@@ -85,7 +85,7 @@ public enum EDocID { /** */
|
||||
HOME_DRAFT (VSubmenuDraft.SINGLETON_INSTANCE), /** */
|
||||
HOME_SEALED (VSubmenuSealed.SINGLETON_INSTANCE), /** */
|
||||
HOME_VANGUARD (VSubmenuVanguard.SINGLETON_INSTANCE), /** */
|
||||
HOME_PLANECHASE (VSubmenuPlanechase.SINGLETON_INSTANCE), /** */
|
||||
//HOME_PLANECHASE (VSubmenuPlanechase.SINGLETON_INSTANCE), /** */
|
||||
HOME_RELEASE_NOTES (VSubmenuReleaseNotes.SINGLETON_INSTANCE),
|
||||
|
||||
REPORT_MESSAGE (VPrompt.SINGLETON_INSTANCE), /** */
|
||||
|
||||
@@ -57,7 +57,7 @@ import forge.gui.home.settings.VSubmenuPreferences;
|
||||
import forge.gui.home.settings.VSubmenuReleaseNotes;
|
||||
import forge.gui.home.variant.VSubmenuArchenemy;
|
||||
import forge.gui.home.variant.VSubmenuCommander;
|
||||
import forge.gui.home.variant.VSubmenuPlanechase;
|
||||
//import forge.gui.home.variant.VSubmenuPlanechase;
|
||||
import forge.gui.home.variant.VSubmenuVanguard;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FScrollPanel;
|
||||
@@ -153,7 +153,7 @@ public enum VHomeUI implements IVTopLevelUI {
|
||||
|
||||
allSubmenus.add(VSubmenuArchenemy.SINGLETON_INSTANCE);
|
||||
allSubmenus.add(VSubmenuVanguard.SINGLETON_INSTANCE);
|
||||
allSubmenus.add(VSubmenuPlanechase.SINGLETON_INSTANCE);
|
||||
//allSubmenus.add(VSubmenuPlanechase.SINGLETON_INSTANCE);
|
||||
allSubmenus.add(VSubmenuCommander.SINGLETON_INSTANCE);
|
||||
|
||||
// For each group: init its panel
|
||||
|
||||
@@ -4,22 +4,33 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import forge.Command;
|
||||
import forge.Singletons;
|
||||
import forge.deck.CardPool;
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckSection;
|
||||
import forge.game.GameType;
|
||||
import forge.game.player.LobbyPlayer;
|
||||
import forge.game.player.RegisteredPlayer;
|
||||
import forge.gui.deckchooser.DeckgenUtil;
|
||||
import forge.gui.deckchooser.DecksComboBox.DeckType;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.gui.menus.IMenuProvider;
|
||||
import forge.gui.menus.MenuUtil;
|
||||
import forge.gui.toolbox.FList;
|
||||
import forge.gui.toolbox.FOptionPane;
|
||||
import forge.item.PaperCard;
|
||||
import forge.net.FServer;
|
||||
import forge.net.Lobby;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.storage.IStorage;
|
||||
|
||||
/**
|
||||
* Controls the constructed submenu in the home UI.
|
||||
@@ -42,18 +53,42 @@ public enum CSubmenuConstructed implements ICDoc, IMenuProvider {
|
||||
MenuUtil.setMenuProvider(this);
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override public void run() {
|
||||
view.refreshAvatarFromPrefs(0);
|
||||
view.refreshAvatarFromPrefs(1);
|
||||
view.getBtnStart().requestFocusInWindow();
|
||||
}
|
||||
@Override public void run() {
|
||||
// Planechase: reinit deck lists and restore last selections (if any)
|
||||
for (FList<Object> deckList : view.getPlanarDeckLists()) {
|
||||
Vector<Object> listData = new Vector<Object>();
|
||||
|
||||
listData.add("Use deck's planes section (random if unavailable)");
|
||||
listData.add("Generate");
|
||||
if (Singletons.getModel().getDecks().getPlane().size() > 0) {
|
||||
listData.add("Random");
|
||||
for (Deck planarDeck : Singletons.getModel().getDecks().getPlane()) {
|
||||
listData.add(planarDeck);
|
||||
}
|
||||
}
|
||||
|
||||
Object val = deckList.getSelectedValue();
|
||||
deckList.setListData(listData);
|
||||
if (null != val) {
|
||||
deckList.setSelectedValue(val, true);
|
||||
}
|
||||
|
||||
if (-1 == deckList.getSelectedIndex()) {
|
||||
deckList.setSelectedIndex(0);
|
||||
}
|
||||
} // End Planechase
|
||||
|
||||
// General updates when switching back to this view
|
||||
view.updatePlayersFromPrefs();
|
||||
view.getBtnStart().requestFocusInWindow();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.home.ICSubmenu#initialize()
|
||||
*/
|
||||
@Override
|
||||
@Override
|
||||
public void initialize() {
|
||||
view.getDeckChooser(0).initialize(FPref.CONSTRUCTED_P1_DECK_STATE, DeckType.PRECONSTRUCTED_DECK);
|
||||
view.getDeckChooser(1).initialize(FPref.CONSTRUCTED_P2_DECK_STATE, DeckType.COLOR_DECK);
|
||||
@@ -64,21 +99,50 @@ public enum CSubmenuConstructed implements ICDoc, IMenuProvider {
|
||||
view.getDeckChooser(6).initialize(FPref.CONSTRUCTED_P7_DECK_STATE, DeckType.COLOR_DECK);
|
||||
view.getDeckChooser(7).initialize(FPref.CONSTRUCTED_P8_DECK_STATE, DeckType.COLOR_DECK);
|
||||
|
||||
// Checkbox event handling
|
||||
// Start button event handling
|
||||
view.getBtnStart().addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
startGame(GameType.Constructed);
|
||||
final List<GameType> variantTypes = new ArrayList<GameType>(4);
|
||||
variantTypes.addAll(view.getAppliedVariants());
|
||||
startGame(variantTypes);
|
||||
}
|
||||
});
|
||||
|
||||
final ForgePreferences prefs = Singletons.getModel().getPreferences();
|
||||
// Checkbox event handling
|
||||
view.getCbSingletons().addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
prefs.setPref(FPref.DECKGEN_SINGLETONS, String.valueOf(view.getCbSingletons().isSelected()));
|
||||
prefs.save();
|
||||
}
|
||||
});
|
||||
|
||||
view.getCbArtifacts().addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
prefs.setPref(FPref.DECKGEN_ARTIFACTS, String.valueOf(view.getCbArtifacts().isSelected()));
|
||||
prefs.save();
|
||||
}
|
||||
});
|
||||
|
||||
// Pre-select checkboxes
|
||||
view.getCbSingletons().setSelected(prefs.getPrefBoolean(FPref.DECKGEN_SINGLETONS));
|
||||
view.getCbArtifacts().setSelected(prefs.getPrefBoolean(FPref.DECKGEN_ARTIFACTS));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param gameType
|
||||
*/
|
||||
private void startGame(final GameType gameType) {
|
||||
/** Starts a match with the applied variants. */
|
||||
private void startGame(final List<GameType> variantTypes) {
|
||||
if (variantTypes.contains(GameType.Archenemy) || variantTypes.contains(GameType.ArchenemyRumble)
|
||||
|| variantTypes.contains(GameType.Commander)|| variantTypes.contains(GameType.Vanguard)) {
|
||||
FOptionPane.showMessageDialog("Archenemy, Commander and Vanguard matches cannot currently be started via "
|
||||
+ "the Constructed match setup screen. Please disable any of those variants then restart the match");
|
||||
return;
|
||||
}
|
||||
|
||||
boolean checkLegality = Singletons.getModel().getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY);
|
||||
|
||||
for (final int i : view.getParticipants()) {
|
||||
if (view.getDeckChooser(i).getPlayer() == null) {
|
||||
FOptionPane.showMessageDialog("Please specify a deck for " + view.getPlayerName(i));
|
||||
@@ -86,27 +150,73 @@ public enum CSubmenuConstructed implements ICDoc, IMenuProvider {
|
||||
}
|
||||
} // Is it even possible anymore? I think current implementation assigns decks automatically.
|
||||
|
||||
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
|
||||
for (final int i : view.getParticipants()) {
|
||||
String name = view.getPlayerName(i);
|
||||
String errMsg = gameType.getDecksFormat().getDeckConformanceProblem(view.getDeckChooser(i).getPlayer().getDeck());
|
||||
if (null != errMsg) {
|
||||
FOptionPane.showErrorDialog(name + "'s deck " + errMsg, "Invalid Deck");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (checkLegality) {
|
||||
for (final int i : view.getParticipants()) {
|
||||
String name = view.getPlayerName(i);
|
||||
String errMsg = GameType.Constructed.getDecksFormat().getDeckConformanceProblem(view.getDeckChooser(i).getPlayer().getDeck());
|
||||
if (null != errMsg) {
|
||||
FOptionPane.showErrorDialog(name + "'s deck " + errMsg, "Invalid Deck");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Lobby lobby = FServer.instance.getLobby();
|
||||
List<RegisteredPlayer> players = new ArrayList<RegisteredPlayer>();
|
||||
for (final int i : view.getParticipants()) {
|
||||
String name = view.getPlayerName(i);
|
||||
LobbyPlayer lobbyPlayer = view.isPlayerAI(i) ? lobby.getAiPlayer(name,
|
||||
view.getPlayerAvatar(i)) : lobby.getGuiPlayer();
|
||||
RegisteredPlayer rp = view.getDeckChooser(i).getPlayer();
|
||||
players.add(rp.setPlayer(view.isPlayerAI(i) ?
|
||||
lobby.getAiPlayer(view.getPlayerName(i), view.getPlayerAvatar(i)) : lobby.getGuiPlayer()));
|
||||
if (variantTypes.isEmpty()) {
|
||||
players.add(rp.setPlayer(lobbyPlayer));
|
||||
} else {
|
||||
// Initialise Variant variables
|
||||
Deck deck = rp.getDeck();
|
||||
Iterable<PaperCard> schemes = null;
|
||||
boolean isPlayerArchenemy = false;
|
||||
Iterable<PaperCard> planes = null;
|
||||
PaperCard vanguardAvatar = null;
|
||||
|
||||
//Planechase
|
||||
if (variantTypes.contains(GameType.Planechase)) {
|
||||
Object selected = view.getPlanarDeckLists().get(i).getSelectedValue();
|
||||
CardPool planePool;
|
||||
if (selected instanceof String) {
|
||||
String sel = (String) selected;
|
||||
if (sel.contains("Use deck's planes section")) {
|
||||
if (deck.has(DeckSection.Planes)) {
|
||||
planePool = deck.get(DeckSection.Planes);
|
||||
} else {
|
||||
sel = "Random";
|
||||
}
|
||||
}
|
||||
IStorage<Deck> pDecks = Singletons.getModel().getDecks().getPlane();
|
||||
if (sel.equals("Random") && pDecks.size() != 0) {
|
||||
planePool = Aggregates.random(pDecks).get(DeckSection.Planes);
|
||||
} else { //Generate
|
||||
planePool = DeckgenUtil.generatePlanarDeck();
|
||||
}
|
||||
} else {
|
||||
planePool = ((Deck) selected).get(DeckSection.Planes);
|
||||
}
|
||||
if (checkLegality) {
|
||||
String errMsg = GameType.Planechase.getDecksFormat().getPlaneSectionConformanceProblem(planePool);
|
||||
if (null != errMsg) {
|
||||
FOptionPane.showErrorDialog(name + "'s deck " + errMsg, "Invalid Planar Deck");
|
||||
return;
|
||||
}
|
||||
}
|
||||
planes = planePool.toFlatList();
|
||||
}
|
||||
|
||||
players.add(RegisteredPlayer.forVariants(variantTypes, rp.getDeck(), view.getTeam(i),
|
||||
schemes, isPlayerArchenemy, planes, vanguardAvatar).setPlayer(lobbyPlayer));
|
||||
}
|
||||
view.getDeckChooser(i).saveState();
|
||||
}
|
||||
|
||||
Singletons.getControl().startMatch(gameType, players);
|
||||
Singletons.getControl().startMatch(GameType.Constructed, variantTypes, players);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -25,15 +25,22 @@ import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import forge.Command;
|
||||
import forge.Singletons;
|
||||
import forge.game.GameType;
|
||||
import forge.gui.deckchooser.DecksComboBox.DeckType;
|
||||
import forge.gui.deckchooser.DecksComboBoxEvent;
|
||||
import forge.gui.deckchooser.FDeckChooser;
|
||||
import forge.gui.deckeditor.DeckProxy;
|
||||
import forge.gui.deckchooser.IDecksComboBoxListener;
|
||||
import forge.gui.deckeditor.CDeckEditorUI;
|
||||
import forge.gui.deckeditor.controllers.CEditorVariant;
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.framework.DragTab;
|
||||
import forge.gui.framework.EDocID;
|
||||
import forge.gui.framework.FScreen;
|
||||
import forge.gui.home.EMenuGroup;
|
||||
import forge.gui.home.IVSubmenu;
|
||||
import forge.gui.home.LblHeader;
|
||||
@@ -43,6 +50,7 @@ import forge.gui.toolbox.FCheckBox;
|
||||
import forge.gui.toolbox.FComboBox;
|
||||
import forge.gui.toolbox.FComboBoxWrapper;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FList;
|
||||
import forge.gui.toolbox.FMouseAdapter;
|
||||
import forge.gui.toolbox.FOptionPane;
|
||||
import forge.gui.toolbox.FPanel;
|
||||
@@ -53,6 +61,7 @@ import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinColor;
|
||||
import forge.gui.toolbox.FSkin.SkinImage;
|
||||
import forge.gui.toolbox.FTextField;
|
||||
import forge.item.PaperCard;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.util.Lang;
|
||||
@@ -79,17 +88,16 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
private int activePlayersNum = 2;
|
||||
private int playerWithFocus = 0; // index of the player that currently has focus
|
||||
private PlayerPanel playerPanelWithFocus;
|
||||
private GameType currentGameMode = GameType.Constructed;
|
||||
private List<Integer> teams = new ArrayList<Integer>(8);
|
||||
|
||||
private final FCheckBox cbSingletons = new FCheckBox("Singleton Mode");
|
||||
private final FCheckBox cbArtifacts = new FCheckBox("Remove Artifacts");
|
||||
private final FCheckBox cbRemoveSmall = new FCheckBox("Remove Small Creatures");
|
||||
private final StartButton btnStart = new StartButton();
|
||||
private final JPanel pnlStart = new JPanel(new MigLayout("insets 0, gap 0, wrap 2"));
|
||||
private final JPanel constructedFrame = new JPanel(new MigLayout("insets 0, gap 0, wrap 2")); // Main content frame
|
||||
|
||||
// Variants frame and variables
|
||||
private final Set<GameType> appliedVariants = new TreeSet<GameType>();
|
||||
private final FPanel variantsPanel = new FPanel(new MigLayout("insets 10, gapx 10"));
|
||||
private final FPanel variantsPanel = new FPanel(new MigLayout("insets 10, gapx 10"));
|
||||
private final FCheckBox vntVanguard = new FCheckBox("Vanguard");
|
||||
private final FCheckBox vntCommander = new FCheckBox("Commander");
|
||||
private final FCheckBox vntPlanechase = new FCheckBox("Planechase");
|
||||
@@ -118,6 +126,14 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
private final JPanel decksFrame = new JPanel(new MigLayout("insets 0, gap 0, wrap, hidemode 3"));
|
||||
private final List<FDeckChooser> deckChoosers = new ArrayList<FDeckChooser>(8);
|
||||
private final List<FLabel> deckSelectorBtns = new ArrayList<FLabel>(8);
|
||||
private final FCheckBox cbSingletons = new FCheckBox("Singleton Mode");
|
||||
private final FCheckBox cbArtifacts = new FCheckBox("Remove Artifacts");
|
||||
|
||||
// Variants
|
||||
private final List<FList<Object>> planarDeckLists = new ArrayList<FList<Object>>();
|
||||
private final List<FPanel> planarDeckPanels = new ArrayList<FPanel>(8);
|
||||
private final List<FLabel> plnDeckSelectorBtns = new ArrayList<FLabel>(8);
|
||||
private final List<FLabel> plnEditors = new ArrayList<FLabel>(8);
|
||||
|
||||
// CTR
|
||||
private VSubmenuConstructed() {
|
||||
@@ -146,7 +162,7 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
constructedFrame.add(new FScrollPane(variantsPanel, false,
|
||||
ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER,
|
||||
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED),
|
||||
"w 100%, gapbottom 10px, spanx 2, wrap");
|
||||
"w 100%, h 45px!, gapbottom 10px, spanx 2, wrap");
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
///////////////////// Player Panel /////////////////////
|
||||
@@ -154,6 +170,7 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
// Construct individual player panels
|
||||
String constraints = "pushx, growx, wrap, hidemode 3";
|
||||
for (int i = 0; i < 8; i++) {
|
||||
teams.add(i+1);
|
||||
buildPlayerPanel(i);
|
||||
FPanel player = playerPanelList.get(i);
|
||||
|
||||
@@ -194,18 +211,13 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
buildDeckPanel(i);
|
||||
}
|
||||
populateDeckPanel(true);
|
||||
constructedFrame.add(decksFrame, "w 50%-5px, growy, pushy");
|
||||
constructedFrame.setOpaque(false);
|
||||
decksFrame.setOpaque(false);
|
||||
|
||||
// Start Button
|
||||
final String strCheckboxConstraints = "h 30px!, gap 0 20px 0 0";
|
||||
pnlStart.setOpaque(false);
|
||||
pnlStart.add(cbSingletons, strCheckboxConstraints);
|
||||
pnlStart.add(btnStart, "span 1 3, growx, pushx, align center");
|
||||
pnlStart.add(cbArtifacts, strCheckboxConstraints);
|
||||
pnlStart.add(cbRemoveSmall, strCheckboxConstraints);
|
||||
pnlStart.add(btnStart, "align center");
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -279,18 +291,17 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
newNameBtn.setCommand(new Command() {
|
||||
@Override
|
||||
public void run() {
|
||||
newNameBtn.requestFocus();
|
||||
String newName = getNewName();
|
||||
int index = nameRandomisers.indexOf(newNameBtn);
|
||||
int index = nameRandomisers.indexOf(newNameBtn);
|
||||
FTextField nField = playerNameBtnList.get(index);
|
||||
|
||||
nField.setGhostText(newName);
|
||||
nField.setText(newName);
|
||||
|
||||
if (index == 0) {
|
||||
prefs.setPref(FPref.PLAYER_NAME, newName);
|
||||
prefs.save();
|
||||
}
|
||||
playerNameBtnList.get(index).requestFocus();
|
||||
changePlayerFocus(index);
|
||||
}
|
||||
});
|
||||
@@ -321,13 +332,52 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
deckBtn.setCommand(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
avatarList.get(deckSelectorBtns.indexOf(deckBtn)).requestFocusInWindow();
|
||||
currentGameMode = GameType.Constructed;
|
||||
deckBtn.requestFocusInWindow();
|
||||
changePlayerFocus(deckSelectorBtns.indexOf(deckBtn), GameType.Constructed);
|
||||
}
|
||||
});
|
||||
playerPanel.add(newLabel("Deck:"), "w 40px, h 30px");
|
||||
playerPanel.add(deckBtn, "pushx, growx, wmax 100%-157px, h 30px, spanx 4");
|
||||
playerPanel.add(deckBtn, "pushx, growx, wmax 100%-157px, h 30px, spanx 4, wrap");
|
||||
deckSelectorBtns.add(deckBtn);
|
||||
|
||||
// Variants
|
||||
String variantBtnConstraints = "height 30px, hidemode 3";
|
||||
|
||||
// Planechase buttons
|
||||
final FLabel plnDeckSelectorBtn = new FLabel.ButtonBuilder().text("Select a planar deck").build();
|
||||
plnDeckSelectorBtn.setVisible(appliedVariants.contains(GameType.Planechase));
|
||||
plnDeckSelectorBtn.setCommand(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
currentGameMode = GameType.Planechase;
|
||||
plnDeckSelectorBtn.requestFocusInWindow();
|
||||
changePlayerFocus(plnDeckSelectorBtns.indexOf(plnDeckSelectorBtn), GameType.Planechase);
|
||||
}
|
||||
});
|
||||
final FLabel plnDeckEditor = new FLabel.ButtonBuilder().text("Planar Deck Editor").build();
|
||||
plnDeckEditor.setVisible(appliedVariants.contains(GameType.Planechase));
|
||||
plnDeckEditor.setCommand(new Command() {
|
||||
@Override
|
||||
public void run() {
|
||||
currentGameMode = GameType.Planechase;
|
||||
Predicate<PaperCard> predPlanes = new Predicate<PaperCard>() {
|
||||
@Override
|
||||
public boolean apply(PaperCard arg0) {
|
||||
return arg0.getRules().getType().isPlane() || arg0.getRules().getType().isPhenomenon();
|
||||
}
|
||||
};
|
||||
|
||||
Singletons.getControl().setCurrentScreen(FScreen.DECK_EDITOR_PLANECHASE);
|
||||
CDeckEditorUI.SINGLETON_INSTANCE.setEditorController(
|
||||
new CEditorVariant(Singletons.getModel().getDecks().getPlane(), predPlanes, FScreen.DECK_EDITOR_PLANECHASE));
|
||||
}
|
||||
});
|
||||
playerPanel.add(plnDeckSelectorBtn, variantBtnConstraints + ", spanx, split 2, growx, pushx, gapright rel");
|
||||
playerPanel.add(plnDeckEditor, variantBtnConstraints + ", width 150px, wrap");
|
||||
plnDeckSelectorBtns.add(plnDeckSelectorBtn);
|
||||
plnEditors.add(plnDeckEditor);
|
||||
|
||||
playerPanelList.add(playerPanel);
|
||||
|
||||
return playerPanel;
|
||||
@@ -343,7 +393,6 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
activePlayersNum++;
|
||||
|
||||
avatarList.get(playerPanelList.indexOf(player)).requestFocusInWindow();
|
||||
refreshPanels(true, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,25 +419,6 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
|
||||
changePlayerFocus(closest);
|
||||
avatarList.get(closest).requestFocusInWindow();
|
||||
refreshPanels(true, false);
|
||||
}
|
||||
|
||||
public void updatePlayerName(int playerIndex) {
|
||||
String name = prefs.getPref(FPref.PLAYER_NAME);
|
||||
playerNameBtnList.get(0).setText(name);
|
||||
}
|
||||
|
||||
public void refreshAvatarFromPrefs(int playerIndex) {
|
||||
FLabel avatar = avatarList.get(playerIndex);
|
||||
String[] currentPrefs = Singletons.getModel().getPreferences().getPref(FPref.UI_AVATARS).split(",");
|
||||
if (playerIndex < currentPrefs.length) {
|
||||
int avatarIndex = Integer.parseInt(currentPrefs[playerIndex]);
|
||||
avatar.setIcon(FSkin.getAvatars().get(avatarIndex));
|
||||
avatar.repaintSelf();
|
||||
usedAvatars.put(playerIndex, avatarIndex);
|
||||
} else {
|
||||
setRandomAvatar(avatar, playerIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/** Applies a random avatar, avoiding avatars already used.
|
||||
@@ -415,9 +445,6 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
String sectionConstraints = "insets 8";
|
||||
|
||||
// Main deck
|
||||
FPanel mainDeckPanel = new FPanel();
|
||||
mainDeckPanel.setLayout(new MigLayout(sectionConstraints));
|
||||
|
||||
final FDeckChooser mainChooser = new FDeckChooser(isPlayerAI(playerIndex));
|
||||
mainChooser.initialize();
|
||||
mainChooser.getLstDecks().setSelectCommand(new Command() {
|
||||
@@ -427,7 +454,19 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
}
|
||||
});
|
||||
deckChoosers.add(mainChooser);
|
||||
mainDeckPanel.add(mainChooser, "grow, push, wrap");
|
||||
|
||||
// Planar deck list
|
||||
FPanel planarDeckPanel = new FPanel();
|
||||
planarDeckPanel.setLayout(new MigLayout(sectionConstraints));
|
||||
planarDeckPanel.add(new FLabel.Builder().text("Select Planar deck:").build(), "gap 0px 0px 10px 10px, wrap");
|
||||
FList<Object> planarDeckList = new FList<Object>();
|
||||
planarDeckList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
||||
|
||||
FScrollPane scrPlanes = new FScrollPane(planarDeckList, false,
|
||||
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
planarDeckPanel.add(scrPlanes, "h 95%, gap 0px 10px 0px 10px, grow, push, wrap");
|
||||
planarDeckLists.add(planarDeckList);
|
||||
planarDeckPanels.add(planarDeckPanel);
|
||||
}
|
||||
|
||||
protected void onDeckClicked(int iPlayer, DeckType type, Collection<DeckProxy> selectedDecks) {
|
||||
@@ -436,10 +475,20 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
}
|
||||
|
||||
/** Populates the deck panel with the focused player's deck choices. */
|
||||
private void populateDeckPanel(final boolean firstBuild) {
|
||||
if (!firstBuild) { decksFrame.removeAll(); }
|
||||
private void populateDeckPanel(final GameType forGameType) {
|
||||
decksFrame.removeAll();
|
||||
|
||||
decksFrame.add(deckChoosers.get(playerWithFocus), "grow, push");
|
||||
if (GameType.Constructed == forGameType) {
|
||||
decksFrame.add(deckChoosers.get(playerWithFocus), "grow, push");
|
||||
if (deckChoosers.get(playerWithFocus).getSelectedDeckType().toString().contains("Random")) {
|
||||
final String strCheckboxConstraints = "h 30px!, gap 0 20px 0 0";
|
||||
decksFrame.add(cbSingletons, strCheckboxConstraints);
|
||||
decksFrame.add(cbArtifacts, strCheckboxConstraints);
|
||||
}
|
||||
} else if (GameType.Planechase == forGameType) {
|
||||
decksFrame.add(planarDeckPanels.get(playerWithFocus), "grow, push");
|
||||
refreshPanels(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -482,9 +531,16 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
container.setLayout(new MigLayout("insets 0, gap 0, wrap 1, ax right"));
|
||||
container.add(lblTitle, "w 80%, h 40px!, gap 0 0 15px 15px, span 2, al right, pushx");
|
||||
|
||||
for (FDeckChooser fdc : deckChoosers) {
|
||||
for (final FDeckChooser fdc : deckChoosers) {
|
||||
fdc.populate();
|
||||
fdc.getDecksComboBox().addListener(new IDecksComboBoxListener() {
|
||||
@Override
|
||||
public void deckTypeSelected(DecksComboBoxEvent ev) {
|
||||
avatarList.get(playerWithFocus).requestFocusInWindow();
|
||||
}
|
||||
});
|
||||
}
|
||||
populateDeckPanel(GameType.Constructed);
|
||||
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(constructedFrame, "gap 20px 20px 20px 0px, push, grow");
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(pnlStart, "gap 0 0 3.5%! 3.5%!, ax center");
|
||||
@@ -500,6 +556,12 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
return this.btnStart;
|
||||
}
|
||||
|
||||
/** Gets the random deck checkbox for Singletons. */
|
||||
public FCheckBox getCbSingletons() { return cbSingletons; }
|
||||
|
||||
/** Gets the random deck checkbox for Artifacts. */
|
||||
public FCheckBox getCbArtifacts() { return cbArtifacts; }
|
||||
|
||||
public boolean isPlayerAI(int playernum) {
|
||||
// playerTypeRadios list contains human radio, AI radio, human, AI, etc
|
||||
// so playernum * 2 + 1 points to the appropriate AI radio.
|
||||
@@ -552,16 +614,18 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
}
|
||||
|
||||
private void changePlayerFocus(int newFocusOwner) {
|
||||
if (newFocusOwner != playerWithFocus) {
|
||||
playerWithFocus = newFocusOwner;
|
||||
playerPanelWithFocus = playerPanelList.get(playerWithFocus);
|
||||
changePlayerFocus(newFocusOwner, appliedVariants.contains(currentGameMode) ? currentGameMode : GameType.Constructed);
|
||||
}
|
||||
|
||||
changeAvatarFocus();
|
||||
playersScroll.getViewport().scrollRectToVisible(playerPanelWithFocus.getBounds());
|
||||
populateDeckPanel(false);
|
||||
private void changePlayerFocus(int newFocusOwner, GameType gType) {
|
||||
playerWithFocus = newFocusOwner;
|
||||
playerPanelWithFocus = playerPanelList.get(playerWithFocus);
|
||||
|
||||
refreshPanels(true, true);
|
||||
}
|
||||
changeAvatarFocus();
|
||||
playersScroll.getViewport().scrollRectToVisible(playerPanelWithFocus.getBounds());
|
||||
populateDeckPanel(gType);
|
||||
|
||||
refreshPanels(true, true);
|
||||
}
|
||||
|
||||
/** Changes avatar appearance dependant on focus player. */
|
||||
@@ -588,6 +652,26 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
prefs.save();
|
||||
}
|
||||
|
||||
/** Updates the avatars from preferences on update. */
|
||||
public void updatePlayersFromPrefs() {
|
||||
ForgePreferences prefs = Singletons.getModel().getPreferences();
|
||||
|
||||
// Avatar
|
||||
String[] avatarPrefs = prefs.getPref(FPref.UI_AVATARS).split(",");
|
||||
for (int i = 0; i < avatarPrefs.length; i++) {
|
||||
FLabel avatar = avatarList.get(i);
|
||||
int avatarIndex = Integer.parseInt(avatarPrefs[i]);
|
||||
avatar.setIcon(FSkin.getAvatars().get(avatarIndex));
|
||||
avatar.repaintSelf();
|
||||
usedAvatars.put(i, avatarIndex);
|
||||
}
|
||||
|
||||
// Name
|
||||
FTextField nameField = playerNameBtnList.get(0);
|
||||
String prefName = prefs.getPref(FPref.PLAYER_NAME);
|
||||
nameField.setText(StringUtils.isBlank(prefName) ? "Human" : prefName);
|
||||
}
|
||||
|
||||
/** Adds a pre-styled FLabel component with the specified title. */
|
||||
private FLabel newLabel(String title) {
|
||||
return new FLabel.Builder().text(title).fontSize(14).fontStyle(Font.ITALIC).build();
|
||||
@@ -625,33 +709,47 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent arg0) {
|
||||
FCheckBox cb = (FCheckBox) arg0.getSource();
|
||||
GameType variantType = GameType.Constructed;
|
||||
|
||||
if (cb == vntVanguard) {
|
||||
variantType = GameType.Vanguard;
|
||||
if (arg0.getStateChange() == ItemEvent.SELECTED) {
|
||||
appliedVariants.add(GameType.Vanguard);
|
||||
appliedVariants.add(variantType);
|
||||
} else {
|
||||
appliedVariants.remove(GameType.Vanguard);
|
||||
appliedVariants.remove(variantType);
|
||||
}
|
||||
}
|
||||
else if (cb == vntCommander) {
|
||||
variantType = GameType.Commander;
|
||||
if (arg0.getStateChange() == ItemEvent.SELECTED) {
|
||||
appliedVariants.add(GameType.Commander);
|
||||
appliedVariants.add(variantType);
|
||||
} else {
|
||||
appliedVariants.remove(GameType.Commander);
|
||||
appliedVariants.remove(variantType);
|
||||
}
|
||||
}
|
||||
else if (cb == vntPlanechase) {
|
||||
variantType = GameType.Planechase;
|
||||
if (arg0.getStateChange() == ItemEvent.SELECTED) {
|
||||
appliedVariants.add(GameType.Planechase);
|
||||
appliedVariants.add(variantType);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
plnDeckSelectorBtns.get(i).setVisible(true);
|
||||
plnEditors.get(i).setVisible(true);
|
||||
changePlayerFocus(playerWithFocus, variantType);
|
||||
}
|
||||
} else {
|
||||
appliedVariants.remove(GameType.Planechase);
|
||||
appliedVariants.remove(variantType);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
plnDeckSelectorBtns.get(i).setVisible(false);
|
||||
plnEditors.get(i).setVisible(false);
|
||||
changePlayerFocus(playerWithFocus, GameType.Constructed);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cb == vntArchenemy) {
|
||||
variantType = archenemyType.contains("Classic") ? GameType.Archenemy : GameType.ArchenemyRumble;
|
||||
comboArchenemy.setEnabled(vntArchenemy.isSelected());
|
||||
if (arg0.getStateChange() == ItemEvent.SELECTED) {
|
||||
appliedVariants.add(archenemyType.contains("Classic")
|
||||
? GameType.Archenemy : GameType.ArchenemyRumble);
|
||||
appliedVariants.add(variantType);
|
||||
} else {
|
||||
appliedVariants.remove(GameType.Archenemy);
|
||||
appliedVariants.remove(GameType.ArchenemyRumble);
|
||||
@@ -756,8 +854,8 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
if (source instanceof FTextField) { // the text box
|
||||
FTextField nField = (FTextField)source;
|
||||
String newName = nField.getText().trim();
|
||||
if (!StringUtils.isBlank(newName) && StringUtils.isAlphanumericSpace(newName) &&
|
||||
prefs.getPref(FPref.PLAYER_NAME) != newName) {
|
||||
if (playerNameBtnList.indexOf(nField) == 0 && !StringUtils.isBlank(newName)
|
||||
&& StringUtils.isAlphanumericSpace(newName) && prefs.getPref(FPref.PLAYER_NAME) != newName) {
|
||||
prefs.setPref(FPref.PLAYER_NAME, newName);
|
||||
prefs.save();
|
||||
}
|
||||
@@ -816,4 +914,20 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
public DragCell getParentCell() {
|
||||
return parentCell;
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
//========== STUFF FOR VARIANTS
|
||||
|
||||
public Set<GameType> getAppliedVariants() {
|
||||
return appliedVariants;
|
||||
}
|
||||
|
||||
public int getTeam(final int playerIndex) {
|
||||
return teams.get(playerIndex);
|
||||
}
|
||||
|
||||
/** Gets the list of planar deck lists. */
|
||||
public List<FList<Object>> getPlanarDeckLists() {
|
||||
return planarDeckLists;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,234 +0,0 @@
|
||||
package forge.gui.home.variant;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import forge.Command;
|
||||
import forge.Singletons;
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckSection;
|
||||
import forge.game.GameType;
|
||||
import forge.game.player.LobbyPlayer;
|
||||
import forge.game.player.RegisteredPlayer;
|
||||
import forge.gui.GuiDialog;
|
||||
import forge.gui.SOverlayUtils;
|
||||
import forge.gui.deckchooser.DeckgenUtil;
|
||||
import forge.gui.deckchooser.FDeckChooser;
|
||||
import forge.gui.deckeditor.CDeckEditorUI;
|
||||
import forge.gui.deckeditor.controllers.CEditorVariant;
|
||||
import forge.gui.framework.FScreen;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.gui.toolbox.FList;
|
||||
import forge.item.PaperCard;
|
||||
import forge.net.FServer;
|
||||
import forge.net.Lobby;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.util.Aggregates;
|
||||
|
||||
/**
|
||||
* Controls the constructed submenu in the home UI.
|
||||
*
|
||||
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
|
||||
*
|
||||
*/
|
||||
public enum CSubmenuPlanechase implements ICDoc {
|
||||
/** */
|
||||
SINGLETON_INSTANCE;
|
||||
private final VSubmenuPlanechase view = VSubmenuPlanechase.SINGLETON_INSTANCE;
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.home.ICSubmenu#initialize()
|
||||
*/
|
||||
@Override
|
||||
public void update() {
|
||||
// reinit deck lists and restore last selections (if any)
|
||||
for (FList<Object> deckList : view.getPlanarDeckLists()) {
|
||||
Vector<Object> listData = new Vector<Object>();
|
||||
|
||||
if(Singletons.getModel().getDecks().getPlane().size() == 0) {
|
||||
listData.add("Generate");
|
||||
}
|
||||
else {
|
||||
listData.add("Generate");
|
||||
listData.add("Random");
|
||||
for (Deck planarDeck : Singletons.getModel().getDecks().getPlane()) {
|
||||
listData.add(planarDeck);
|
||||
}
|
||||
}
|
||||
|
||||
Object val = deckList.getSelectedValue();
|
||||
deckList.setListData(listData);
|
||||
if (null != val) {
|
||||
deckList.setSelectedValue(val, true);
|
||||
}
|
||||
|
||||
if (-1 == deckList.getSelectedIndex()) {
|
||||
deckList.setSelectedIndex(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override public void run() { view.getBtnStart().requestFocusInWindow(); }
|
||||
});
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.home.ICSubmenu#initialize()
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@Override
|
||||
public void initialize() {
|
||||
VSubmenuPlanechase.SINGLETON_INSTANCE.getLblEditor().setCommand(new Command() {
|
||||
@Override
|
||||
public void run() {
|
||||
Predicate<PaperCard> predPlanes = new Predicate<PaperCard>() {
|
||||
@Override
|
||||
public boolean apply(PaperCard arg0) {
|
||||
return arg0.getRules().getType().isPlane() || arg0.getRules().getType().isPhenomenon();
|
||||
}
|
||||
};
|
||||
|
||||
Singletons.getControl().setCurrentScreen(FScreen.DECK_EDITOR_PLANECHASE);
|
||||
CDeckEditorUI.SINGLETON_INSTANCE.setEditorController(
|
||||
new CEditorVariant(Singletons.getModel().getDecks().getPlane(), predPlanes, FScreen.DECK_EDITOR_PLANECHASE));
|
||||
}
|
||||
});
|
||||
|
||||
final ForgePreferences prefs = Singletons.getModel().getPreferences();
|
||||
for (FDeckChooser fdc : view.getDeckChoosers()) {
|
||||
fdc.initialize();
|
||||
}
|
||||
|
||||
// Checkbox event handling
|
||||
view.getBtnStart().addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
startGame();
|
||||
}
|
||||
});
|
||||
|
||||
// Checkbox event handling
|
||||
view.getCbSingletons().addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
prefs.setPref(FPref.DECKGEN_SINGLETONS,
|
||||
String.valueOf(view.getCbSingletons().isSelected()));
|
||||
prefs.save();
|
||||
}
|
||||
});
|
||||
|
||||
view.getCbArtifacts().addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
prefs.setPref(
|
||||
FPref.DECKGEN_ARTIFACTS, String.valueOf(view.getCbArtifacts().isSelected()));
|
||||
prefs.save();
|
||||
}
|
||||
});
|
||||
|
||||
view.getCbRemoveSmall().addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
prefs.setPref(
|
||||
FPref.DECKGEN_NOSMALL, String.valueOf(view.getCbRemoveSmall().isSelected()));
|
||||
prefs.save();
|
||||
}
|
||||
});
|
||||
|
||||
// Pre-select checkboxes
|
||||
view.getCbSingletons().setSelected(prefs.getPrefBoolean(FPref.DECKGEN_SINGLETONS));
|
||||
view.getCbArtifacts().setSelected(prefs.getPrefBoolean(FPref.DECKGEN_ARTIFACTS));
|
||||
view.getCbRemoveSmall().setSelected(prefs.getPrefBoolean(FPref.DECKGEN_NOSMALL));
|
||||
}
|
||||
|
||||
|
||||
/** @param lists0   {@link java.util.List}<{@link javax.swing.JList}> */
|
||||
private void startGame() {
|
||||
Lobby lobby = FServer.instance.getLobby();
|
||||
List<RegisteredPlayer> helper = new ArrayList<RegisteredPlayer>();
|
||||
List<Deck> playerDecks = new ArrayList<Deck>();
|
||||
for (int i = 0; i < view.getNumPlayers(); i++) {
|
||||
RegisteredPlayer d = view.getDeckChoosers().get(i).getPlayer();
|
||||
|
||||
if (d == null) {
|
||||
//ERROR!
|
||||
GuiDialog.message("No deck selected for player " + (i + 1));
|
||||
return;
|
||||
}
|
||||
playerDecks.add(d.getDeck());
|
||||
|
||||
|
||||
List<PaperCard> planes = null;
|
||||
Object obj = view.getPlanarDeckLists().get(i).getSelectedValue();
|
||||
|
||||
boolean useDefault = VSubmenuPlanechase.SINGLETON_INSTANCE.getCbUseDefaultPlanes().isSelected();
|
||||
useDefault &= playerDecks.get(i).has(DeckSection.Planes);
|
||||
|
||||
System.out.println(useDefault);
|
||||
if (useDefault) {
|
||||
|
||||
planes = playerDecks.get(i).get(DeckSection.Planes).toFlatList();
|
||||
System.out.println(planes.toString());
|
||||
|
||||
} else {
|
||||
|
||||
if (obj instanceof String) {
|
||||
String sel = (String) obj;
|
||||
if (sel.equals("Random")) {
|
||||
if (view.getAllPlanarDecks().isEmpty()) {
|
||||
//Generate if no constructed scheme decks are available
|
||||
System.out.println("Generating planar deck - no others available");
|
||||
planes = DeckgenUtil.generatePlanarDeck().toFlatList();
|
||||
} else {
|
||||
System.out.println("Using planar deck: " + Aggregates.random(view.getAllPlanarDecks()).getName());
|
||||
planes = Aggregates.random(view.getAllPlanarDecks()).get(DeckSection.Planes).toFlatList();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
//Generate
|
||||
planes = DeckgenUtil.generatePlanarDeck().toFlatList();
|
||||
}
|
||||
} else {
|
||||
planes = ((Deck) obj).get(DeckSection.Planes).toFlatList();
|
||||
}
|
||||
}
|
||||
if (planes == null) {
|
||||
//ERROR!
|
||||
GuiDialog.message("No planar deck selected for player" + (i+1) + "!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (useDefault) {
|
||||
|
||||
GuiDialog.message("Player " + (i+1) + " will use a default planar deck.");
|
||||
}
|
||||
LobbyPlayer player = view.isPlayerAI(i) ? lobby.getAiPlayer() : lobby.getGuiPlayer();
|
||||
helper.add(RegisteredPlayer.forPlanechase(playerDecks.get(i), planes).setPlayer(player));
|
||||
}
|
||||
|
||||
SOverlayUtils.startGameOverlay();
|
||||
SOverlayUtils.showOverlay();
|
||||
|
||||
Singletons.getControl().startMatch(GameType.Planechase, helper);
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.framework.ICDoc#getCommandOnSelect()
|
||||
*/
|
||||
@Override
|
||||
public Command getCommandOnSelect() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,346 +0,0 @@
|
||||
package forge.gui.home.variant;
|
||||
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.deck.Deck;
|
||||
import forge.gui.deckchooser.FDeckChooser;
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.framework.DragTab;
|
||||
import forge.gui.framework.EDocID;
|
||||
import forge.gui.home.EMenuGroup;
|
||||
import forge.gui.home.IVSubmenu;
|
||||
import forge.gui.home.LblHeader;
|
||||
import forge.gui.home.StartButton;
|
||||
import forge.gui.home.VHomeUI;
|
||||
import forge.gui.toolbox.FCheckBox;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FList;
|
||||
import forge.gui.toolbox.FPanel;
|
||||
import forge.gui.toolbox.FRadioButton;
|
||||
import forge.gui.toolbox.FScrollPane;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FTabbedPane;
|
||||
|
||||
/**
|
||||
* Assembles Swing components of constructed submenu singleton.
|
||||
*
|
||||
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
|
||||
*
|
||||
*/
|
||||
public enum VSubmenuPlanechase implements IVSubmenu<CSubmenuPlanechase> {
|
||||
/** */
|
||||
SINGLETON_INSTANCE;
|
||||
|
||||
// Fields used with interface IVDoc
|
||||
private DragCell parentCell;
|
||||
private final DragTab tab = new DragTab("Planechase Mode");
|
||||
|
||||
/** */
|
||||
private final LblHeader lblTitle = new LblHeader("Variant: Planechase");
|
||||
|
||||
private final JPanel pnlStart = new JPanel(new MigLayout("insets 0, gap 0, wrap 2"));
|
||||
|
||||
private final StartButton btnStart = new StartButton();
|
||||
|
||||
private final JCheckBox cbSingletons = new FCheckBox("Singleton Mode");
|
||||
private final JCheckBox cbArtifacts = new FCheckBox("Remove Artifacts");
|
||||
private final JCheckBox cbRemoveSmall = new FCheckBox("Remove Small Creatures");
|
||||
|
||||
//////////////////////////////
|
||||
|
||||
private final FLabel lblEditor = new FLabel.ButtonBuilder().text("Planar Deck Editor").fontSize(16).build();
|
||||
private final FTabbedPane tabPane = new FTabbedPane();
|
||||
private final List<FPanel> playerPanels = new ArrayList<FPanel>();
|
||||
private final List<FDeckChooser> deckChoosers = new ArrayList<FDeckChooser>();
|
||||
private final List<FList<Object>> planarDeckLists = new ArrayList<FList<Object>>();
|
||||
private final List<Deck> allPlanarDecks = new ArrayList<Deck>();
|
||||
private final JCheckBox cbUseDefaultPlanes = new FCheckBox("Use default planar decks if possible.");
|
||||
private final List<JRadioButton> playerIsAIRadios = new ArrayList<JRadioButton>();
|
||||
private final List<JRadioButton> fieldRadios = new ArrayList<JRadioButton>();
|
||||
private final ButtonGroup grpFields = new ButtonGroup();
|
||||
private int currentNumTabsShown = 8;
|
||||
|
||||
//////////////////////////////
|
||||
|
||||
private VSubmenuPlanechase() {
|
||||
|
||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
//This listener will look for any of the radio buttons being selected
|
||||
//and call the method that shows/hides tabs appropriately.
|
||||
ItemListener iListener = new ItemListener() {
|
||||
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent arg0) {
|
||||
FRadioButton aButton = (FRadioButton) arg0.getSource();
|
||||
|
||||
if (arg0.getStateChange() == ItemEvent.SELECTED) {
|
||||
changeTabs(Integer.parseInt(aButton.getText()));
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//Create all 8 player settings panel
|
||||
FRadioButton tempRadio = null;
|
||||
FPanel tempPanel;
|
||||
FDeckChooser tempChooser;
|
||||
FList<Object> tempPlanarDeckList;
|
||||
|
||||
//Settings panel
|
||||
FPanel settingsPanel = new FPanel();
|
||||
settingsPanel.setLayout(new MigLayout("wrap 2, ax center"));
|
||||
FPanel radioPane = new FPanel();
|
||||
radioPane.setLayout(new MigLayout("wrap 1"));
|
||||
radioPane.setOpaque(false);
|
||||
radioPane.add(new FLabel.Builder().text("Set number of opponents").build(), "wrap");
|
||||
for (int i = 1; i < 8; i++) {
|
||||
tempRadio = new FRadioButton();
|
||||
tempRadio.setText(String.valueOf(i));
|
||||
fieldRadios.add(tempRadio);
|
||||
grpFields.add(tempRadio);
|
||||
tempRadio.setSelected(true);
|
||||
tempRadio.addItemListener(iListener);
|
||||
radioPane.add(tempRadio, "wrap,align 50% 50%");
|
||||
}
|
||||
settingsPanel.add(radioPane, "span 1 2");
|
||||
settingsPanel.add(cbUseDefaultPlanes);
|
||||
settingsPanel.add(lblEditor, "w pref + 24, h pref + 8, ax center");
|
||||
tabPane.add("Settings", settingsPanel);
|
||||
|
||||
//Player panels (Human + 7 AIs)
|
||||
for (int i = 0; i < 8; i++) {
|
||||
tempPanel = new FPanel();
|
||||
tempPanel.setLayout(new MigLayout("insets 0, gap 0 , wrap 2, flowy, ax center"));
|
||||
|
||||
tempChooser = new FDeckChooser(i != 0);
|
||||
tempChooser.initialize();
|
||||
|
||||
deckChoosers.add(tempChooser);
|
||||
|
||||
ButtonGroup tempBtnGroup = new ButtonGroup();
|
||||
FRadioButton tmpAI = new FRadioButton();
|
||||
tmpAI.setText("AI");
|
||||
tmpAI.setSelected(i != 0);
|
||||
FRadioButton tmpHuman = new FRadioButton();
|
||||
tmpHuman.setText("Human");
|
||||
tmpHuman.setSelected(i == 0);
|
||||
|
||||
FPanel typeBtnPanel = new FPanel();
|
||||
typeBtnPanel.add(tmpAI);
|
||||
typeBtnPanel.add(tmpHuman,"wrap");
|
||||
tempPanel.add(typeBtnPanel);
|
||||
|
||||
tempBtnGroup.add(tmpAI);
|
||||
tempBtnGroup.add(tmpHuman);
|
||||
playerIsAIRadios.add(tmpAI);
|
||||
|
||||
tempPanel.add(tempChooser, "span 1 2, w 55%!, gap 10px 10px 0px 10px, growy, pushy, wrap");
|
||||
|
||||
tempPanel.add(new FLabel.Builder().text("Select Planar deck:").build(), "gap 0px 0px 10px 10px, flowy");
|
||||
|
||||
tempPlanarDeckList = new FList<Object>();
|
||||
|
||||
tempPlanarDeckList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
||||
|
||||
FScrollPane scrPlanes = new FScrollPane(tempPlanarDeckList, true, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
tempPanel.add(scrPlanes, "h 90%, w 20%!, gap 0px 10px 0px 10px, growy, pushy, wrap");
|
||||
planarDeckLists.add(tempPlanarDeckList);
|
||||
|
||||
playerPanels.add(tempPanel);
|
||||
|
||||
tabPane.add("Player " + (i+1), tempPanel);
|
||||
}
|
||||
|
||||
final String strCheckboxConstraints = "h 30px!, gap 0 20px 0 0";
|
||||
pnlStart.setOpaque(false);
|
||||
pnlStart.add(cbSingletons, strCheckboxConstraints);
|
||||
pnlStart.add(btnStart, "span 1 3, growx, pushx, align center");
|
||||
pnlStart.add(cbArtifacts, strCheckboxConstraints);
|
||||
pnlStart.add(cbRemoveSmall, strCheckboxConstraints);
|
||||
}
|
||||
|
||||
public boolean isPlayerAI(int playernum) {
|
||||
return playerIsAIRadios.get(playernum).isSelected();
|
||||
}
|
||||
|
||||
private void changeTabs(int toShow) {
|
||||
if (toShow < currentNumTabsShown) {
|
||||
for (int i = currentNumTabsShown; i > toShow + 1; i--) {
|
||||
tabPane.remove(i);
|
||||
}
|
||||
currentNumTabsShown = tabPane.getComponentCount() - 1;
|
||||
}
|
||||
else {
|
||||
for (int i = currentNumTabsShown; i <= toShow; i++) {
|
||||
tabPane.add("Player " + i, playerPanels.get(i));
|
||||
}
|
||||
currentNumTabsShown = tabPane.getComponentCount() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.home.IVSubmenu#getGroupEnum()
|
||||
*/
|
||||
@Override
|
||||
public EMenuGroup getGroupEnum() {
|
||||
return EMenuGroup.VARIANT;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.home.IVSubmenu#getMenuTitle()
|
||||
*/
|
||||
@Override
|
||||
public String getMenuTitle() {
|
||||
return "Planechase";
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.home.IVSubmenu#getItemEnum()
|
||||
*/
|
||||
@Override
|
||||
public EDocID getItemEnum() {
|
||||
return EDocID.HOME_PLANECHASE;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.home.IVSubmenu#populate()
|
||||
*/
|
||||
@Override
|
||||
public void populate() {
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().removeAll();
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().setLayout(new MigLayout("insets 0, gap 0, wrap 1, ax right"));
|
||||
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblTitle, "w 80%!, h 40px!, gap 0 0 15px 15px, ax right");
|
||||
|
||||
for (FDeckChooser fdc : deckChoosers) {
|
||||
fdc.populate();
|
||||
}
|
||||
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(tabPane, "gap 20px 20px 20px 0px, pushx, pushy, growx, growy");
|
||||
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(pnlStart, "gap 0 0 3.5%! 3.5%!, ax center");
|
||||
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().revalidate();
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().repaintSelf();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** @return {@link javax.swing.JButton} */
|
||||
public JButton getBtnStart() {
|
||||
return this.btnStart;
|
||||
}
|
||||
|
||||
|
||||
/** @return {@link javax.swing.JCheckBox} */
|
||||
public JCheckBox getCbSingletons() {
|
||||
return cbSingletons;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JCheckBox} */
|
||||
public JCheckBox getCbArtifacts() {
|
||||
return cbArtifacts;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JCheckBox} */
|
||||
public JCheckBox getCbRemoveSmall() {
|
||||
return cbRemoveSmall;
|
||||
}
|
||||
|
||||
//========== Overridden from IVDoc
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.framework.IVDoc#getDocumentID()
|
||||
*/
|
||||
@Override
|
||||
public EDocID getDocumentID() {
|
||||
return EDocID.HOME_PLANECHASE;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.framework.IVDoc#getTabLabel()
|
||||
*/
|
||||
@Override
|
||||
public DragTab getTabLabel() {
|
||||
return tab;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.framework.IVDoc#getLayoutControl()
|
||||
*/
|
||||
@Override
|
||||
public CSubmenuPlanechase getLayoutControl() {
|
||||
return CSubmenuPlanechase.SINGLETON_INSTANCE;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.framework.IVDoc#setParentCell(forge.gui.framework.DragCell)
|
||||
*/
|
||||
@Override
|
||||
public void setParentCell(DragCell cell0) {
|
||||
this.parentCell = cell0;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.framework.IVDoc#getParentCell()
|
||||
*/
|
||||
@Override
|
||||
public DragCell getParentCell() {
|
||||
return parentCell;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return a deckchooser for every player
|
||||
*/
|
||||
public List<FDeckChooser> getDeckChoosers() {
|
||||
return deckChoosers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the currentNumTabsShown
|
||||
*/
|
||||
public int getNumPlayers() {
|
||||
return currentNumTabsShown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lblEditor
|
||||
*/
|
||||
public FLabel getLblEditor() {
|
||||
return lblEditor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cbUseDefaultPlanes
|
||||
*/
|
||||
public JCheckBox getCbUseDefaultPlanes() {
|
||||
return cbUseDefaultPlanes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the archenemySchemes
|
||||
*/
|
||||
public List<FList<Object>> getPlanarDeckLists() {
|
||||
return planarDeckLists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the allSchemeDecks
|
||||
*/
|
||||
public List<Deck> getAllPlanarDecks() {
|
||||
return allPlanarDecks;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user