mirror of
https://github.com/Relintai/mtg-forge-ios.git
synced 2024-11-14 04:17:19 +01:00
- Integrating Personal Ratings patch by Seravy.
git-svn-id: http://svn.slightlymagic.net/forge/trunk@35767 269b9781-a132-4a9b-9d4e-f004f1b56b58
This commit is contained in:
parent
d413390a95
commit
85576d8a13
@ -1,21 +1,5 @@
|
||||
package forge.deckchooser;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
|
||||
import forge.model.FModel;
|
||||
import forge.properties.ForgePreferences;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.deck.CardPool;
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckSection;
|
||||
@ -29,9 +13,23 @@ import forge.itemmanager.ItemManagerConfig;
|
||||
import forge.itemmanager.ItemManagerContainer;
|
||||
import forge.itemmanager.ItemManagerModel;
|
||||
import forge.itemmanager.views.ImageView;
|
||||
import forge.model.FModel;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.toolbox.FButton;
|
||||
import forge.toolbox.FOptionPane;
|
||||
import forge.view.FDialog;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import java.awt.*;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class FDeckViewer extends FDialog {
|
||||
@ -57,7 +55,7 @@ public class FDeckViewer extends FDialog {
|
||||
private FDeckViewer(final Deck deck0) {
|
||||
this.deck = deck0;
|
||||
this.setTitle(deck.getName());
|
||||
this.cardManager = new CardManager(null, false) {
|
||||
this.cardManager = new CardManager(null, false, false) {
|
||||
@Override //show hovered card in Image View in dialog instead of main Detail/Picture panes
|
||||
protected ImageView<PaperCard> createImageView(final ItemManagerModel<PaperCard> model0) {
|
||||
return new ImageView<PaperCard>(this, model0) {
|
||||
|
@ -10,7 +10,6 @@ import forge.screens.home.quest.DialogChooseSets;
|
||||
import forge.screens.match.controllers.CDetailPicture;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
@ -21,8 +20,12 @@ import java.util.Map.Entry;
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class CardManager extends ItemManager<PaperCard> {
|
||||
public CardManager(final CDetailPicture cDetailPicture, final boolean wantUnique0) {
|
||||
|
||||
private boolean QuestMode;
|
||||
|
||||
public CardManager(final CDetailPicture cDetailPicture, final boolean wantUnique0, final boolean qm) {
|
||||
super(PaperCard.class, cDetailPicture, wantUnique0);
|
||||
QuestMode = qm;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -66,7 +69,7 @@ public class CardManager extends ItemManager<PaperCard> {
|
||||
return new CardSearchFilter(itemManager);
|
||||
}
|
||||
|
||||
public static void buildAddFilterMenu(JMenu menu, final ItemManager<? super PaperCard> itemManager) {
|
||||
public void buildAddFilterMenu(JMenu menu, final ItemManager<? super PaperCard> itemManager) {
|
||||
GuiUtils.addSeparator(menu); //separate from current search item
|
||||
|
||||
JMenu fmt = GuiUtils.createMenu("Format");
|
||||
@ -164,6 +167,15 @@ public class CardManager extends ItemManager<PaperCard> {
|
||||
}
|
||||
}, itemManager.getFilter(CardFoilFilter.class) == null);
|
||||
|
||||
if (QuestMode) {
|
||||
GuiUtils.addMenuItem(menu, "Personal Rating", null, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
itemManager.addFilter(new CardRatingFilter(itemManager));
|
||||
}
|
||||
}, itemManager.getFilter(CardRatingFilter.class) == null);
|
||||
}
|
||||
|
||||
GuiUtils.addSeparator(menu);
|
||||
|
||||
GuiUtils.addMenuItem(menu, "Advanced...", null, new Runnable() {
|
||||
|
@ -12,8 +12,14 @@ import javax.swing.*;
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public final class SpellShopManager extends ItemManager<InventoryItem> {
|
||||
|
||||
private final CDetailPicture cDetailPicture2;
|
||||
private final boolean wantUnique02;
|
||||
|
||||
public SpellShopManager(final CDetailPicture cDetailPicture, final boolean wantUnique0) {
|
||||
super(InventoryItem.class, cDetailPicture, wantUnique0);
|
||||
cDetailPicture2 = cDetailPicture;
|
||||
wantUnique02 = wantUnique0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -28,6 +34,7 @@ public final class SpellShopManager extends ItemManager<InventoryItem> {
|
||||
|
||||
@Override
|
||||
protected void buildAddFilterMenu(JMenu menu) {
|
||||
CardManager.buildAddFilterMenu(menu, this);
|
||||
CardManager CM = new CardManager(cDetailPicture2, wantUnique02, true);
|
||||
CM.buildAddFilterMenu(menu, this);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
package forge.itemmanager.filters;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import forge.item.PaperCard;
|
||||
import forge.itemmanager.ItemManager;
|
||||
import forge.itemmanager.SFilterUtil;
|
||||
import forge.itemmanager.SItemManagerUtil.StatTypes;
|
||||
import forge.model.FModel;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class CardRatingFilter extends StatTypeFilter<PaperCard> {
|
||||
public CardRatingFilter(ItemManager<? super PaperCard> itemManager0) {
|
||||
super(itemManager0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemFilter<PaperCard> createCopy() {
|
||||
return new CardRatingFilter(itemManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildWidget(JPanel widget) {
|
||||
/*if (itemManager instanceof SpellShopManager) {
|
||||
addToggleButton(widget, StatTypes.PACK_OR_DECK);
|
||||
}*/
|
||||
addToggleButton(widget, StatTypes.RATE_NONE);
|
||||
addToggleButton(widget, StatTypes.RATE_1);
|
||||
addToggleButton(widget, StatTypes.RATE_2);
|
||||
addToggleButton(widget, StatTypes.RATE_3);
|
||||
addToggleButton(widget, StatTypes.RATE_4);
|
||||
addToggleButton(widget, StatTypes.RATE_5);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Predicate<PaperCard> buildPredicate() {
|
||||
return SFilterUtil.buildStarRatingFilter(buttonMap, FModel.getQuest().GetRating());
|
||||
}
|
||||
}
|
@ -19,32 +19,12 @@ package forge.screens.deckeditor.controllers;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import forge.UiCommand;
|
||||
import forge.assets.FSkinProp;
|
||||
import forge.deck.CardPool;
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckBase;
|
||||
import forge.deck.DeckGroup;
|
||||
import forge.deck.DeckSection;
|
||||
import forge.deck.*;
|
||||
import forge.gui.GuiChoose;
|
||||
import forge.gui.GuiUtils;
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.framework.FScreen;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.gui.framework.IVDoc;
|
||||
import forge.gui.framework.SRearrangingUtil;
|
||||
import forge.gui.framework.*;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.PaperCard;
|
||||
import forge.itemmanager.ItemManager;
|
||||
@ -64,6 +44,14 @@ import forge.util.Aggregates;
|
||||
import forge.util.ItemPool;
|
||||
import forge.view.FView;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* Maintains a generically typed architecture for various editing
|
||||
* environments. A basic editor instance requires a card catalog, the
|
||||
@ -431,7 +419,7 @@ public abstract class ACEditorBase<TItem extends InventoryItem, TModel extends D
|
||||
isAddContextMenu = isAddContextMenu0;
|
||||
}
|
||||
|
||||
private ItemManager<TItem> getItemManager() {
|
||||
public ItemManager<TItem> getItemManager() {
|
||||
return isAddContextMenu ? catalogManager : deckManager;
|
||||
}
|
||||
|
||||
@ -439,6 +427,10 @@ public abstract class ACEditorBase<TItem extends InventoryItem, TModel extends D
|
||||
return isAddContextMenu ? deckManager : catalogManager;
|
||||
}
|
||||
|
||||
public JPopupMenu getMenu() {
|
||||
return menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildContextMenu(final JPopupMenu menu) {
|
||||
this.menu = menu; //cache menu while controller populates menu
|
||||
|
@ -19,7 +19,6 @@ package forge.screens.deckeditor.controllers;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.base.Supplier;
|
||||
|
||||
import forge.UiCommand;
|
||||
import forge.card.CardRulesPredicates;
|
||||
import forge.deck.Deck;
|
||||
@ -75,8 +74,8 @@ public final class CEditorCommander extends ACEditorBase<PaperCard, Deck> {
|
||||
commanderPool = ItemPool.createFrom(FModel.getMagicDb().getCommonCards().getAllCards(Predicates.compose(CardRulesPredicates.Presets.CAN_BE_COMMANDER, PaperCard.FN_GET_RULES)),PaperCard.class);
|
||||
normalPool = ItemPool.createFrom(FModel.getMagicDb().getCommonCards().getAllCards(), PaperCard.class);
|
||||
|
||||
CardManager catalogManager = new CardManager(getCDetailPicture(), true);
|
||||
CardManager deckManager = new CardManager(getCDetailPicture(), true);
|
||||
CardManager catalogManager = new CardManager(getCDetailPicture(), true, false);
|
||||
CardManager deckManager = new CardManager(getCDetailPicture(), true, false);
|
||||
|
||||
catalogManager.setCaption("Catalog");
|
||||
|
||||
|
@ -19,7 +19,6 @@ package forge.screens.deckeditor.controllers;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.base.Supplier;
|
||||
|
||||
import forge.UiCommand;
|
||||
import forge.card.CardRulesPredicates;
|
||||
import forge.deck.CardPool;
|
||||
@ -78,8 +77,8 @@ public final class CEditorConstructed extends ACEditorBase<PaperCard, Deck> {
|
||||
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);
|
||||
|
||||
CardManager catalogManager = new CardManager(getCDetailPicture(), false); // TODO: restore the functionality of the "want uniques only" toggle
|
||||
CardManager deckManager = new CardManager(getCDetailPicture(), false); // IMPORTANT: must *always* show all cards in the deck, otherwise cards with different art get ignored!
|
||||
CardManager catalogManager = new CardManager(getCDetailPicture(), false, false); // TODO: restore the functionality of the "want uniques only" toggle
|
||||
CardManager deckManager = new CardManager(getCDetailPicture(), false, false); // IMPORTANT: must *always* show all cards in the deck, otherwise cards with different art get ignored!
|
||||
|
||||
catalogManager.setCaption("Catalog");
|
||||
|
||||
|
@ -65,8 +65,8 @@ public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
public CEditorDraftingProcess(final CDetailPicture cDetailPicture) {
|
||||
super(FScreen.DRAFTING_PROCESS, cDetailPicture);
|
||||
|
||||
final CardManager catalogManager = new CardManager(getCDetailPicture(), false);
|
||||
final CardManager deckManager = new CardManager(getCDetailPicture(), false);
|
||||
final CardManager catalogManager = new CardManager(getCDetailPicture(), false, false);
|
||||
final CardManager deckManager = new CardManager(getCDetailPicture(), false, false);
|
||||
|
||||
//hide filters and options panel so more of pack is visible by default
|
||||
catalogManager.setHideViewOptions(1, true);
|
||||
|
@ -18,7 +18,6 @@
|
||||
package forge.screens.deckeditor.controllers;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
|
||||
import forge.UiCommand;
|
||||
import forge.card.CardEdition;
|
||||
import forge.deck.CardPool;
|
||||
@ -43,7 +42,6 @@ import forge.util.storage.IStorage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
@ -74,8 +72,8 @@ public final class CEditorLimited extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
public CEditorLimited(final IStorage<DeckGroup> deckMap0, final FScreen screen0, final CDetailPicture cDetailPicture) {
|
||||
super(screen0, cDetailPicture);
|
||||
|
||||
final CardManager catalogManager = new CardManager(getCDetailPicture(), false);
|
||||
final CardManager deckManager = new CardManager(getCDetailPicture(), false);
|
||||
final CardManager catalogManager = new CardManager(getCDetailPicture(), false, false);
|
||||
final CardManager deckManager = new CardManager(getCDetailPicture(), false, false);
|
||||
|
||||
catalogManager.setCaption("Sideboard");
|
||||
|
||||
|
@ -17,18 +17,13 @@
|
||||
*/
|
||||
package forge.screens.deckeditor.controllers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Supplier;
|
||||
import forge.UiCommand;
|
||||
import forge.deck.CardPool;
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckSection;
|
||||
import forge.gui.GuiUtils;
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.framework.FScreen;
|
||||
import forge.item.InventoryItem;
|
||||
@ -49,6 +44,13 @@ import forge.screens.home.quest.CSubmenuQuestDecks;
|
||||
import forge.screens.match.controllers.CDetailPicture;
|
||||
import forge.util.ItemPool;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* Child controller for quest deck editor UI.
|
||||
* <br><br>
|
||||
@ -100,8 +102,8 @@ public final class CEditorQuest extends ACEditorBase<PaperCard, Deck> {
|
||||
|
||||
this.questData = questData0;
|
||||
|
||||
final CardManager catalogManager = new CardManager(cDetailPicture, false);
|
||||
final CardManager deckManager = new CardManager(cDetailPicture, false);
|
||||
final CardManager catalogManager = new CardManager(cDetailPicture, false, true);
|
||||
final CardManager deckManager = new CardManager(cDetailPicture, false, true);
|
||||
|
||||
catalogManager.setCaption("Quest Inventory");
|
||||
|
||||
@ -180,6 +182,41 @@ public final class CEditorQuest extends ACEditorBase<PaperCard, Deck> {
|
||||
@Override
|
||||
protected void buildAddContextMenu(final EditorContextMenuBuilder cmb) {
|
||||
CEditorConstructed.buildAddContextMenu(cmb, sectionMode);
|
||||
AddRatingItem(cmb, 1);
|
||||
AddRatingItem(cmb, 2);
|
||||
AddRatingItem(cmb, 3);
|
||||
AddRatingItem(cmb, 4);
|
||||
AddRatingItem(cmb, 5);
|
||||
AddRatingItem(cmb, 0);
|
||||
}
|
||||
|
||||
public void AddRatingItem(final EditorContextMenuBuilder cmb, final int n) {
|
||||
if (n == 1) {
|
||||
cmb.getMenu().addSeparator();
|
||||
}
|
||||
String s;
|
||||
if (n == 0) {
|
||||
s = "Remove custom rating";
|
||||
} else {
|
||||
s = "Rate this card as " + Integer.toString(n) + " stars";
|
||||
}
|
||||
GuiUtils.addMenuItem(cmb.getMenu(), s,
|
||||
KeyStroke.getKeyStroke(48 + n, 0),
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SetRatingStars(n,cmb);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void SetRatingStars(int n, EditorContextMenuBuilder cmb) {
|
||||
ItemPool<PaperCard> selected = cmb.getItemManager().getSelectedItemPool();
|
||||
|
||||
for (final Entry<PaperCard, Integer> itemEntry : selected) {
|
||||
// the card: itemEntry.getKey()
|
||||
questData.SetRating(itemEntry.getKey().getName(), itemEntry.getKey().getEdition(), n);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@ -188,6 +225,12 @@ public final class CEditorQuest extends ACEditorBase<PaperCard, Deck> {
|
||||
@Override
|
||||
protected void buildRemoveContextMenu(final EditorContextMenuBuilder cmb) {
|
||||
CEditorConstructed.buildRemoveContextMenu(cmb, sectionMode);
|
||||
AddRatingItem(cmb, 1);
|
||||
AddRatingItem(cmb, 2);
|
||||
AddRatingItem(cmb, 3);
|
||||
AddRatingItem(cmb, 4);
|
||||
AddRatingItem(cmb, 5);
|
||||
AddRatingItem(cmb, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -69,8 +69,8 @@ public class CEditorQuestDraftingProcess extends ACEditorBase<PaperCard, DeckGro
|
||||
public CEditorQuestDraftingProcess(final CDetailPicture cDetailPicture) {
|
||||
super(FScreen.DRAFTING_PROCESS, cDetailPicture);
|
||||
|
||||
final CardManager catalogManager = new CardManager(getCDetailPicture(), false);
|
||||
final CardManager deckManager = new CardManager(getCDetailPicture(), false);
|
||||
final CardManager catalogManager = new CardManager(getCDetailPicture(), false, false);
|
||||
final CardManager deckManager = new CardManager(getCDetailPicture(), false, false);
|
||||
|
||||
//hide filters and options panel so more of pack is visible by default
|
||||
catalogManager.setHideViewOptions(1, true);
|
||||
|
@ -17,15 +17,8 @@
|
||||
*/
|
||||
package forge.screens.deckeditor.controllers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Supplier;
|
||||
|
||||
import forge.UiCommand;
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckGroup;
|
||||
@ -49,6 +42,12 @@ import forge.screens.deckeditor.views.VDeckgen;
|
||||
import forge.screens.home.quest.CSubmenuQuestDecks;
|
||||
import forge.screens.match.controllers.CDetailPicture;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* Child controller for quest deck editor UI.
|
||||
* <br><br>
|
||||
@ -100,8 +99,8 @@ public final class CEditorQuestLimited extends ACEditorBase<PaperCard, DeckGroup
|
||||
|
||||
this.questData = questData0;
|
||||
|
||||
final CardManager catalogManager = new CardManager(cDetailPicture, false);
|
||||
final CardManager deckManager = new CardManager(cDetailPicture, false);
|
||||
final CardManager catalogManager = new CardManager(cDetailPicture, false, true);
|
||||
final CardManager deckManager = new CardManager(cDetailPicture, false, true);
|
||||
|
||||
catalogManager.setCaption("Sideboard");
|
||||
|
||||
|
@ -20,7 +20,6 @@ package forge.screens.deckeditor.controllers;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.UiCommand;
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckSection;
|
||||
@ -69,8 +68,8 @@ public final class CEditorVariant extends ACEditorBase<PaperCard, Deck> {
|
||||
this.cardPoolCondition = poolCondition;
|
||||
this.sectionMode = deckSection0;
|
||||
|
||||
final CardManager catalogManager = new CardManager(cDetailPicture, true);
|
||||
final CardManager deckManager = new CardManager(cDetailPicture, true);
|
||||
final CardManager catalogManager = new CardManager(cDetailPicture, true, false);
|
||||
final CardManager deckManager = new CardManager(cDetailPicture, true, false);
|
||||
|
||||
catalogManager.setCaption("Catalog");
|
||||
|
||||
|
@ -24,23 +24,23 @@ import forge.deck.CardPool;
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckGroup;
|
||||
import forge.deck.DeckSection;
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.framework.FScreen;
|
||||
import forge.item.PaperCard;
|
||||
import forge.itemmanager.CardManager;
|
||||
import forge.itemmanager.ItemManagerConfig;
|
||||
import forge.limited.BoosterDraft;
|
||||
import forge.limited.IBoosterDraft;
|
||||
import forge.limited.WinstonDraft;
|
||||
import forge.model.FModel;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.screens.deckeditor.CDeckEditorUI;
|
||||
import forge.screens.deckeditor.views.VAllDecks;
|
||||
import forge.screens.deckeditor.views.VCurrentDeck;
|
||||
import forge.screens.deckeditor.views.VDeckgen;
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.framework.FScreen;
|
||||
import forge.screens.home.sanctioned.CSubmenuWinston;
|
||||
import forge.screens.match.controllers.CDetailPicture;
|
||||
import forge.toolbox.FOptionPane;
|
||||
import forge.itemmanager.CardManager;
|
||||
import forge.itemmanager.ItemManagerConfig;
|
||||
import forge.item.PaperCard;
|
||||
import forge.limited.BoosterDraft;
|
||||
import forge.limited.IBoosterDraft;
|
||||
import forge.limited.WinstonDraft;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.util.ItemPool;
|
||||
import forge.util.MyRandom;
|
||||
|
||||
@ -78,8 +78,8 @@ public class CEditorWinstonProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
public CEditorWinstonProcess(final CDetailPicture cDetailPicture) {
|
||||
super(FScreen.DRAFTING_PROCESS, cDetailPicture);
|
||||
|
||||
final CardManager catalogManager = new CardManager(cDetailPicture, false);
|
||||
final CardManager deckManager = new CardManager(cDetailPicture, false);
|
||||
final CardManager catalogManager = new CardManager(cDetailPicture, false, false);
|
||||
final CardManager deckManager = new CardManager(cDetailPicture, false, false);
|
||||
|
||||
//hide filters and options panel so more of pack is visible by default
|
||||
catalogManager.setHideViewOptions(1, true);
|
||||
|
@ -1,13 +1,6 @@
|
||||
package forge.screens.workshop.views;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.framework.DragTab;
|
||||
import forge.gui.framework.EDocID;
|
||||
@ -20,6 +13,11 @@ import forge.screens.match.controllers.CDetailPicture;
|
||||
import forge.screens.workshop.controllers.CCardScript;
|
||||
import forge.screens.workshop.controllers.CWorkshopCatalog;
|
||||
import forge.util.ItemPool;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
|
||||
/**
|
||||
* Assembles Swing components of card catalog in workshop.
|
||||
@ -39,7 +37,7 @@ public enum VWorkshopCatalog implements IVDoc<CWorkshopCatalog> {
|
||||
|
||||
//========== Constructor
|
||||
private VWorkshopCatalog() {
|
||||
this.cardManager = new CardManager(cDetailPicture, true);
|
||||
this.cardManager = new CardManager(cDetailPicture, true, false);
|
||||
this.cardManager.setCaption("Catalog");
|
||||
final Iterable<PaperCard> allCards = Iterables.concat(FModel.getMagicDb().getCommonCards(), FModel.getMagicDb().getVariantCards());
|
||||
this.cardManager.setPool(ItemPool.createFrom(allCards, PaperCard.class), true);
|
||||
|
@ -1006,7 +1006,7 @@ public class FSkin {
|
||||
private static int currentSkinIndex;
|
||||
private static String preferredDir;
|
||||
private static String preferredName;
|
||||
private static BufferedImage bimDefaultSprite, bimPreferredSprite, bimFoils, bimQuestDraftDeck,
|
||||
private static BufferedImage bimDefaultSprite, bimFavIcon, bimPreferredSprite, bimFoils, bimQuestDraftDeck,
|
||||
bimOldFoils, bimDefaultAvatars, bimPreferredAvatars, bimTrophies;
|
||||
private static int x0, y0, w0, h0, newW, newH, preferredW, preferredH;
|
||||
private static int[] tempCoords;
|
||||
@ -1125,7 +1125,7 @@ public class FSkin {
|
||||
if (preferredName.isEmpty()) { loadLight("default", true); }
|
||||
}
|
||||
|
||||
FView.SINGLETON_INSTANCE.setSplashProgessBarMessage("Processing image sprites: ", 7);
|
||||
FView.SINGLETON_INSTANCE.setSplashProgessBarMessage("Processing image sprites: ", 8);
|
||||
|
||||
// Grab and test various sprite files.
|
||||
final String defaultDir = ForgeConstants.DEFAULT_SKINS_DIR;
|
||||
@ -1137,6 +1137,7 @@ public class FSkin {
|
||||
final File f6 = new File(defaultDir + ForgeConstants.SPRITE_OLD_FOILS_FILE);
|
||||
final File f7 = new File(defaultDir + ForgeConstants.SPRITE_TROPHIES_FILE);
|
||||
final File f8 = new File(defaultDir + ForgeConstants.DRAFT_DECK_IMG_FILE);
|
||||
final File f9 = new File(defaultDir + ForgeConstants.SPRITE_FAVICONS_FILE);
|
||||
|
||||
try {
|
||||
int p = 0;
|
||||
@ -1153,6 +1154,8 @@ public class FSkin {
|
||||
bimTrophies = ImageIO.read(f7);
|
||||
FView.SINGLETON_INSTANCE.incrementSplashProgessBar(++p);
|
||||
bimQuestDraftDeck = ImageIO.read(f8);
|
||||
FView.SINGLETON_INSTANCE.incrementSplashProgessBar(++p);
|
||||
bimFavIcon = ImageIO.read(f9);
|
||||
|
||||
if (f5.exists()) { bimPreferredAvatars = ImageIO.read(f5); }
|
||||
|
||||
@ -1200,6 +1203,9 @@ public class FSkin {
|
||||
case TROPHY:
|
||||
setImage(prop, bimTrophies);
|
||||
break;
|
||||
case FAVICON:
|
||||
setImage(prop, bimFavIcon);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
BIN
forge-gui/res/skins/default/sprite_favicons.png
Normal file
BIN
forge-gui/res/skins/default/sprite_favicons.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.7 KiB |
@ -284,6 +284,13 @@ public enum FSkinProp {
|
||||
IMG_BTN_DISABLED_CENTER (new int[] {120, 200, 1, 40}, PropType.ICON),
|
||||
IMG_BTN_DISABLED_RIGHT (new int[] {160, 200, 40, 40}, PropType.ICON),
|
||||
|
||||
IMG_FAV1 (new int[] {0, 0, 100, 100}, PropType.FAVICON),
|
||||
IMG_FAV2 (new int[] {100, 0, 100, 100}, PropType.FAVICON),
|
||||
IMG_FAV3 (new int[] {200, 0, 100, 100}, PropType.FAVICON),
|
||||
IMG_FAV4 (new int[] {300, 0, 100, 100}, PropType.FAVICON),
|
||||
IMG_FAV5 (new int[] {400, 0, 100, 100}, PropType.FAVICON),
|
||||
IMG_FAVNONE (new int[] {500, 0, 100, 100}, PropType.FAVICON),
|
||||
|
||||
IMG_QUEST_DRAFT_DECK (new int[] {0, 0, 680, 475}, PropType.IMAGE);
|
||||
|
||||
private int[] coords;
|
||||
@ -317,6 +324,7 @@ public enum FSkinProp {
|
||||
FOIL,
|
||||
OLD_FOIL,
|
||||
TROPHY,
|
||||
PLANAR_CONQUEST
|
||||
PLANAR_CONQUEST,
|
||||
FAVICON
|
||||
}
|
||||
}
|
||||
|
@ -2,13 +2,8 @@ package forge.itemmanager;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
|
||||
import forge.StaticData;
|
||||
import forge.card.CardEdition;
|
||||
import forge.card.CardRules;
|
||||
import forge.card.CardRulesPredicates;
|
||||
import forge.card.ColorSet;
|
||||
import forge.card.MagicColor;
|
||||
import forge.card.*;
|
||||
import forge.deck.DeckProxy;
|
||||
import forge.game.GameFormat;
|
||||
import forge.interfaces.IButton;
|
||||
@ -17,13 +12,11 @@ import forge.item.PaperCard;
|
||||
import forge.itemmanager.SItemManagerUtil.StatTypes;
|
||||
import forge.model.FModel;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.quest.data.StarRating;
|
||||
import forge.util.BinaryUtil;
|
||||
import forge.util.PredicateString.StringOp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Static factory; holds blocks of form elements and predicates
|
||||
@ -141,9 +134,56 @@ public class SFilterUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static Predicate<PaperCard> buildFoilFilter(Map<SItemManagerUtil.StatTypes, ? extends IButton> buttonMap) {
|
||||
public static Predicate<PaperCard> buildStarRatingFilter(Map<SItemManagerUtil.StatTypes, ? extends IButton> buttonMap, final HashSet<StarRating> QuestRatings) {
|
||||
final Map<SItemManagerUtil.StatTypes, ? extends IButton> buttonMap2 = buttonMap;
|
||||
return new Predicate<PaperCard>() {
|
||||
@Override
|
||||
public boolean apply(PaperCard card) {
|
||||
|
||||
// final Map<StatTypes, ? extends IButton> buttonMap2 =buttonMap;
|
||||
StarRating r = new StarRating();
|
||||
r.Name = card.getName();
|
||||
r.Edition = card.getEdition();
|
||||
int j = 0;
|
||||
for (int i = 1; i < 6; i++) {
|
||||
r.rating = i;
|
||||
if (QuestRatings.contains(r)) {
|
||||
j = i;
|
||||
}
|
||||
}
|
||||
boolean result = true;
|
||||
|
||||
if (j == 0) {
|
||||
if (!buttonMap2.get(StatTypes.RATE_NONE).isSelected()) {
|
||||
result = false;
|
||||
}
|
||||
} else if (j == 1) {
|
||||
if (!buttonMap2.get(StatTypes.RATE_1).isSelected()) {
|
||||
result = false;
|
||||
}
|
||||
} else if (j == 2) {
|
||||
if (!buttonMap2.get(StatTypes.RATE_2).isSelected()) {
|
||||
result = false;
|
||||
}
|
||||
} else if (j == 3) {
|
||||
if (!buttonMap2.get(StatTypes.RATE_3).isSelected()) {
|
||||
result = false;
|
||||
}
|
||||
} else if (j == 4) {
|
||||
if (!buttonMap2.get(StatTypes.RATE_4).isSelected()) {
|
||||
result = false;
|
||||
}
|
||||
} else if (j == 5) {
|
||||
if (!buttonMap2.get(StatTypes.RATE_5).isSelected()) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Predicate<PaperCard> buildFoilFilter(Map<SItemManagerUtil.StatTypes, ? extends IButton> buttonMap) {
|
||||
final int Foil = (((buttonMap.get(StatTypes.FOIL_OLD).isSelected()) ? 1 : 0)
|
||||
+ ((buttonMap.get(StatTypes.FOIL_NEW).isSelected()) ? 2 : 0)
|
||||
+ ((buttonMap.get(StatTypes.FOIL_NONE).isSelected()) ? 4 : 0));
|
||||
|
@ -1,13 +1,6 @@
|
||||
package forge.itemmanager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import forge.assets.FSkinProp;
|
||||
import forge.assets.IHasSkinProp;
|
||||
import forge.card.CardRules;
|
||||
@ -17,6 +10,12 @@ import forge.interfaces.IComboBox;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.util.ComparableOp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* Static methods for working with top-level editor methods,
|
||||
* included but not limited to preferences IO, icon generation,
|
||||
@ -64,7 +63,14 @@ public final class SItemManagerUtil {
|
||||
|
||||
FOIL_OLD (FSkinProp.FOIL_11, null, "Old style Foil cards"),
|
||||
FOIL_NEW (FSkinProp.FOIL_01, null, "New style Foil cards"),
|
||||
FOIL_NONE (FSkinProp.ICO_CLOSE, null, "non-Foil cards");
|
||||
FOIL_NONE (FSkinProp.ICO_CLOSE, null, "Non-Foil cards"),
|
||||
|
||||
RATE_NONE (FSkinProp.IMG_FAVNONE, null, "Unrated cards"),
|
||||
RATE_1 (FSkinProp.IMG_FAV1, null, "1 star cards"),
|
||||
RATE_2 (FSkinProp.IMG_FAV2, null, "2 star cards"),
|
||||
RATE_3 (FSkinProp.IMG_FAV3, null, "3 star cards"),
|
||||
RATE_4 (FSkinProp.IMG_FAV4, null, "4 star cards"),
|
||||
RATE_5 (FSkinProp.IMG_FAV5, null, "5 star cards");
|
||||
|
||||
|
||||
public final FSkinProp skinProp;
|
||||
|
@ -92,6 +92,7 @@ public final class ForgeConstants {
|
||||
public static final String SPRITE_OLD_FOILS_FILE = "sprite_old_foils.png";
|
||||
public static final String SPRITE_TROPHIES_FILE = "sprite_trophies.png";
|
||||
public static final String SPRITE_AVATARS_FILE = "sprite_avatars.png";
|
||||
public static final String SPRITE_FAVICONS_FILE = "sprite_favicons.png";
|
||||
public static final String SPRITE_PLANAR_CONQUEST_FILE = "sprite_planar_conquest.png";
|
||||
public static final String FONT_FILE = "font1.ttf";
|
||||
public static final String SPLASH_BG_FILE = "bg_splash.png";
|
||||
|
@ -32,10 +32,7 @@ import forge.properties.ForgeConstants;
|
||||
import forge.quest.bazaar.QuestBazaarManager;
|
||||
import forge.quest.bazaar.QuestItemType;
|
||||
import forge.quest.bazaar.QuestPetStorage;
|
||||
import forge.quest.data.GameFormatQuest;
|
||||
import forge.quest.data.QuestAchievements;
|
||||
import forge.quest.data.QuestAssets;
|
||||
import forge.quest.data.QuestData;
|
||||
import forge.quest.data.*;
|
||||
import forge.quest.data.QuestPreferences.DifficultyPrefs;
|
||||
import forge.quest.data.QuestPreferences.QPref;
|
||||
import forge.quest.io.QuestChallengeReader;
|
||||
@ -137,6 +134,22 @@ public class QuestController {
|
||||
return this.myCards;
|
||||
}
|
||||
|
||||
// Set the card's custom rating to N stars
|
||||
public void SetRating(String name, String edition, int n) {
|
||||
StarRating r = new StarRating();
|
||||
r.Name = name;
|
||||
r.Edition = edition;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
r.rating = i;
|
||||
model.Ratings.remove(r);
|
||||
}
|
||||
|
||||
r.rating = n;
|
||||
if (n != 0) {
|
||||
model.Ratings.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the my decks.
|
||||
*
|
||||
@ -427,6 +440,10 @@ public class QuestController {
|
||||
this.duelManager = new QuestEventDuelManager(new File(path));
|
||||
}
|
||||
|
||||
public HashSet<StarRating> GetRating() {
|
||||
return model.Ratings;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Reset the challenges manager.
|
||||
|
@ -25,6 +25,7 @@ import forge.quest.io.QuestDataIO;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
//when you create QuestDataOld and AFTER you copy the AI decks over
|
||||
@ -41,7 +42,7 @@ import java.util.Map;
|
||||
*/
|
||||
public final class QuestData {
|
||||
/** Holds the latest version of the Quest Data. */
|
||||
public static final int CURRENT_VERSION_NUMBER = 10;
|
||||
public static final int CURRENT_VERSION_NUMBER = 11;
|
||||
|
||||
// This field places the version number into QD instance,
|
||||
// but only when the object is created through the constructor
|
||||
@ -65,6 +66,8 @@ public final class QuestData {
|
||||
private final Map<Integer, String> petSlots = new HashMap<>();
|
||||
private int matchLength = 3;
|
||||
|
||||
public HashSet<StarRating> Ratings = new HashSet<StarRating>();
|
||||
|
||||
public QuestData() { //needed for XML serialization
|
||||
}
|
||||
|
||||
|
53
forge-gui/src/main/java/forge/quest/data/StarRating.java
Normal file
53
forge-gui/src/main/java/forge/quest/data/StarRating.java
Normal file
@ -0,0 +1,53 @@
|
||||
package forge.quest.data;
|
||||
|
||||
public class StarRating {
|
||||
public String Name;
|
||||
public String Edition;
|
||||
public int rating;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((Edition == null) ? 0 : Edition.hashCode());
|
||||
result = prime * result + ((Name == null) ? 0 : Name.hashCode());
|
||||
result = prime * result + rating;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
StarRating other = (StarRating) obj;
|
||||
if (Edition == null) {
|
||||
if (other.Edition != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!Edition.equals(other.Edition)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Name == null) {
|
||||
if (other.Name != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!Name.equals(other.Name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rating != other.rating) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -50,10 +50,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
@ -199,6 +196,11 @@ public class QuestDataIO {
|
||||
}
|
||||
|
||||
if (saveVersion < 11) {
|
||||
// clear player star ratings on cards - no card has been rated yet
|
||||
QuestDataIO.setFinalField(QuestData.class, "Ratings", newData, new HashSet<StarRating>());
|
||||
newData.Ratings.clear();
|
||||
}
|
||||
if (saveVersion < 12) {
|
||||
// Migrate DraftTournaments to use new Tournament class
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user