mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Merge branch 'deck-editor' into 'master'
Deck Editor changes Closes #554 and #696 See merge request core-developers/forge!896
This commit is contained in:
@@ -6,11 +6,14 @@ package forge.gui.framework;
|
|||||||
import com.google.common.collect.ObjectArrays;
|
import com.google.common.collect.ObjectArrays;
|
||||||
|
|
||||||
import forge.screens.deckeditor.views.VAllDecks;
|
import forge.screens.deckeditor.views.VAllDecks;
|
||||||
|
import forge.screens.deckeditor.views.VBrawlDecks;
|
||||||
import forge.screens.deckeditor.views.VCardCatalog;
|
import forge.screens.deckeditor.views.VCardCatalog;
|
||||||
|
import forge.screens.deckeditor.views.VCommanderDecks;
|
||||||
import forge.screens.deckeditor.views.VCurrentDeck;
|
import forge.screens.deckeditor.views.VCurrentDeck;
|
||||||
import forge.screens.deckeditor.views.VDeckgen;
|
import forge.screens.deckeditor.views.VDeckgen;
|
||||||
import forge.screens.deckeditor.views.VProbabilities;
|
import forge.screens.deckeditor.views.VProbabilities;
|
||||||
import forge.screens.deckeditor.views.VStatistics;
|
import forge.screens.deckeditor.views.VStatistics;
|
||||||
|
import forge.screens.deckeditor.views.VTinyLeadersDecks;
|
||||||
import forge.screens.home.gauntlet.VSubmenuGauntletBuild;
|
import forge.screens.home.gauntlet.VSubmenuGauntletBuild;
|
||||||
import forge.screens.home.gauntlet.VSubmenuGauntletContests;
|
import forge.screens.home.gauntlet.VSubmenuGauntletContests;
|
||||||
import forge.screens.home.gauntlet.VSubmenuGauntletLoad;
|
import forge.screens.home.gauntlet.VSubmenuGauntletLoad;
|
||||||
@@ -54,6 +57,9 @@ public enum EDocID {
|
|||||||
EDITOR_CATALOG (VCardCatalog.SINGLETON_INSTANCE),
|
EDITOR_CATALOG (VCardCatalog.SINGLETON_INSTANCE),
|
||||||
EDITOR_CURRENTDECK (VCurrentDeck.SINGLETON_INSTANCE),
|
EDITOR_CURRENTDECK (VCurrentDeck.SINGLETON_INSTANCE),
|
||||||
EDITOR_DECKGEN (VDeckgen.SINGLETON_INSTANCE),
|
EDITOR_DECKGEN (VDeckgen.SINGLETON_INSTANCE),
|
||||||
|
EDITOR_COMMANDER (VCommanderDecks.SINGLETON_INSTANCE),
|
||||||
|
EDITOR_BRAWL (VBrawlDecks.SINGLETON_INSTANCE),
|
||||||
|
EDITOR_TINY_LEADERS (VTinyLeadersDecks.SINGLETON_INSTANCE),
|
||||||
|
|
||||||
WORKSHOP_CATALOG (VWorkshopCatalog.SINGLETON_INSTANCE),
|
WORKSHOP_CATALOG (VWorkshopCatalog.SINGLETON_INSTANCE),
|
||||||
WORKSHOP_CARDDESIGNER (VCardDesigner.SINGLETON_INSTANCE),
|
WORKSHOP_CARDDESIGNER (VCardDesigner.SINGLETON_INSTANCE),
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import javax.xml.stream.events.XMLEvent;
|
|||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
|
import forge.error.BugReporter;
|
||||||
import forge.gui.SOverlayUtils;
|
import forge.gui.SOverlayUtils;
|
||||||
import forge.properties.FileLocation;
|
import forge.properties.FileLocation;
|
||||||
import forge.properties.ForgeConstants;
|
import forge.properties.ForgeConstants;
|
||||||
@@ -36,6 +37,7 @@ import forge.toolbox.SaveOpenDialog;
|
|||||||
import forge.toolbox.SaveOpenDialog.Filetypes;
|
import forge.toolbox.SaveOpenDialog.Filetypes;
|
||||||
import forge.util.CollectionSuppliers;
|
import forge.util.CollectionSuppliers;
|
||||||
import forge.util.ThreadUtil;
|
import forge.util.ThreadUtil;
|
||||||
|
import forge.util.gui.SOptionPane;
|
||||||
import forge.util.maps.HashMapOfLists;
|
import forge.util.maps.HashMapOfLists;
|
||||||
import forge.util.maps.MapOfLists;
|
import forge.util.maps.MapOfLists;
|
||||||
import forge.view.FFrame;
|
import forge.view.FFrame;
|
||||||
@@ -307,6 +309,8 @@ public final class SLayoutIO {
|
|||||||
FileOutputStream fos = null;
|
FileOutputStream fos = null;
|
||||||
XMLEventWriter writer = null;
|
XMLEventWriter writer = null;
|
||||||
try {
|
try {
|
||||||
|
String layoutSerial = getLayoutSerial(file.defaultLoc);
|
||||||
|
|
||||||
fos = new FileOutputStream(fWriteTo);
|
fos = new FileOutputStream(fWriteTo);
|
||||||
writer = out.createXMLEventWriter(fos);
|
writer = out.createXMLEventWriter(fos);
|
||||||
final List<DragCell> cells = FView.SINGLETON_INSTANCE.getDragCells();
|
final List<DragCell> cells = FView.SINGLETON_INSTANCE.getDragCells();
|
||||||
@@ -314,6 +318,7 @@ public final class SLayoutIO {
|
|||||||
writer.add(EF.createStartDocument());
|
writer.add(EF.createStartDocument());
|
||||||
writer.add(NEWLINE);
|
writer.add(NEWLINE);
|
||||||
writer.add(EF.createStartElement("", "", "layout"));
|
writer.add(EF.createStartElement("", "", "layout"));
|
||||||
|
writer.add(EF.createAttribute("serial", layoutSerial));
|
||||||
writer.add(NEWLINE);
|
writer.add(NEWLINE);
|
||||||
|
|
||||||
for (final DragCell cell : cells) {
|
for (final DragCell cell : cells) {
|
||||||
@@ -356,8 +361,63 @@ public final class SLayoutIO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getLayoutSerial(String layoutFileName) {
|
||||||
|
final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
|
||||||
|
FileInputStream fis = null;
|
||||||
|
XMLEventReader reader = null;
|
||||||
|
XMLEvent event;
|
||||||
|
StartElement element;
|
||||||
|
Iterator<?> attributes;
|
||||||
|
Attribute attribute;
|
||||||
|
|
||||||
|
try {
|
||||||
|
fis = new FileInputStream(layoutFileName);
|
||||||
|
|
||||||
|
reader = inputFactory.createXMLEventReader(fis);
|
||||||
|
while (null != reader && reader.hasNext()) {
|
||||||
|
event = reader.nextEvent();
|
||||||
|
|
||||||
|
if (event.isStartElement()) {
|
||||||
|
element = event.asStartElement();
|
||||||
|
|
||||||
|
if (element.getName().getLocalPart().equals("layout")) {
|
||||||
|
attributes = element.getAttributes();
|
||||||
|
while (attributes.hasNext()) {
|
||||||
|
attribute = (Attribute) attributes.next();
|
||||||
|
String atrName = attribute.getName().toString();
|
||||||
|
if (atrName.equals("serial")) {
|
||||||
|
return attribute.getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (final Exception e) { // I don't care what happened inside, the layout is wrong
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
if (reader != null) {
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
|
if (fis != null) {
|
||||||
|
fis.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
public static void loadLayout(final File f) {
|
public static void loadLayout(final File f) {
|
||||||
final FView view = FView.SINGLETON_INSTANCE;
|
final FView view = FView.SINGLETON_INSTANCE;
|
||||||
|
String defaultLayoutSerial = "";
|
||||||
|
String userLayoutSerial = "";
|
||||||
|
Boolean resetLayout = false;
|
||||||
|
FScreen screen = Singletons.getControl().getCurrentScreen();
|
||||||
FAbsolutePositioner.SINGLETON_INSTANCE.hideAll();
|
FAbsolutePositioner.SINGLETON_INSTANCE.hideAll();
|
||||||
view.getPnlInsets().removeAll();
|
view.getPnlInsets().removeAll();
|
||||||
view.getPnlInsets().setLayout(new BorderLayout());
|
view.getPnlInsets().setLayout(new BorderLayout());
|
||||||
@@ -365,7 +425,7 @@ public final class SLayoutIO {
|
|||||||
view.getPnlInsets().setBorder(new EmptyBorder(SLayoutConstants.BORDER_T, SLayoutConstants.BORDER_T, 0, 0));
|
view.getPnlInsets().setBorder(new EmptyBorder(SLayoutConstants.BORDER_T, SLayoutConstants.BORDER_T, 0, 0));
|
||||||
view.removeAllDragCells();
|
view.removeAllDragCells();
|
||||||
|
|
||||||
FileLocation file = Singletons.getControl().getCurrentScreen().getLayoutFile();
|
FileLocation file = screen.getLayoutFile();
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
// Read a model for new layout
|
// Read a model for new layout
|
||||||
MapOfLists<LayoutInfo, EDocID> model = null;
|
MapOfLists<LayoutInfo, EDocID> model = null;
|
||||||
@@ -379,8 +439,27 @@ public final class SLayoutIO {
|
|||||||
else {
|
else {
|
||||||
File userSetting = new File(file.userPrefLoc);
|
File userSetting = new File(file.userPrefLoc);
|
||||||
if (userSetting.exists()) {
|
if (userSetting.exists()) {
|
||||||
usedCustomPrefsFile = true;
|
defaultLayoutSerial = getLayoutSerial(file.defaultLoc);
|
||||||
|
userLayoutSerial = getLayoutSerial(file.userPrefLoc);
|
||||||
|
if (defaultLayoutSerial.compareTo(userLayoutSerial) > 0) {
|
||||||
|
// prompt the user that their saved layout is older
|
||||||
|
resetLayout = SOptionPane.showConfirmDialog(
|
||||||
|
String.format("Your %s layout file is from an older template.",
|
||||||
|
screen.getTabCaption()
|
||||||
|
),
|
||||||
|
"Reset Layout?",
|
||||||
|
"Reset",
|
||||||
|
"Keep");
|
||||||
|
}
|
||||||
|
if (resetLayout) {
|
||||||
|
// delete the old layout file
|
||||||
|
screen.deleteLayoutFile();
|
||||||
|
fis = new FileInputStream(file.defaultLoc);
|
||||||
|
} else {
|
||||||
fis = new FileInputStream(userSetting);
|
fis = new FileInputStream(userSetting);
|
||||||
|
usedCustomPrefsFile = true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fis = new FileInputStream(file.defaultLoc);
|
fis = new FileInputStream(file.defaultLoc);
|
||||||
@@ -413,15 +492,15 @@ public final class SLayoutIO {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if (fis != null) {
|
|
||||||
try {
|
try {
|
||||||
|
if (fis != null) {
|
||||||
fis.close();
|
fis.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Apply new layout
|
// Apply new layout
|
||||||
for (Entry<LayoutInfo, Collection<EDocID>> kv : model.entrySet()) {
|
for (Entry<LayoutInfo, Collection<EDocID>> kv : model.entrySet()) {
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import javax.swing.JTable;
|
|||||||
import javax.swing.event.ListSelectionEvent;
|
import javax.swing.event.ListSelectionEvent;
|
||||||
import javax.swing.event.ListSelectionListener;
|
import javax.swing.event.ListSelectionListener;
|
||||||
|
|
||||||
|
import forge.deck.Deck;
|
||||||
|
import forge.screens.deckeditor.controllers.CEditorConstructed;
|
||||||
import forge.screens.home.quest.DialogChooseFormats;
|
import forge.screens.home.quest.DialogChooseFormats;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@@ -267,9 +269,7 @@ public final class DeckManager extends ItemManager<DeckProxy> implements IHasGam
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editDeck(final DeckProxy deck) {
|
public void editDeck(final DeckProxy deck) {
|
||||||
if (deck == null) { return; }
|
|
||||||
|
|
||||||
ACEditorBase<? extends InventoryItem, ? extends DeckBase> editorCtrl = null;
|
ACEditorBase<? extends InventoryItem, ? extends DeckBase> editorCtrl = null;
|
||||||
FScreen screen = null;
|
FScreen screen = null;
|
||||||
|
|
||||||
@@ -280,8 +280,23 @@ public final class DeckManager extends ItemManager<DeckProxy> implements IHasGam
|
|||||||
break;
|
break;
|
||||||
case Constructed:
|
case Constructed:
|
||||||
screen = FScreen.DECK_EDITOR_CONSTRUCTED;
|
screen = FScreen.DECK_EDITOR_CONSTRUCTED;
|
||||||
DeckPreferences.setCurrentDeck(deck.toString());
|
DeckPreferences.setCurrentDeck((deck != null) ? deck.toString() : "");
|
||||||
//re-use constructed controller
|
editorCtrl = new CEditorConstructed(getCDetailPicture(), this.gameType);
|
||||||
|
break;
|
||||||
|
case Commander:
|
||||||
|
screen = FScreen.DECK_EDITOR_CONSTRUCTED; // re-use "Deck Editor", rather than creating a new top level tab
|
||||||
|
DeckPreferences.setCommanderDeck((deck != null) ? deck.toString() : "");
|
||||||
|
editorCtrl = new CEditorConstructed(getCDetailPicture(), this.gameType);
|
||||||
|
break;
|
||||||
|
case Brawl:
|
||||||
|
screen = FScreen.DECK_EDITOR_CONSTRUCTED; // re-use "Deck Editor", rather than creating a new top level tab
|
||||||
|
DeckPreferences.setBrawlDeck((deck != null) ? deck.toString() : "");
|
||||||
|
editorCtrl = new CEditorConstructed(getCDetailPicture(), this.gameType);
|
||||||
|
break;
|
||||||
|
case TinyLeaders:
|
||||||
|
screen = FScreen.DECK_EDITOR_CONSTRUCTED; // re-use "Deck Editor", rather than creating a new top level tab
|
||||||
|
DeckPreferences.setTinyLeadersDeck((deck != null) ? deck.toString() : "");
|
||||||
|
editorCtrl = new CEditorConstructed(getCDetailPicture(), this.gameType);
|
||||||
break;
|
break;
|
||||||
case Sealed:
|
case Sealed:
|
||||||
screen = FScreen.DECK_EDITOR_SEALED;
|
screen = FScreen.DECK_EDITOR_SEALED;
|
||||||
@@ -300,15 +315,23 @@ public final class DeckManager extends ItemManager<DeckProxy> implements IHasGam
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Singletons.getControl().ensureScreenActive(screen)) { return; }
|
if (!Singletons.getControl().ensureScreenActive(screen)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (editorCtrl != null) {
|
if (editorCtrl != null) {
|
||||||
CDeckEditorUI.SINGLETON_INSTANCE.setEditorController(editorCtrl);
|
CDeckEditorUI.SINGLETON_INSTANCE.setEditorController(editorCtrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SEditorIO.confirmSaveChanges(screen, true)) { return; } //ensure previous deck on screen is saved if needed
|
if (!SEditorIO.confirmSaveChanges(screen, true)) {
|
||||||
|
return;
|
||||||
|
} //ensure previous deck on screen is saved if needed
|
||||||
|
|
||||||
|
if (deck != null) {
|
||||||
CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController().getDeckController().load(deck.getPath(), deck.getName());
|
CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController().getDeckController().load(deck.getPath(), deck.getName());
|
||||||
|
} else {
|
||||||
|
CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController().getDeckController().loadDeck(new Deck());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean deleteDeck(final DeckProxy deck) {
|
public boolean deleteDeck(final DeckProxy deck) {
|
||||||
@@ -322,6 +345,9 @@ public final class DeckManager extends ItemManager<DeckProxy> implements IHasGam
|
|||||||
|
|
||||||
// consider using deck proxy's method to delete deck
|
// consider using deck proxy's method to delete deck
|
||||||
switch(this.gameType) {
|
switch(this.gameType) {
|
||||||
|
case Brawl:
|
||||||
|
case Commander:
|
||||||
|
case TinyLeaders:
|
||||||
case Constructed:
|
case Constructed:
|
||||||
case Draft:
|
case Draft:
|
||||||
case Sealed:
|
case Sealed:
|
||||||
|
|||||||
@@ -30,12 +30,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import javax.swing.JMenu;
|
import javax.swing.*;
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
import javax.swing.KeyStroke;
|
|
||||||
import javax.swing.SwingConstants;
|
|
||||||
import javax.swing.SwingUtilities;
|
|
||||||
import javax.swing.event.ListSelectionListener;
|
import javax.swing.event.ListSelectionListener;
|
||||||
import javax.swing.event.PopupMenuEvent;
|
import javax.swing.event.PopupMenuEvent;
|
||||||
import javax.swing.event.PopupMenuListener;
|
import javax.swing.event.PopupMenuListener;
|
||||||
@@ -58,6 +53,7 @@ import forge.itemmanager.views.ItemTableColumn;
|
|||||||
import forge.itemmanager.views.ItemView;
|
import forge.itemmanager.views.ItemView;
|
||||||
import forge.screens.match.controllers.CDetailPicture;
|
import forge.screens.match.controllers.CDetailPicture;
|
||||||
import forge.toolbox.ContextMenuBuilder;
|
import forge.toolbox.ContextMenuBuilder;
|
||||||
|
import forge.toolbox.FComboBox;
|
||||||
import forge.toolbox.FLabel;
|
import forge.toolbox.FLabel;
|
||||||
import forge.toolbox.FSkin;
|
import forge.toolbox.FSkin;
|
||||||
import forge.toolbox.FSkin.Colors;
|
import forge.toolbox.FSkin.Colors;
|
||||||
@@ -115,13 +111,11 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
|
|||||||
.fontSize(12)
|
.fontSize(12)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
private final FLabel btnCycleSection = new FLabel.Builder()
|
private final FLabel lblEmpty = new FLabel.Builder()
|
||||||
.text("Change Section")
|
.text("")
|
||||||
.tooltip("Toggle between editing the deck and the sideboard/planar/scheme/vanguard parts of this deck")
|
|
||||||
.icon(FSkin.getIcon(FSkinProp.ICO_EDIT))
|
|
||||||
.iconScaleAuto(false).hoverable()
|
|
||||||
.fontSize(12)
|
.fontSize(12)
|
||||||
.build();
|
.build();
|
||||||
|
private FComboBox cbxSection = new FComboBox();
|
||||||
|
|
||||||
private static final SkinIcon VIEW_OPTIONS_ICON = FSkin.getIcon(FSkinProp.ICO_SETTINGS).resize(20, 20);
|
private static final SkinIcon VIEW_OPTIONS_ICON = FSkin.getIcon(FSkinProp.ICO_SETTINGS).resize(20, 20);
|
||||||
private final FLabel btnViewOptions = new FLabel.Builder()
|
private final FLabel btnViewOptions = new FLabel.Builder()
|
||||||
@@ -193,8 +187,9 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
|
|||||||
this.add(this.btnFilters);
|
this.add(this.btnFilters);
|
||||||
this.add(this.lblCaption);
|
this.add(this.lblCaption);
|
||||||
this.add(this.lblRatio);
|
this.add(this.lblRatio);
|
||||||
btnCycleSection.setVisible(false); //hide by default
|
this.add(this.lblEmpty);
|
||||||
this.add(btnCycleSection);
|
this.cbxSection.setVisible(false);
|
||||||
|
this.add(this.cbxSection);
|
||||||
for (final ItemView<T> view : this.views) {
|
for (final ItemView<T> view : this.views) {
|
||||||
this.add(view.getButton());
|
this.add(view.getButton());
|
||||||
view.getButton().setSelected(view == this.currentView);
|
view.getButton().setSelected(view == this.currentView);
|
||||||
@@ -381,30 +376,42 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
|
|||||||
helper.newLine(-3);
|
helper.newLine(-3);
|
||||||
helper.fillLine(this.pnlButtons, showButtonPanel ? buttonPanelHeight : 1); //just show border if no buttons
|
helper.fillLine(this.pnlButtons, showButtonPanel ? buttonPanelHeight : 1); //just show border if no buttons
|
||||||
}
|
}
|
||||||
|
// get the width for all components
|
||||||
final int viewButtonWidth = FTextField.HEIGHT;
|
final int viewButtonWidth = FTextField.HEIGHT;
|
||||||
helper.newLine();
|
|
||||||
helper.offset(1, 0); //align filters button with expand/collapse all button
|
|
||||||
helper.include(this.btnFilters, viewButtonWidth, FTextField.HEIGHT);
|
|
||||||
int captionWidth = this.lblCaption.getAutoSizeWidth();
|
|
||||||
int btnCycleSectionWidth = this.btnCycleSection.isVisible() ? this.btnCycleSection.getAutoSizeWidth() : 0;
|
|
||||||
final int ratioWidth = this.lblRatio.getAutoSizeWidth();
|
final int ratioWidth = this.lblRatio.getAutoSizeWidth();
|
||||||
final int viewButtonCount = this.views.size() + 1;
|
int captionWidth = this.lblCaption.getAutoSizeWidth();
|
||||||
final int availableCaptionWidth = helper.getParentWidth() - viewButtonWidth * viewButtonCount - ratioWidth - btnCycleSectionWidth - 3 * helper.getX() - (viewButtonCount + 2) * helper.getGapX();
|
final int cbxSectionWidth = this.cbxSection.isVisible() ? this.cbxSection.getAutoSizeWidth() : 0;
|
||||||
|
final int viewButtonCount = this.views.size() + 1; // +1 is for the options button
|
||||||
|
final int widthViewButtons = viewButtonCount * viewButtonWidth + helper.getGapX() * (viewButtonCount);
|
||||||
|
|
||||||
|
// remove the space needed by all components that will be displayed
|
||||||
|
int availableCaptionWidth = helper.getParentWidth()
|
||||||
|
- viewButtonWidth // btnFilters
|
||||||
|
- cbxSectionWidth
|
||||||
|
- ratioWidth
|
||||||
|
- widthViewButtons;
|
||||||
|
|
||||||
if (captionWidth > availableCaptionWidth) { //truncate caption if not enough room for it
|
if (captionWidth > availableCaptionWidth) { //truncate caption if not enough room for it
|
||||||
this.lblCaption.setToolTipText(this.lblCaption.getText());
|
this.lblCaption.setToolTipText(this.lblCaption.getText());
|
||||||
captionWidth = availableCaptionWidth;
|
captionWidth = availableCaptionWidth;
|
||||||
} else {
|
} else {
|
||||||
this.lblCaption.setToolTipText(null);
|
this.lblCaption.setToolTipText(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
helper.newLine();
|
||||||
|
helper.offset(1, 0); //align filters button with expand/collapse all button
|
||||||
|
helper.include(this.btnFilters, viewButtonWidth, FTextField.HEIGHT);
|
||||||
helper.include(this.lblCaption, captionWidth, FTextField.HEIGHT);
|
helper.include(this.lblCaption, captionWidth, FTextField.HEIGHT);
|
||||||
helper.fillLine(this.lblRatio, FTextField.HEIGHT, (viewButtonWidth + helper.getGapX()) * viewButtonCount - viewButtonCount + btnCycleSectionWidth + 2 * helper.getGapX() + 1); //leave room for view buttons and btnCycleSectionWidth
|
helper.include(this.cbxSection, cbxSectionWidth, FTextField.HEIGHT);
|
||||||
helper.include(this.btnCycleSection, btnCycleSectionWidth, FTextField.HEIGHT);
|
|
||||||
helper.offset(helper.getGapX(), 0);
|
helper.offset(helper.getGapX(), 0);
|
||||||
|
helper.include(this.lblRatio, ratioWidth, FTextField.HEIGHT);
|
||||||
|
helper.fillLine(this.lblEmpty, FTextField.HEIGHT, widthViewButtons);
|
||||||
for (final ItemView<T> view : this.views) {
|
for (final ItemView<T> view : this.views) {
|
||||||
helper.include(view.getButton(), viewButtonWidth, FTextField.HEIGHT);
|
helper.include(view.getButton(), viewButtonWidth, FTextField.HEIGHT);
|
||||||
helper.offset(-1, 0);
|
helper.offset(-1, 0);
|
||||||
}
|
}
|
||||||
helper.include(this.btnViewOptions, viewButtonWidth, FTextField.HEIGHT);
|
helper.include(this.btnViewOptions, viewButtonWidth, FTextField.HEIGHT);
|
||||||
|
|
||||||
helper.newLine(-1);
|
helper.newLine(-1);
|
||||||
if (this.currentView.getPnlOptions().isVisible()) {
|
if (this.currentView.getPnlOptions().isVisible()) {
|
||||||
helper.fillLine(this.currentView.getPnlOptions(), FTextField.HEIGHT + 4);
|
helper.fillLine(this.currentView.getPnlOptions(), FTextField.HEIGHT + 4);
|
||||||
@@ -1092,8 +1099,8 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
|
|||||||
return this.pnlButtons;
|
return this.pnlButtons;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FLabel getBtnCycleSection() {
|
public FComboBox getCbxSection() {
|
||||||
return btnCycleSection;
|
return this.cbxSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -38,8 +38,11 @@ import forge.item.InventoryItem;
|
|||||||
import forge.itemmanager.ItemManager;
|
import forge.itemmanager.ItemManager;
|
||||||
import forge.screens.deckeditor.controllers.*;
|
import forge.screens.deckeditor.controllers.*;
|
||||||
import forge.screens.deckeditor.views.VAllDecks;
|
import forge.screens.deckeditor.views.VAllDecks;
|
||||||
|
import forge.screens.deckeditor.views.VBrawlDecks;
|
||||||
import forge.screens.deckeditor.views.VCardCatalog;
|
import forge.screens.deckeditor.views.VCardCatalog;
|
||||||
|
import forge.screens.deckeditor.views.VCommanderDecks;
|
||||||
import forge.screens.deckeditor.views.VCurrentDeck;
|
import forge.screens.deckeditor.views.VCurrentDeck;
|
||||||
|
import forge.screens.deckeditor.views.VTinyLeadersDecks;
|
||||||
import forge.screens.match.controllers.CDetailPicture;
|
import forge.screens.match.controllers.CDetailPicture;
|
||||||
import forge.util.ItemPool;
|
import forge.util.ItemPool;
|
||||||
|
|
||||||
@@ -59,12 +62,21 @@ public enum CDeckEditorUI implements ICDoc {
|
|||||||
private ACEditorBase<? extends InventoryItem, ? extends DeckBase> childController;
|
private ACEditorBase<? extends InventoryItem, ? extends DeckBase> childController;
|
||||||
private final CDetailPicture cDetailPicture;
|
private final CDetailPicture cDetailPicture;
|
||||||
private final VAllDecks vAllDecks;
|
private final VAllDecks vAllDecks;
|
||||||
|
private final VCommanderDecks vCommanderDecks;
|
||||||
|
private final VBrawlDecks vBrawlDecks;
|
||||||
|
private final VTinyLeadersDecks vTinyLeadersDecks;
|
||||||
|
|
||||||
private CDeckEditorUI() {
|
private CDeckEditorUI() {
|
||||||
screenChildControllers = new HashMap<FScreen, ACEditorBase<? extends InventoryItem, ? extends DeckBase>>();
|
screenChildControllers = new HashMap<FScreen, ACEditorBase<? extends InventoryItem, ? extends DeckBase>>();
|
||||||
this.cDetailPicture = new CDetailPicture();
|
this.cDetailPicture = new CDetailPicture();
|
||||||
this.vAllDecks = VAllDecks.SINGLETON_INSTANCE;
|
this.vAllDecks = VAllDecks.SINGLETON_INSTANCE;
|
||||||
this.vAllDecks.setCDetailPicture(cDetailPicture);
|
this.vAllDecks.setCDetailPicture(cDetailPicture);
|
||||||
|
this.vCommanderDecks = VCommanderDecks.SINGLETON_INSTANCE;
|
||||||
|
this.vCommanderDecks.setCDetailPicture(cDetailPicture);
|
||||||
|
this.vBrawlDecks = VBrawlDecks.SINGLETON_INSTANCE;
|
||||||
|
this.vBrawlDecks.setCDetailPicture(cDetailPicture);
|
||||||
|
this.vTinyLeadersDecks = VTinyLeadersDecks.SINGLETON_INSTANCE;
|
||||||
|
this.vTinyLeadersDecks.setCDetailPicture(cDetailPicture);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CDetailPicture getCDetailPicture() {
|
public CDetailPicture getCDetailPicture() {
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import forge.screens.deckeditor.views.VCardCatalog;
|
|||||||
import forge.screens.deckeditor.views.VCurrentDeck;
|
import forge.screens.deckeditor.views.VCurrentDeck;
|
||||||
import forge.screens.match.controllers.CDetailPicture;
|
import forge.screens.match.controllers.CDetailPicture;
|
||||||
import forge.toolbox.ContextMenuBuilder;
|
import forge.toolbox.ContextMenuBuilder;
|
||||||
|
import forge.toolbox.FComboBox;
|
||||||
import forge.toolbox.FLabel;
|
import forge.toolbox.FLabel;
|
||||||
import forge.toolbox.FSkin;
|
import forge.toolbox.FSkin;
|
||||||
import forge.util.Aggregates;
|
import forge.util.Aggregates;
|
||||||
@@ -389,7 +390,7 @@ public abstract class ACEditorBase<TItem extends InventoryItem, TModel extends D
|
|||||||
VCardCatalog.SINGLETON_INSTANCE.getTabLabel().setText("Card Catalog");
|
VCardCatalog.SINGLETON_INSTANCE.getTabLabel().setText("Card Catalog");
|
||||||
|
|
||||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnPrintProxies().setVisible(true);
|
VCurrentDeck.SINGLETON_INSTANCE.getBtnPrintProxies().setVisible(true);
|
||||||
getBtnCycleSection().setVisible(false);
|
getCbxSection().setVisible(false);
|
||||||
|
|
||||||
VCurrentDeck.SINGLETON_INSTANCE.getTxfTitle().setVisible(true);
|
VCurrentDeck.SINGLETON_INSTANCE.getTxfTitle().setVisible(true);
|
||||||
VCurrentDeck.SINGLETON_INSTANCE.getLblTitle().setText("Title:");
|
VCurrentDeck.SINGLETON_INSTANCE.getLblTitle().setText("Title:");
|
||||||
@@ -400,7 +401,7 @@ public abstract class ACEditorBase<TItem extends InventoryItem, TModel extends D
|
|||||||
public FLabel getBtnRemove() { return btnRemove; }
|
public FLabel getBtnRemove() { return btnRemove; }
|
||||||
public FLabel getBtnRemove4() { return btnRemove4; }
|
public FLabel getBtnRemove4() { return btnRemove4; }
|
||||||
public FLabel getBtnAddBasicLands() { return btnAddBasicLands; }
|
public FLabel getBtnAddBasicLands() { return btnAddBasicLands; }
|
||||||
public FLabel getBtnCycleSection() { return deckManager.getBtnCycleSection(); }
|
public FComboBox getCbxSection() { return deckManager.getCbxSection(); }
|
||||||
|
|
||||||
public ContextMenuBuilder createContextMenuBuilder(final boolean isAddContextMenu0) {
|
public ContextMenuBuilder createContextMenuBuilder(final boolean isAddContextMenu0) {
|
||||||
return new EditorContextMenuBuilder(isAddContextMenu0);
|
return new EditorContextMenuBuilder(isAddContextMenu0);
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package forge.screens.deckeditor.controllers;
|
||||||
|
|
||||||
|
import forge.deck.DeckProxy;
|
||||||
|
import forge.gui.framework.ICDoc;
|
||||||
|
import forge.itemmanager.ItemManagerConfig;
|
||||||
|
import forge.screens.deckeditor.views.VBrawlDecks;
|
||||||
|
import forge.screens.deckeditor.views.VCommanderDecks;
|
||||||
|
import forge.screens.deckeditor.views.VTinyLeadersDecks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls the "Commander Decks" panel in the deck editor UI.
|
||||||
|
*
|
||||||
|
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum CBrawlDecks implements ICDoc {
|
||||||
|
SINGLETON_INSTANCE;
|
||||||
|
|
||||||
|
private final VBrawlDecks view = VBrawlDecks.SINGLETON_INSTANCE;
|
||||||
|
|
||||||
|
//========== Overridden methods
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.ICDoc#initialize()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void refresh() {
|
||||||
|
view.getLstDecks().setPool(DeckProxy.getAllBrawlDecks());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.ICDoc#update()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
view.getLstDecks().setup(ItemManagerConfig.CONSTRUCTED_DECKS);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package forge.screens.deckeditor.controllers;
|
||||||
|
|
||||||
|
import forge.deck.DeckProxy;
|
||||||
|
import forge.gui.framework.ICDoc;
|
||||||
|
import forge.itemmanager.ItemManagerConfig;
|
||||||
|
import forge.screens.deckeditor.views.VAllDecks;
|
||||||
|
import forge.screens.deckeditor.views.VCommanderDecks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls the "Commander Decks" panel in the deck editor UI.
|
||||||
|
*
|
||||||
|
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum CCommanderDecks implements ICDoc {
|
||||||
|
SINGLETON_INSTANCE;
|
||||||
|
|
||||||
|
private final VCommanderDecks view = VCommanderDecks.SINGLETON_INSTANCE;
|
||||||
|
|
||||||
|
//========== Overridden methods
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.ICDoc#initialize()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void refresh() {
|
||||||
|
view.getLstDecks().setPool(DeckProxy.getAllCommanderDecks());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.ICDoc#update()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
view.getLstDecks().setup(ItemManagerConfig.CONSTRUCTED_DECKS);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,8 +35,11 @@ import forge.screens.deckeditor.SEditorIO;
|
|||||||
import forge.screens.deckeditor.views.VAllDecks;
|
import forge.screens.deckeditor.views.VAllDecks;
|
||||||
import forge.screens.deckeditor.views.VDeckgen;
|
import forge.screens.deckeditor.views.VDeckgen;
|
||||||
import forge.screens.match.controllers.CDetailPicture;
|
import forge.screens.match.controllers.CDetailPicture;
|
||||||
|
import forge.toolbox.FComboBox;
|
||||||
import forge.util.ItemPool;
|
import forge.util.ItemPool;
|
||||||
|
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@@ -191,15 +194,20 @@ public final class CEditorCommander extends CDeckEditor<Deck> {
|
|||||||
|
|
||||||
this.getBtnRemove4().setVisible(false);
|
this.getBtnRemove4().setVisible(false);
|
||||||
this.getBtnAdd4().setVisible(false);
|
this.getBtnAdd4().setVisible(false);
|
||||||
this.getBtnCycleSection().setVisible(true);
|
|
||||||
this.getBtnCycleSection().setCommand(new UiCommand() {
|
|
||||||
private static final long serialVersionUID = -9082606944024479599L;
|
|
||||||
|
|
||||||
|
this.getCbxSection().removeAllItems();
|
||||||
|
for (DeckSection section : allSections) {
|
||||||
|
this.getCbxSection().addItem(section);
|
||||||
|
}
|
||||||
|
this.getCbxSection().addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
cycleEditorMode();
|
FComboBox cb = (FComboBox)actionEvent.getSource();
|
||||||
|
DeckSection ds = (DeckSection)cb.getSelectedItem();
|
||||||
|
setEditorMode(ds);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.getCbxSection().setVisible(true);
|
||||||
|
|
||||||
deckGenParent = removeTab(VDeckgen.SINGLETON_INSTANCE);
|
deckGenParent = removeTab(VDeckgen.SINGLETON_INSTANCE);
|
||||||
allDecksParent = removeTab(VAllDecks.SINGLETON_INSTANCE);
|
allDecksParent = removeTab(VAllDecks.SINGLETON_INSTANCE);
|
||||||
@@ -232,11 +240,7 @@ public final class CEditorCommander extends CDeckEditor<Deck> {
|
|||||||
/**
|
/**
|
||||||
* Switch between the main deck and the sideboard editor.
|
* Switch between the main deck and the sideboard editor.
|
||||||
*/
|
*/
|
||||||
public void cycleEditorMode() {
|
public void setEditorMode(DeckSection sectionMode) {
|
||||||
int curindex = allSections.indexOf(sectionMode);
|
|
||||||
curindex = (curindex + 1) % allSections.size();
|
|
||||||
sectionMode = allSections.get(curindex);
|
|
||||||
|
|
||||||
switch(sectionMode) {
|
switch(sectionMode) {
|
||||||
case Main:
|
case Main:
|
||||||
this.getCatalogManager().setup(ItemManagerConfig.CARD_CATALOG);
|
this.getCatalogManager().setup(ItemManagerConfig.CARD_CATALOG);
|
||||||
@@ -257,6 +261,7 @@ public final class CEditorCommander extends CDeckEditor<Deck> {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.sectionMode = sectionMode;
|
||||||
this.controller.updateCaptions();
|
this.controller.updateCaptions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,13 +17,16 @@
|
|||||||
*/
|
*/
|
||||||
package forge.screens.deckeditor.controllers;
|
package forge.screens.deckeditor.controllers;
|
||||||
|
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import forge.UiCommand;
|
import forge.UiCommand;
|
||||||
|
import forge.card.CardRules;
|
||||||
import forge.card.CardRulesPredicates;
|
import forge.card.CardRulesPredicates;
|
||||||
import forge.deck.CardPool;
|
import forge.deck.CardPool;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.deck.DeckSection;
|
import forge.deck.DeckSection;
|
||||||
|
import forge.game.GameType;
|
||||||
import forge.gui.framework.FScreen;
|
import forge.gui.framework.FScreen;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.itemmanager.CardManager;
|
import forge.itemmanager.CardManager;
|
||||||
@@ -33,8 +36,13 @@ import forge.properties.ForgePreferences.FPref;
|
|||||||
import forge.screens.deckeditor.AddBasicLandsDialog;
|
import forge.screens.deckeditor.AddBasicLandsDialog;
|
||||||
import forge.screens.deckeditor.SEditorIO;
|
import forge.screens.deckeditor.SEditorIO;
|
||||||
import forge.screens.match.controllers.CDetailPicture;
|
import forge.screens.match.controllers.CDetailPicture;
|
||||||
|
import forge.toolbox.FComboBox;
|
||||||
import forge.util.ItemPool;
|
import forge.util.ItemPool;
|
||||||
|
import sun.font.FontConfigManager;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@@ -50,9 +58,16 @@ import java.util.Map.Entry;
|
|||||||
* @version $Id: CEditorConstructed.java 24868 2014-02-17 05:08:05Z drdev $
|
* @version $Id: CEditorConstructed.java 24868 2014-02-17 05:08:05Z drdev $
|
||||||
*/
|
*/
|
||||||
public final class CEditorConstructed extends CDeckEditor<Deck> {
|
public final class CEditorConstructed extends CDeckEditor<Deck> {
|
||||||
private final DeckController<Deck> controller;
|
private DeckController<Deck> controller;
|
||||||
private final List<DeckSection> allSections = new ArrayList<DeckSection>();
|
private final List<DeckSection> allSections = new ArrayList<DeckSection>();
|
||||||
private final ItemPool<PaperCard> normalPool, avatarPool, planePool, schemePool, conspiracyPool;
|
private ItemPool<PaperCard> normalPool, avatarPool, planePool, schemePool, conspiracyPool, commanderPool;
|
||||||
|
|
||||||
|
private final GameType gameType;
|
||||||
|
|
||||||
|
Predicate<CardRules> commanderFilter;
|
||||||
|
|
||||||
|
CardManager catalogManager;
|
||||||
|
CardManager deckManager;
|
||||||
|
|
||||||
//=========== Constructor
|
//=========== Constructor
|
||||||
/**
|
/**
|
||||||
@@ -62,10 +77,20 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public CEditorConstructed(final CDetailPicture cDetailPicture) {
|
public CEditorConstructed(final CDetailPicture cDetailPicture) {
|
||||||
|
this(cDetailPicture, GameType.Constructed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CEditorConstructed(final CDetailPicture cDetailPicture, final GameType gameType) {
|
||||||
super(FScreen.DECK_EDITOR_CONSTRUCTED, cDetailPicture);
|
super(FScreen.DECK_EDITOR_CONSTRUCTED, cDetailPicture);
|
||||||
|
this.gameType = gameType;
|
||||||
|
|
||||||
|
boolean wantUnique = false;
|
||||||
|
|
||||||
allSections.add(DeckSection.Main);
|
allSections.add(DeckSection.Main);
|
||||||
allSections.add(DeckSection.Sideboard);
|
allSections.add(DeckSection.Sideboard);
|
||||||
|
|
||||||
|
switch (this.gameType) {
|
||||||
|
case Constructed:
|
||||||
allSections.add(DeckSection.Avatar);
|
allSections.add(DeckSection.Avatar);
|
||||||
allSections.add(DeckSection.Schemes);
|
allSections.add(DeckSection.Schemes);
|
||||||
allSections.add(DeckSection.Planes);
|
allSections.add(DeckSection.Planes);
|
||||||
@@ -77,8 +102,31 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
|
|||||||
schemePool = ItemPool.createFrom(FModel.getMagicDb().getVariantCards().getAllCards(Predicates.compose(CardRulesPredicates.Presets.IS_SCHEME, PaperCard.FN_GET_RULES)), PaperCard.class);
|
schemePool = ItemPool.createFrom(FModel.getMagicDb().getVariantCards().getAllCards(Predicates.compose(CardRulesPredicates.Presets.IS_SCHEME, PaperCard.FN_GET_RULES)), PaperCard.class);
|
||||||
conspiracyPool = ItemPool.createFrom(FModel.getMagicDb().getVariantCards().getAllCards(Predicates.compose(CardRulesPredicates.Presets.IS_CONSPIRACY, PaperCard.FN_GET_RULES)), PaperCard.class);
|
conspiracyPool = ItemPool.createFrom(FModel.getMagicDb().getVariantCards().getAllCards(Predicates.compose(CardRulesPredicates.Presets.IS_CONSPIRACY, PaperCard.FN_GET_RULES)), PaperCard.class);
|
||||||
|
|
||||||
CardManager catalogManager = new CardManager(getCDetailPicture(), false, false); // TODO: restore the functionality of the "want uniques only" toggle
|
break;
|
||||||
CardManager deckManager = new CardManager(getCDetailPicture(), false, false); // IMPORTANT: must *always* show all cards in the deck, otherwise cards with different art get ignored!
|
case Commander:
|
||||||
|
case TinyLeaders:
|
||||||
|
allSections.add(DeckSection.Commander);
|
||||||
|
|
||||||
|
commanderFilter = CardRulesPredicates.Presets.CAN_BE_COMMANDER;
|
||||||
|
commanderPool = ItemPool.createFrom(FModel.getMagicDb().getCommonCards().getAllCards(Predicates.compose(commanderFilter, PaperCard.FN_GET_RULES)), PaperCard.class);
|
||||||
|
normalPool = ItemPool.createFrom(FModel.getMagicDb().getCommonCards().getAllCards(), PaperCard.class);
|
||||||
|
|
||||||
|
wantUnique = true;
|
||||||
|
break;
|
||||||
|
case Brawl:
|
||||||
|
allSections.add(DeckSection.Commander);
|
||||||
|
|
||||||
|
commanderFilter = CardRulesPredicates.Presets.CAN_BE_BRAWL_COMMANDER;
|
||||||
|
commanderPool = ItemPool.createFrom(FModel.getMagicDb().getCommonCards().getAllCards(Predicates.and(
|
||||||
|
FModel.getFormats().get("Brawl").getFilterPrinted(), Predicates.compose(commanderFilter, PaperCard.FN_GET_RULES))), PaperCard.class);
|
||||||
|
normalPool = ItemPool.createFrom(FModel.getFormats().get("Brawl").getAllCards(), PaperCard.class);
|
||||||
|
|
||||||
|
wantUnique = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
catalogManager = new CardManager(getCDetailPicture(), wantUnique, false);
|
||||||
|
deckManager = new CardManager(getCDetailPicture(), wantUnique, false);
|
||||||
|
|
||||||
catalogManager.setCaption("Catalog");
|
catalogManager.setCaption("Catalog");
|
||||||
|
|
||||||
@@ -92,7 +140,20 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
switch (this.gameType) {
|
||||||
|
case Constructed:
|
||||||
this.controller = new DeckController<Deck>(FModel.getDecks().getConstructed(), this, newCreator);
|
this.controller = new DeckController<Deck>(FModel.getDecks().getConstructed(), this, newCreator);
|
||||||
|
break;
|
||||||
|
case Commander:
|
||||||
|
this.controller = new DeckController<Deck>(FModel.getDecks().getCommander(), this, newCreator);
|
||||||
|
break;
|
||||||
|
case Brawl:
|
||||||
|
this.controller = new DeckController<Deck>(FModel.getDecks().getBrawl(), this, newCreator);
|
||||||
|
break;
|
||||||
|
case TinyLeaders:
|
||||||
|
this.controller = new DeckController<Deck>(FModel.getDecks().getTinyLeaders(), this, newCreator);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
getBtnAddBasicLands().setCommand(new UiCommand() {
|
getBtnAddBasicLands().setCommand(new UiCommand() {
|
||||||
@Override
|
@Override
|
||||||
@@ -110,7 +171,14 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
|
|||||||
return CardLimit.Singleton;
|
return CardLimit.Singleton;
|
||||||
}
|
}
|
||||||
if (FModel.getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
|
if (FModel.getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
|
||||||
|
switch (this.gameType) {
|
||||||
|
case Constructed:
|
||||||
return CardLimit.Default;
|
return CardLimit.Default;
|
||||||
|
case Commander:
|
||||||
|
case TinyLeaders:
|
||||||
|
case Brawl:
|
||||||
|
return CardLimit.Singleton;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return CardLimit.None; //if not enforcing deck legality, don't enforce default limit
|
return CardLimit.None; //if not enforcing deck legality, don't enforce default limit
|
||||||
}
|
}
|
||||||
@@ -296,11 +364,12 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
|
|||||||
/**
|
/**
|
||||||
* Switch between the main deck and the sideboard editor.
|
* Switch between the main deck and the sideboard editor.
|
||||||
*/
|
*/
|
||||||
public void cycleEditorMode() {
|
public void setEditorMode(DeckSection sectionMode) {
|
||||||
int curindex = allSections.indexOf(sectionMode);
|
if (sectionMode == null) {
|
||||||
curindex = (curindex + 1) % allSections.size();
|
return;
|
||||||
sectionMode = allSections.get(curindex);
|
}
|
||||||
|
switch(this.gameType) {
|
||||||
|
case Constructed:
|
||||||
switch(sectionMode) {
|
switch(sectionMode) {
|
||||||
case Main:
|
case Main:
|
||||||
this.getCatalogManager().setup(ItemManagerConfig.CARD_CATALOG);
|
this.getCatalogManager().setup(ItemManagerConfig.CARD_CATALOG);
|
||||||
@@ -319,22 +388,46 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
|
|||||||
break;
|
break;
|
||||||
case Planes:
|
case Planes:
|
||||||
this.getCatalogManager().setup(ItemManagerConfig.PLANAR_POOL);
|
this.getCatalogManager().setup(ItemManagerConfig.PLANAR_POOL);
|
||||||
this.getCatalogManager().setPool(planePool,true);
|
this.getCatalogManager().setPool(planePool, true);
|
||||||
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Planes));
|
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Planes));
|
||||||
break;
|
break;
|
||||||
case Schemes:
|
case Schemes:
|
||||||
this.getCatalogManager().setup(ItemManagerConfig.SCHEME_POOL);
|
this.getCatalogManager().setup(ItemManagerConfig.SCHEME_POOL);
|
||||||
this.getCatalogManager().setPool(schemePool,true);
|
this.getCatalogManager().setPool(schemePool, true);
|
||||||
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Schemes));
|
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Schemes));
|
||||||
break;
|
break;
|
||||||
case Commander:
|
case Commander:
|
||||||
break; //do nothing for Commander here
|
break; //do nothing for Commander here
|
||||||
case Conspiracy:
|
case Conspiracy:
|
||||||
this.getCatalogManager().setup(ItemManagerConfig.CONSPIRACY_DECKS);
|
this.getCatalogManager().setup(ItemManagerConfig.CONSPIRACY_DECKS);
|
||||||
this.getCatalogManager().setPool(conspiracyPool,true);
|
this.getCatalogManager().setPool(conspiracyPool, true);
|
||||||
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Conspiracy));
|
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Conspiracy));
|
||||||
}
|
}
|
||||||
|
case Commander:
|
||||||
|
case TinyLeaders:
|
||||||
|
case Brawl:
|
||||||
|
switch(sectionMode) {
|
||||||
|
case Main:
|
||||||
|
this.getCatalogManager().setup(ItemManagerConfig.CARD_CATALOG);
|
||||||
|
this.getCatalogManager().setPool(normalPool, true);
|
||||||
|
this.getDeckManager().setPool(this.controller.getModel().getMain());
|
||||||
|
break;
|
||||||
|
case Sideboard:
|
||||||
|
this.getCatalogManager().setup(ItemManagerConfig.CARD_CATALOG);
|
||||||
|
this.getCatalogManager().setPool(normalPool, true);
|
||||||
|
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Sideboard));
|
||||||
|
break;
|
||||||
|
case Commander:
|
||||||
|
this.getCatalogManager().setup(ItemManagerConfig.COMMANDER_POOL);
|
||||||
|
this.getCatalogManager().setPool(commanderPool, true);
|
||||||
|
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Commander));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.sectionMode = sectionMode;
|
||||||
this.controller.updateCaptions();
|
this.controller.updateCaptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,13 +453,19 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
|
|||||||
|
|
||||||
resetUI();
|
resetUI();
|
||||||
|
|
||||||
this.getBtnCycleSection().setVisible(true);
|
this.getCbxSection().removeAllItems();
|
||||||
this.getBtnCycleSection().setCommand(new UiCommand() {
|
for (DeckSection section : allSections) {
|
||||||
|
this.getCbxSection().addItem(section);
|
||||||
|
}
|
||||||
|
this.getCbxSection().addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
cycleEditorMode();
|
FComboBox cb = (FComboBox)actionEvent.getSource();
|
||||||
|
DeckSection ds = (DeckSection)cb.getSelectedItem();
|
||||||
|
setEditorMode(ds);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.getCbxSection().setVisible(true);
|
||||||
|
|
||||||
this.controller.refreshModel();
|
this.controller.refreshModel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
|||||||
this.getBtnRemove().setVisible(false);
|
this.getBtnRemove().setVisible(false);
|
||||||
this.getBtnRemove4().setVisible(false);
|
this.getBtnRemove4().setVisible(false);
|
||||||
|
|
||||||
this.getBtnCycleSection().setVisible(false);
|
this.getCbxSection().setVisible(false);
|
||||||
|
|
||||||
VCurrentDeck.SINGLETON_INSTANCE.getPnlHeader().setVisible(false);
|
VCurrentDeck.SINGLETON_INSTANCE.getPnlHeader().setVisible(false);
|
||||||
|
|
||||||
|
|||||||
@@ -33,14 +33,20 @@ import forge.model.FModel;
|
|||||||
import forge.screens.deckeditor.AddBasicLandsDialog;
|
import forge.screens.deckeditor.AddBasicLandsDialog;
|
||||||
import forge.screens.deckeditor.SEditorIO;
|
import forge.screens.deckeditor.SEditorIO;
|
||||||
import forge.screens.deckeditor.views.VAllDecks;
|
import forge.screens.deckeditor.views.VAllDecks;
|
||||||
|
import forge.screens.deckeditor.views.VBrawlDecks;
|
||||||
|
import forge.screens.deckeditor.views.VCommanderDecks;
|
||||||
import forge.screens.deckeditor.views.VCurrentDeck;
|
import forge.screens.deckeditor.views.VCurrentDeck;
|
||||||
import forge.screens.deckeditor.views.VDeckgen;
|
import forge.screens.deckeditor.views.VDeckgen;
|
||||||
|
import forge.screens.deckeditor.views.VTinyLeadersDecks;
|
||||||
import forge.screens.home.sanctioned.CSubmenuDraft;
|
import forge.screens.home.sanctioned.CSubmenuDraft;
|
||||||
import forge.screens.home.sanctioned.CSubmenuSealed;
|
import forge.screens.home.sanctioned.CSubmenuSealed;
|
||||||
import forge.screens.match.controllers.CDetailPicture;
|
import forge.screens.match.controllers.CDetailPicture;
|
||||||
|
import forge.toolbox.FComboBox;
|
||||||
import forge.util.storage.IStorage;
|
import forge.util.storage.IStorage;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,7 +60,10 @@ import java.util.Map.Entry;
|
|||||||
public final class CEditorLimited extends CDeckEditor<DeckGroup> {
|
public final class CEditorLimited extends CDeckEditor<DeckGroup> {
|
||||||
|
|
||||||
private final DeckController<DeckGroup> controller;
|
private final DeckController<DeckGroup> controller;
|
||||||
private DragCell allDecksParent = null;
|
private DragCell constructedDecksParent = null;
|
||||||
|
private DragCell commanderDecksParent = null;
|
||||||
|
private DragCell brawlDecksParent = null;
|
||||||
|
private DragCell tinyLeadersDecksParent = null;
|
||||||
private DragCell deckGenParent = null;
|
private DragCell deckGenParent = null;
|
||||||
private final List<DeckSection> allSections = new ArrayList<DeckSection>();
|
private final List<DeckSection> allSections = new ArrayList<DeckSection>();
|
||||||
|
|
||||||
@@ -98,10 +107,16 @@ public final class CEditorLimited extends CDeckEditor<DeckGroup> {
|
|||||||
allSections.add(DeckSection.Main);
|
allSections.add(DeckSection.Main);
|
||||||
allSections.add(DeckSection.Conspiracy);
|
allSections.add(DeckSection.Conspiracy);
|
||||||
|
|
||||||
this.getBtnCycleSection().setCommand(new UiCommand() {
|
this.getCbxSection().removeAllItems();
|
||||||
|
for (DeckSection section : allSections) {
|
||||||
|
this.getCbxSection().addItem(section);
|
||||||
|
}
|
||||||
|
this.getCbxSection().addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
cycleEditorMode();
|
FComboBox cb = (FComboBox)actionEvent.getSource();
|
||||||
|
DeckSection ds = (DeckSection)cb.getSelectedItem();
|
||||||
|
setEditorMode(ds);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -194,10 +209,7 @@ public final class CEditorLimited extends CDeckEditor<DeckGroup> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void cycleEditorMode() {
|
public void setEditorMode(DeckSection sectionMode) {
|
||||||
int curindex = (allSections.indexOf(sectionMode) + 1) % allSections.size();
|
|
||||||
sectionMode = allSections.get(curindex);
|
|
||||||
|
|
||||||
switch(sectionMode) {
|
switch(sectionMode) {
|
||||||
case Conspiracy:
|
case Conspiracy:
|
||||||
this.getCatalogManager().setup(ItemManagerConfig.DRAFT_CONSPIRACY);
|
this.getCatalogManager().setup(ItemManagerConfig.DRAFT_CONSPIRACY);
|
||||||
@@ -211,6 +223,7 @@ public final class CEditorLimited extends CDeckEditor<DeckGroup> {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.sectionMode = sectionMode;
|
||||||
this.controller.updateCaptions();
|
this.controller.updateCaptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,10 +239,13 @@ public final class CEditorLimited extends CDeckEditor<DeckGroup> {
|
|||||||
|
|
||||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnPrintProxies().setVisible(false);
|
VCurrentDeck.SINGLETON_INSTANCE.getBtnPrintProxies().setVisible(false);
|
||||||
VCurrentDeck.SINGLETON_INSTANCE.getTxfTitle().setEnabled(false);
|
VCurrentDeck.SINGLETON_INSTANCE.getTxfTitle().setEnabled(false);
|
||||||
this.getBtnCycleSection().setVisible(true);
|
this.getCbxSection().setVisible(true);
|
||||||
|
|
||||||
deckGenParent = removeTab(VDeckgen.SINGLETON_INSTANCE);
|
deckGenParent = removeTab(VDeckgen.SINGLETON_INSTANCE);
|
||||||
allDecksParent = removeTab(VAllDecks.SINGLETON_INSTANCE);
|
constructedDecksParent = removeTab(VAllDecks.SINGLETON_INSTANCE);
|
||||||
|
commanderDecksParent = removeTab(VCommanderDecks.SINGLETON_INSTANCE);
|
||||||
|
brawlDecksParent = removeTab(VBrawlDecks.SINGLETON_INSTANCE);
|
||||||
|
tinyLeadersDecksParent = removeTab(VTinyLeadersDecks.SINGLETON_INSTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -252,8 +268,17 @@ public final class CEditorLimited extends CDeckEditor<DeckGroup> {
|
|||||||
if (deckGenParent != null) {
|
if (deckGenParent != null) {
|
||||||
deckGenParent.addDoc(VDeckgen.SINGLETON_INSTANCE);
|
deckGenParent.addDoc(VDeckgen.SINGLETON_INSTANCE);
|
||||||
}
|
}
|
||||||
if (allDecksParent != null) {
|
if (constructedDecksParent != null) {
|
||||||
allDecksParent.addDoc(VAllDecks.SINGLETON_INSTANCE);
|
constructedDecksParent.addDoc(VAllDecks.SINGLETON_INSTANCE);
|
||||||
|
}
|
||||||
|
if (commanderDecksParent != null) {
|
||||||
|
commanderDecksParent.addDoc(VCommanderDecks.SINGLETON_INSTANCE);
|
||||||
|
}
|
||||||
|
if (brawlDecksParent!= null) {
|
||||||
|
brawlDecksParent.addDoc(VBrawlDecks.SINGLETON_INSTANCE);
|
||||||
|
}
|
||||||
|
if (tinyLeadersDecksParent != null) {
|
||||||
|
tinyLeadersDecksParent.addDoc(VTinyLeadersDecks.SINGLETON_INSTANCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,9 +42,12 @@ import forge.screens.deckeditor.views.VCurrentDeck;
|
|||||||
import forge.screens.deckeditor.views.VDeckgen;
|
import forge.screens.deckeditor.views.VDeckgen;
|
||||||
import forge.screens.home.quest.CSubmenuQuestDecks;
|
import forge.screens.home.quest.CSubmenuQuestDecks;
|
||||||
import forge.screens.match.controllers.CDetailPicture;
|
import forge.screens.match.controllers.CDetailPicture;
|
||||||
|
import forge.toolbox.FComboBox;
|
||||||
import forge.util.ItemPool;
|
import forge.util.ItemPool;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -279,11 +282,7 @@ public final class CEditorQuest extends CDeckEditor<Deck> {
|
|||||||
/**
|
/**
|
||||||
* Switch between the main deck and the sideboard editor.
|
* Switch between the main deck and the sideboard editor.
|
||||||
*/
|
*/
|
||||||
public void cycleEditorMode() {
|
public void setEditorMode(DeckSection sectionMode) {
|
||||||
int curindex = allSections.indexOf(sectionMode);
|
|
||||||
curindex = (curindex + 1) % allSections.size();
|
|
||||||
sectionMode = allSections.get(curindex);
|
|
||||||
|
|
||||||
if (sectionMode == DeckSection.Sideboard) {
|
if (sectionMode == DeckSection.Sideboard) {
|
||||||
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Sideboard));
|
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Sideboard));
|
||||||
}
|
}
|
||||||
@@ -291,6 +290,7 @@ public final class CEditorQuest extends CDeckEditor<Deck> {
|
|||||||
this.getDeckManager().setPool(this.controller.getModel().getMain());
|
this.getDeckManager().setPool(this.controller.getModel().getMain());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.sectionMode = sectionMode;
|
||||||
this.controller.updateCaptions();
|
this.controller.updateCaptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,12 +316,19 @@ public final class CEditorQuest extends CDeckEditor<Deck> {
|
|||||||
|
|
||||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnSave().setVisible(true);
|
VCurrentDeck.SINGLETON_INSTANCE.getBtnSave().setVisible(true);
|
||||||
|
|
||||||
this.getBtnCycleSection().setVisible(true);
|
this.getCbxSection().removeAllItems();
|
||||||
this.getBtnCycleSection().setCommand(new UiCommand() {
|
for (DeckSection section : allSections) {
|
||||||
@Override public void run() {
|
this.getCbxSection().addItem(section);
|
||||||
cycleEditorMode();
|
}
|
||||||
|
this.getCbxSection().addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
|
FComboBox cb = (FComboBox)actionEvent.getSource();
|
||||||
|
DeckSection ds = (DeckSection)cb.getSelectedItem();
|
||||||
|
setEditorMode(ds);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.getCbxSection().setVisible(true);
|
||||||
|
|
||||||
deckGenParent = removeTab(VDeckgen.SINGLETON_INSTANCE);
|
deckGenParent = removeTab(VDeckgen.SINGLETON_INSTANCE);
|
||||||
allDecksParent = removeTab(VAllDecks.SINGLETON_INSTANCE);
|
allDecksParent = removeTab(VAllDecks.SINGLETON_INSTANCE);
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ public class CEditorQuestDraftingProcess extends ACEditorBase<PaperCard, DeckGro
|
|||||||
getBtnRemove().setVisible(false);
|
getBtnRemove().setVisible(false);
|
||||||
getBtnRemove4().setVisible(false);
|
getBtnRemove4().setVisible(false);
|
||||||
|
|
||||||
getBtnCycleSection().setVisible(false);
|
getCbxSection().setVisible(false);
|
||||||
|
|
||||||
VCurrentDeck.SINGLETON_INSTANCE.getPnlHeader().setVisible(false);
|
VCurrentDeck.SINGLETON_INSTANCE.getPnlHeader().setVisible(false);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package forge.screens.deckeditor.controllers;
|
||||||
|
|
||||||
|
import forge.deck.DeckProxy;
|
||||||
|
import forge.gui.framework.ICDoc;
|
||||||
|
import forge.itemmanager.ItemManagerConfig;
|
||||||
|
import forge.screens.deckeditor.views.VCommanderDecks;
|
||||||
|
import forge.screens.deckeditor.views.VTinyLeadersDecks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls the "Commander Decks" panel in the deck editor UI.
|
||||||
|
*
|
||||||
|
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum CTinyLeadersDecks implements ICDoc {
|
||||||
|
SINGLETON_INSTANCE;
|
||||||
|
|
||||||
|
private final VTinyLeadersDecks view = VTinyLeadersDecks.SINGLETON_INSTANCE;
|
||||||
|
|
||||||
|
//========== Overridden methods
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.ICDoc#initialize()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void refresh() {
|
||||||
|
view.getLstDecks().setPool(DeckProxy.getAllTinyLeadersDecks());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.ICDoc#update()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
view.getLstDecks().setup(ItemManagerConfig.CONSTRUCTED_DECKS);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -88,6 +88,10 @@ public class DeckController<T extends DeckBase> {
|
|||||||
*/
|
*/
|
||||||
public void loadDeck(Deck deck) {
|
public void loadDeck(Deck deck) {
|
||||||
|
|
||||||
|
if (deck.getName() == "") {
|
||||||
|
newModel();
|
||||||
|
}
|
||||||
|
|
||||||
if (!view.getCatalogManager().isInfinite()) {
|
if (!view.getCatalogManager().isInfinite()) {
|
||||||
CardPool catalogClone = new CardPool(view.getInitialCatalog());
|
CardPool catalogClone = new CardPool(view.getInitialCatalog());
|
||||||
deck = pickFromCatalog(deck, catalogClone);
|
deck = pickFromCatalog(deck, catalogClone);
|
||||||
@@ -406,7 +410,7 @@ public class DeckController<T extends DeckBase> {
|
|||||||
tabCaption = "*" + tabCaption;
|
tabCaption = "*" + tabCaption;
|
||||||
itemManagerCaption = "*" + itemManagerCaption;
|
itemManagerCaption = "*" + itemManagerCaption;
|
||||||
}
|
}
|
||||||
itemManagerCaption += " - " + view.getSectionMode().name();
|
itemManagerCaption += " - ";
|
||||||
|
|
||||||
VCurrentDeck.SINGLETON_INSTANCE.getTabLabel().setText(tabCaption);
|
VCurrentDeck.SINGLETON_INSTANCE.getTabLabel().setText(tabCaption);
|
||||||
VCurrentDeck.SINGLETON_INSTANCE.getTxfTitle().setText(title);
|
VCurrentDeck.SINGLETON_INSTANCE.getTxfTitle().setText(title);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package forge.screens.deckeditor.views;
|
package forge.screens.deckeditor.views;
|
||||||
|
|
||||||
|
import forge.deck.io.DeckPreferences;
|
||||||
import forge.game.GameType;
|
import forge.game.GameType;
|
||||||
import forge.gui.framework.DragCell;
|
import forge.gui.framework.DragCell;
|
||||||
import forge.gui.framework.DragTab;
|
import forge.gui.framework.DragTab;
|
||||||
@@ -24,7 +25,7 @@ public enum VAllDecks implements IVDoc<CAllDecks> {
|
|||||||
|
|
||||||
// Fields used with interface IVDoc
|
// Fields used with interface IVDoc
|
||||||
private DragCell parentCell;
|
private DragCell parentCell;
|
||||||
private final DragTab tab = new DragTab("All Decks");
|
private final DragTab tab = new DragTab("Constructed");
|
||||||
|
|
||||||
private DeckManager lstDecks;
|
private DeckManager lstDecks;
|
||||||
|
|
||||||
@@ -80,6 +81,8 @@ public enum VAllDecks implements IVDoc<CAllDecks> {
|
|||||||
JPanel parentBody = parentCell.getBody();
|
JPanel parentBody = parentCell.getBody();
|
||||||
parentBody.setLayout(new MigLayout("insets 5, gap 0, wrap, hidemode 3"));
|
parentBody.setLayout(new MigLayout("insets 5, gap 0, wrap, hidemode 3"));
|
||||||
parentBody.add(new ItemManagerContainer(lstDecks), "push, grow");
|
parentBody.add(new ItemManagerContainer(lstDecks), "push, grow");
|
||||||
|
String preferredDeck = DeckPreferences.getCurrentDeck();
|
||||||
|
lstDecks.editDeck(lstDecks.stringToItem(preferredDeck));
|
||||||
}
|
}
|
||||||
|
|
||||||
//========== Retrieval methods
|
//========== Retrieval methods
|
||||||
@@ -90,6 +93,6 @@ public enum VAllDecks implements IVDoc<CAllDecks> {
|
|||||||
|
|
||||||
public void setCDetailPicture(final CDetailPicture cDetailPicture) {
|
public void setCDetailPicture(final CDetailPicture cDetailPicture) {
|
||||||
this.lstDecks = new DeckManager(GameType.Constructed, cDetailPicture);
|
this.lstDecks = new DeckManager(GameType.Constructed, cDetailPicture);
|
||||||
this.lstDecks.setCaption("Decks");
|
this.lstDecks.setCaption("Constructed Decks");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
package forge.screens.deckeditor.views;
|
||||||
|
|
||||||
|
import forge.deck.io.DeckPreferences;
|
||||||
|
import forge.game.GameType;
|
||||||
|
import forge.gui.framework.DragCell;
|
||||||
|
import forge.gui.framework.DragTab;
|
||||||
|
import forge.gui.framework.EDocID;
|
||||||
|
import forge.gui.framework.IVDoc;
|
||||||
|
import forge.itemmanager.DeckManager;
|
||||||
|
import forge.itemmanager.ItemManagerContainer;
|
||||||
|
import forge.screens.deckeditor.controllers.CBrawlDecks;
|
||||||
|
import forge.screens.match.controllers.CDetailPicture;
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assembles Swing components of all deck viewer in deck editor.
|
||||||
|
*
|
||||||
|
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
|
||||||
|
*/
|
||||||
|
public enum VBrawlDecks implements IVDoc<CBrawlDecks> {
|
||||||
|
/** */
|
||||||
|
SINGLETON_INSTANCE;
|
||||||
|
|
||||||
|
// Fields used with interface IVDoc
|
||||||
|
private DragCell parentCell;
|
||||||
|
private final DragTab tab = new DragTab("Brawl");
|
||||||
|
|
||||||
|
private DeckManager lstDecks;
|
||||||
|
|
||||||
|
//========== Overridden methods
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.IVDoc#getDocumentID()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public EDocID getDocumentID() {
|
||||||
|
return EDocID.EDITOR_BRAWL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.IVDoc#getTabLabel()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DragTab getTabLabel() {
|
||||||
|
return tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.IVDoc#getLayoutControl()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CBrawlDecks getLayoutControl() {
|
||||||
|
return CBrawlDecks.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 this.parentCell;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.IVDoc#populate()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void populate() {
|
||||||
|
CBrawlDecks.SINGLETON_INSTANCE.refresh(); //ensure decks refreshed in case any deleted or added since last loaded
|
||||||
|
|
||||||
|
JPanel parentBody = parentCell.getBody();
|
||||||
|
parentBody.setLayout(new MigLayout("insets 5, gap 0, wrap, hidemode 3"));
|
||||||
|
parentBody.add(new ItemManagerContainer(lstDecks), "push, grow");
|
||||||
|
String preferredDeck = DeckPreferences.getBrawlDeck();
|
||||||
|
lstDecks.editDeck(lstDecks.stringToItem(preferredDeck));
|
||||||
|
}
|
||||||
|
|
||||||
|
//========== Retrieval methods
|
||||||
|
/** @return {@link JPanel} */
|
||||||
|
public DeckManager getLstDecks() {
|
||||||
|
return lstDecks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCDetailPicture(final CDetailPicture cDetailPicture) {
|
||||||
|
this.lstDecks = new DeckManager(GameType.Brawl, cDetailPicture);
|
||||||
|
this.lstDecks.setCaption("Brawl Decks");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
package forge.screens.deckeditor.views;
|
||||||
|
|
||||||
|
import forge.deck.io.DeckPreferences;
|
||||||
|
import forge.game.GameType;
|
||||||
|
import forge.gui.framework.DragCell;
|
||||||
|
import forge.gui.framework.DragTab;
|
||||||
|
import forge.gui.framework.EDocID;
|
||||||
|
import forge.gui.framework.IVDoc;
|
||||||
|
import forge.itemmanager.DeckManager;
|
||||||
|
import forge.itemmanager.ItemManagerContainer;
|
||||||
|
import forge.screens.deckeditor.controllers.CCommanderDecks;
|
||||||
|
import forge.screens.match.controllers.CDetailPicture;
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assembles Swing components of all deck viewer in deck editor.
|
||||||
|
*
|
||||||
|
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
|
||||||
|
*/
|
||||||
|
public enum VCommanderDecks implements IVDoc<CCommanderDecks> {
|
||||||
|
/** */
|
||||||
|
SINGLETON_INSTANCE;
|
||||||
|
|
||||||
|
// Fields used with interface IVDoc
|
||||||
|
private DragCell parentCell;
|
||||||
|
private final DragTab tab = new DragTab("Commander");
|
||||||
|
|
||||||
|
private DeckManager lstDecks;
|
||||||
|
|
||||||
|
//========== Overridden methods
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.IVDoc#getDocumentID()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public EDocID getDocumentID() {
|
||||||
|
return EDocID.EDITOR_COMMANDER;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.IVDoc#getTabLabel()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DragTab getTabLabel() {
|
||||||
|
return tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.IVDoc#getLayoutControl()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CCommanderDecks getLayoutControl() {
|
||||||
|
return CCommanderDecks.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 this.parentCell;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.IVDoc#populate()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void populate() {
|
||||||
|
CCommanderDecks.SINGLETON_INSTANCE.refresh(); //ensure decks refreshed in case any deleted or added since last loaded
|
||||||
|
|
||||||
|
JPanel parentBody = parentCell.getBody();
|
||||||
|
parentBody.setLayout(new MigLayout("insets 5, gap 0, wrap, hidemode 3"));
|
||||||
|
parentBody.add(new ItemManagerContainer(lstDecks), "push, grow");
|
||||||
|
String preferredDeck = DeckPreferences.getCommanderDeck();
|
||||||
|
lstDecks.editDeck(lstDecks.stringToItem(preferredDeck));
|
||||||
|
}
|
||||||
|
|
||||||
|
//========== Retrieval methods
|
||||||
|
/** @return {@link JPanel} */
|
||||||
|
public DeckManager getLstDecks() {
|
||||||
|
return lstDecks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCDetailPicture(final CDetailPicture cDetailPicture) {
|
||||||
|
this.lstDecks = new DeckManager(GameType.Commander, cDetailPicture);
|
||||||
|
this.lstDecks.setCaption("Commander Decks");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
package forge.screens.deckeditor.views;
|
||||||
|
|
||||||
|
import forge.deck.io.DeckPreferences;
|
||||||
|
import forge.game.GameType;
|
||||||
|
import forge.gui.framework.DragCell;
|
||||||
|
import forge.gui.framework.DragTab;
|
||||||
|
import forge.gui.framework.EDocID;
|
||||||
|
import forge.gui.framework.IVDoc;
|
||||||
|
import forge.itemmanager.DeckManager;
|
||||||
|
import forge.itemmanager.ItemManagerContainer;
|
||||||
|
import forge.screens.deckeditor.controllers.CTinyLeadersDecks;
|
||||||
|
import forge.screens.match.controllers.CDetailPicture;
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assembles Swing components of all deck viewer in deck editor.
|
||||||
|
*
|
||||||
|
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
|
||||||
|
*/
|
||||||
|
public enum VTinyLeadersDecks implements IVDoc<CTinyLeadersDecks> {
|
||||||
|
/** */
|
||||||
|
SINGLETON_INSTANCE;
|
||||||
|
|
||||||
|
// Fields used with interface IVDoc
|
||||||
|
private DragCell parentCell;
|
||||||
|
private final DragTab tab = new DragTab("Tiny Leaders");
|
||||||
|
|
||||||
|
private DeckManager lstDecks;
|
||||||
|
|
||||||
|
//========== Overridden methods
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.IVDoc#getDocumentID()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public EDocID getDocumentID() {
|
||||||
|
return EDocID.EDITOR_TINY_LEADERS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.IVDoc#getTabLabel()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DragTab getTabLabel() {
|
||||||
|
return tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.IVDoc#getLayoutControl()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CTinyLeadersDecks getLayoutControl() {
|
||||||
|
return CTinyLeadersDecks.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 this.parentCell;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.gui.framework.IVDoc#populate()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void populate() {
|
||||||
|
CTinyLeadersDecks.SINGLETON_INSTANCE.refresh(); //ensure decks refreshed in case any deleted or added since last loaded
|
||||||
|
|
||||||
|
JPanel parentBody = parentCell.getBody();
|
||||||
|
parentBody.setLayout(new MigLayout("insets 5, gap 0, wrap, hidemode 3"));
|
||||||
|
parentBody.add(new ItemManagerContainer(lstDecks), "push, grow");
|
||||||
|
String preferredDeck = DeckPreferences.getTinyLeadersDeck();
|
||||||
|
lstDecks.editDeck(lstDecks.stringToItem(preferredDeck));
|
||||||
|
}
|
||||||
|
|
||||||
|
//========== Retrieval methods
|
||||||
|
/** @return {@link JPanel} */
|
||||||
|
public DeckManager getLstDecks() {
|
||||||
|
return lstDecks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCDetailPicture(final CDetailPicture cDetailPicture) {
|
||||||
|
this.lstDecks = new DeckManager(GameType.TinyLeaders, cDetailPicture);
|
||||||
|
this.lstDecks.setCaption("Tiny Leaders Decks");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -88,7 +88,6 @@ public class PlayerPanel extends FPanel {
|
|||||||
private final FLabel scmLabel;
|
private final FLabel scmLabel;
|
||||||
|
|
||||||
private final FLabel cmdDeckSelectorBtn = new FLabel.ButtonBuilder().text("Select a Commander deck").build();
|
private final FLabel cmdDeckSelectorBtn = new FLabel.ButtonBuilder().text("Select a Commander deck").build();
|
||||||
private final FLabel cmdDeckEditor = new FLabel.ButtonBuilder().text("Commander Deck Editor").build();
|
|
||||||
private final FLabel cmdLabel;
|
private final FLabel cmdLabel;
|
||||||
|
|
||||||
private final FLabel pchDeckSelectorBtn = new FLabel.ButtonBuilder().text("Select a planar deck").build();
|
private final FLabel pchDeckSelectorBtn = new FLabel.ButtonBuilder().text("Select a planar deck").build();
|
||||||
@@ -161,9 +160,8 @@ public class PlayerPanel extends FPanel {
|
|||||||
|
|
||||||
addHandlersDeckSelector();
|
addHandlersDeckSelector();
|
||||||
|
|
||||||
this.add(cmdLabel, variantBtnConstraints + ", cell 0 3, sx 2, ax right");
|
this.add(cmdLabel, variantBtnConstraints + ", cell 0 2, sx 2, ax right");
|
||||||
this.add(cmdDeckSelectorBtn, variantBtnConstraints + ", cell 2 3, growx, pushx");
|
this.add(cmdDeckSelectorBtn, variantBtnConstraints + ", cell 2 2, pushx, growx, wmax 100%-153px, h 30px, spanx 4, wrap");
|
||||||
this.add(cmdDeckEditor, variantBtnConstraints + ", cell 3 3, sx 3, growx, wrap");
|
|
||||||
|
|
||||||
this.add(scmLabel, variantBtnConstraints + ", cell 0 4, sx 2, ax right");
|
this.add(scmLabel, variantBtnConstraints + ", cell 0 4, sx 2, ax right");
|
||||||
this.add(scmDeckSelectorBtn, variantBtnConstraints + ", cell 2 4, growx, pushx");
|
this.add(scmDeckSelectorBtn, variantBtnConstraints + ", cell 2 4, growx, pushx");
|
||||||
@@ -348,8 +346,6 @@ public class PlayerPanel extends FPanel {
|
|||||||
deckLabel.setVisible(isDeckBuildingAllowed);
|
deckLabel.setVisible(isDeckBuildingAllowed);
|
||||||
deckBtn.setVisible(isDeckBuildingAllowed);
|
deckBtn.setVisible(isDeckBuildingAllowed);
|
||||||
cmdDeckSelectorBtn.setVisible(isCommanderApplied);
|
cmdDeckSelectorBtn.setVisible(isCommanderApplied);
|
||||||
cmdDeckEditor.setText(isTinyLeaders ? "TL Deck Editor" : isBrawl ? "Brawl Editor" : "Commander Deck Editor");
|
|
||||||
cmdDeckEditor.setVisible(isCommanderApplied);
|
|
||||||
cmdLabel.setVisible(isCommanderApplied);
|
cmdLabel.setVisible(isCommanderApplied);
|
||||||
|
|
||||||
scmDeckSelectorBtn.setVisible(archenemyVisiblity);
|
scmDeckSelectorBtn.setVisible(archenemyVisiblity);
|
||||||
@@ -516,25 +512,6 @@ public class PlayerPanel extends FPanel {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cmdDeckEditor.setCommand(new UiCommand() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (lobby.hasVariant(GameType.TinyLeaders)) {
|
|
||||||
lobby.setCurrentGameMode(GameType.TinyLeaders);
|
|
||||||
Singletons.getControl().setCurrentScreen(FScreen.DECK_EDITOR_TINY_LEADERS);
|
|
||||||
CDeckEditorUI.SINGLETON_INSTANCE.setEditorController(new CEditorCommander(CDeckEditorUI.SINGLETON_INSTANCE.getCDetailPicture(), true, false));
|
|
||||||
} else if (lobby.hasVariant(GameType.Brawl)) {
|
|
||||||
lobby.setCurrentGameMode(GameType.Brawl);
|
|
||||||
Singletons.getControl().setCurrentScreen(FScreen.DECK_EDITOR_BRAWL);
|
|
||||||
CDeckEditorUI.SINGLETON_INSTANCE.setEditorController(new CEditorCommander(CDeckEditorUI.SINGLETON_INSTANCE.getCDetailPicture(), false, true));
|
|
||||||
} else {
|
|
||||||
lobby.setCurrentGameMode(GameType.Commander);
|
|
||||||
Singletons.getControl().setCurrentScreen(FScreen.DECK_EDITOR_COMMANDER);
|
|
||||||
CDeckEditorUI.SINGLETON_INSTANCE.setEditorController(new CEditorCommander(CDeckEditorUI.SINGLETON_INSTANCE.getCDetailPicture(), false, false));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Planechase buttons
|
// Planechase buttons
|
||||||
pchDeckSelectorBtn.setCommand(new Runnable() {
|
pchDeckSelectorBtn.setCommand(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -96,9 +96,9 @@ public class VLobby implements ILobbyView {
|
|||||||
private final VariantCheckBox vntArchenemy = new VariantCheckBox(GameType.Archenemy);
|
private final VariantCheckBox vntArchenemy = new VariantCheckBox(GameType.Archenemy);
|
||||||
private final VariantCheckBox vntArchenemyRumble = new VariantCheckBox(GameType.ArchenemyRumble);
|
private final VariantCheckBox vntArchenemyRumble = new VariantCheckBox(GameType.ArchenemyRumble);
|
||||||
private final ImmutableList<VariantCheckBox> vntBoxesLocal =
|
private final ImmutableList<VariantCheckBox> vntBoxesLocal =
|
||||||
ImmutableList.of(vntVanguard, vntMomirBasic, vntMoJhoSto, vntCommander, vntTinyLeaders, vntBrawl, vntPlanechase, vntArchenemy, vntArchenemyRumble);
|
ImmutableList.of(vntVanguard, vntMomirBasic, vntMoJhoSto, vntCommander, vntBrawl, vntTinyLeaders, vntPlanechase, vntArchenemy, vntArchenemyRumble);
|
||||||
private final ImmutableList<VariantCheckBox> vntBoxesNetwork =
|
private final ImmutableList<VariantCheckBox> vntBoxesNetwork =
|
||||||
ImmutableList.of(vntVanguard, vntMomirBasic, vntMoJhoSto, vntCommander, vntTinyLeaders, vntBrawl /*, vntPlanechase, vntArchenemy, vntArchenemyRumble */);
|
ImmutableList.of(vntVanguard, vntMomirBasic, vntMoJhoSto, vntCommander, vntBrawl, vntTinyLeaders /*, vntPlanechase, vntArchenemy, vntArchenemyRumble */);
|
||||||
|
|
||||||
// Player frame elements
|
// Player frame elements
|
||||||
private final JPanel playersFrame = new JPanel(new MigLayout("insets 0, gap 0 5, wrap, hidemode 3"));
|
private final JPanel playersFrame = new JPanel(new MigLayout("insets 0, gap 0 5, wrap, hidemode 3"));
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<layout>
|
<layout serial="2018090601">
|
||||||
<cell x="0.77443" y="0.37698" w="0.22557" h="0.62302">
|
<cell x="0.77443" y="0.37698" w="0.22557" h="0.62302">
|
||||||
<doc>CARD_PICTURE</doc>
|
<doc>CARD_PICTURE</doc>
|
||||||
</cell>
|
</cell>
|
||||||
@@ -14,6 +14,9 @@
|
|||||||
<cell x="0.0" y="0.0" w="0.38722" h="1.0">
|
<cell x="0.0" y="0.0" w="0.38722" h="1.0">
|
||||||
<doc>EDITOR_CATALOG</doc>
|
<doc>EDITOR_CATALOG</doc>
|
||||||
<doc>EDITOR_ALLDECKS</doc>
|
<doc>EDITOR_ALLDECKS</doc>
|
||||||
|
<doc>EDITOR_COMMANDER</doc>
|
||||||
|
<doc>EDITOR_BRAWL</doc>
|
||||||
|
<doc>EDITOR_TINY_LEADERS</doc>
|
||||||
<doc>EDITOR_DECKGEN</doc>
|
<doc>EDITOR_DECKGEN</doc>
|
||||||
</cell>
|
</cell>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.NotImplementedException;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import forge.interfaces.ICheckBox;
|
import forge.interfaces.ICheckBox;
|
||||||
@@ -71,22 +72,43 @@ public class DeckImportController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Deck result = new Deck();
|
final Deck result = new Deck();
|
||||||
boolean isMain = true;
|
DeckSection deckSection = null;
|
||||||
|
String section = "";
|
||||||
for (final DeckRecognizer.Token t : tokens) {
|
for (final DeckRecognizer.Token t : tokens) {
|
||||||
final DeckRecognizer.TokenType type = t.getType();
|
final DeckRecognizer.TokenType type = t.getType();
|
||||||
if ((type == DeckRecognizer.TokenType.SectionName) && t.getText().toLowerCase().contains("side")) {
|
if (type == DeckRecognizer.TokenType.SectionName) {
|
||||||
isMain = false;
|
section = t.getText().toLowerCase();
|
||||||
|
// can't use wildcards in switch/case, so if/else it is
|
||||||
|
if (section.startsWith("main")) {
|
||||||
|
deckSection = DeckSection.Main;
|
||||||
|
}
|
||||||
|
else if (section.startsWith("side")) {
|
||||||
|
deckSection = DeckSection.Sideboard;
|
||||||
|
}
|
||||||
|
else if (section.startsWith("commander")) {
|
||||||
|
deckSection = DeckSection.Commander;
|
||||||
|
}
|
||||||
|
else if (section.startsWith("avatar")) {
|
||||||
|
deckSection = DeckSection.Avatar;
|
||||||
|
}
|
||||||
|
else if (section.startsWith("planes")) {
|
||||||
|
deckSection = DeckSection.Planes;
|
||||||
|
}
|
||||||
|
else if (section.startsWith("scheme")) {
|
||||||
|
deckSection = DeckSection.Schemes;
|
||||||
|
}
|
||||||
|
else if (section.startsWith("conspiracy")) {
|
||||||
|
deckSection = DeckSection.Conspiracy;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new NotImplementedException("Unexpected section: %s", t.getText());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (type != DeckRecognizer.TokenType.KnownCard) {
|
if (type != DeckRecognizer.TokenType.KnownCard) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final PaperCard crd = t.getCard();
|
final PaperCard crd = t.getCard();
|
||||||
if (isMain) {
|
result.getOrCreate(deckSection).add(crd, t.getNumber());
|
||||||
result.getMain().add(crd, t.getNumber());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
result.getOrCreate(DeckSection.Sideboard).add(crd, t.getNumber());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ public class DeckPreferences {
|
|||||||
draftDeck = root.getAttribute("draftDeck");
|
draftDeck = root.getAttribute("draftDeck");
|
||||||
sealedDeck = root.getAttribute("sealedDeck");
|
sealedDeck = root.getAttribute("sealedDeck");
|
||||||
commanderDeck = root.getAttribute("commanderDeck");
|
commanderDeck = root.getAttribute("commanderDeck");
|
||||||
|
brawlDeck = root.getAttribute("brawlDeck");
|
||||||
tinyLeadersDeck = root.getAttribute("tinyLeadersDeck");
|
tinyLeadersDeck = root.getAttribute("tinyLeadersDeck");
|
||||||
planarDeck = root.getAttribute("planarDeck");
|
planarDeck = root.getAttribute("planarDeck");
|
||||||
schemeDeck = root.getAttribute("schemeDeck");
|
schemeDeck = root.getAttribute("schemeDeck");
|
||||||
@@ -148,6 +149,7 @@ public class DeckPreferences {
|
|||||||
root.setAttribute("draftDeck", draftDeck);
|
root.setAttribute("draftDeck", draftDeck);
|
||||||
root.setAttribute("sealedDeck", sealedDeck);
|
root.setAttribute("sealedDeck", sealedDeck);
|
||||||
root.setAttribute("commanderDeck", commanderDeck);
|
root.setAttribute("commanderDeck", commanderDeck);
|
||||||
|
root.setAttribute("brawlDeck", brawlDeck);
|
||||||
root.setAttribute("tinyLeadersDeck", tinyLeadersDeck);
|
root.setAttribute("tinyLeadersDeck", tinyLeadersDeck);
|
||||||
root.setAttribute("planarDeck", planarDeck);
|
root.setAttribute("planarDeck", planarDeck);
|
||||||
root.setAttribute("schemeDeck", schemeDeck);
|
root.setAttribute("schemeDeck", schemeDeck);
|
||||||
|
|||||||
Reference in New Issue
Block a user