mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- Added a "save deck" button to the Limited deck editor to avoid confusion. The button will generate a proper confirmation message, so it won't confuse the player by just saying that the deck with the given name already exists (which is not appropriate for Limited since there is only one deck anyway).
This commit is contained in:
@@ -100,6 +100,20 @@ public class SEditorIO {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static boolean saveDeck() {
|
||||
return saveDeck(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the current deck, with various prompts depending on the
|
||||
* current save environment.
|
||||
*
|
||||
* @param limitedDeckMode if true, the editor is in limited deck mode,
|
||||
* so the overwrite prompt should be adjusted accordingly.
|
||||
*
|
||||
* @return boolean, true if success
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static boolean saveDeck(boolean limitedDeckMode) {
|
||||
final DeckController<DeckBase> controller = (DeckController<DeckBase>) CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController().getDeckController();
|
||||
final String name = VCurrentDeck.SINGLETON_INSTANCE.getTxfTitle().getText();
|
||||
|
||||
@@ -114,8 +128,9 @@ public class SEditorIO {
|
||||
// Confirm if overwrite
|
||||
else if (controller.fileExists(name)) {
|
||||
final int m = JOptionPane.showConfirmDialog(null,
|
||||
limitedDeckMode ? "Would you like to save changes to your deck?" :
|
||||
"There is already a deck named '" + name + "'. Overwrite?",
|
||||
"Overwrite Deck?",
|
||||
limitedDeckMode ? "Save changes?" : "Overwrite Deck?",
|
||||
JOptionPane.YES_NO_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import javax.swing.JLabel;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Iterables;
|
||||
import forge.Command;
|
||||
|
||||
|
||||
import forge.card.CardRulesPredicates;
|
||||
@@ -13,6 +14,7 @@ import forge.card.CardRules;
|
||||
import forge.gui.deckeditor.views.ITableContainer;
|
||||
import forge.gui.deckeditor.views.VCardCatalog;
|
||||
import forge.gui.deckeditor.views.VCurrentDeck;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.ItemPoolView;
|
||||
@@ -137,5 +139,9 @@ public final class SEditorUtil {
|
||||
|
||||
VCardCatalog.SINGLETON_INSTANCE.getTabLabel().setText("Card Catalog");
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getTabLabel().setText("Current Deck");
|
||||
|
||||
((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnSave())
|
||||
.setCommand(new Command() { @Override
|
||||
public void execute() { SEditorIO.saveDeck(); } });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package forge.gui.deckeditor.controllers;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import forge.Command;
|
||||
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckGroup;
|
||||
@@ -30,6 +31,7 @@ import forge.gui.deckeditor.views.VCardCatalog;
|
||||
import forge.gui.deckeditor.views.VCurrentDeck;
|
||||
import forge.gui.home.sanctioned.CSubmenuDraft;
|
||||
import forge.gui.home.sanctioned.CSubmenuSealed;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.util.IStorage;
|
||||
@@ -151,7 +153,10 @@ public final class CEditorLimited extends ACEditorBase<CardPrinted, DeckGroup> {
|
||||
SEditorUtil.resetUI();
|
||||
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnPrintProxies().setVisible(false);
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnSave().setVisible(false);
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnSave().setVisible(true);
|
||||
((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnSave())
|
||||
.setCommand(new Command() { @Override
|
||||
public void execute() { SEditorIO.saveDeck(true); } });
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnSaveAs().setVisible(false);
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnNew().setVisible(false);
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnOpen().setVisible(false);
|
||||
|
||||
Reference in New Issue
Block a user