Added content downloaders for achievement images.

This commit is contained in:
Krazy
2015-09-11 03:38:18 +00:00
parent 02a8aa6075
commit 1c71ff6941
4 changed files with 53 additions and 42 deletions

View File

@@ -1,17 +1,13 @@
package forge.screens.home.settings; package forge.screens.home.settings;
import javax.swing.SwingUtilities;
import forge.UiCommand; import forge.UiCommand;
import forge.download.GuiDownloadPicturesLQ; import forge.download.*;
import forge.download.GuiDownloadPrices;
import forge.download.GuiDownloadQuestImages;
import forge.download.GuiDownloadSetPicturesLQ;
import forge.download.GuiDownloader;
import forge.error.BugReporter; import forge.error.BugReporter;
import forge.gui.ImportDialog; import forge.gui.ImportDialog;
import forge.gui.framework.ICDoc; import forge.gui.framework.ICDoc;
import javax.swing.*;
/** /**
* Controls the utilities submenu in the home UI. * Controls the utilities submenu in the home UI.
* *
@@ -42,6 +38,11 @@ public enum CSubmenuDownloaders implements ICDoc {
new GuiDownloader(new GuiDownloadQuestImages()).show(); new GuiDownloader(new GuiDownloadQuestImages()).show();
} }
}; };
private final UiCommand cmdAchievementImages = new UiCommand() {
@Override public void run() {
new GuiDownloader(new GuiDownloadAchievementImages()).show();
}
};
private final UiCommand cmdDownloadPrices = new UiCommand() { private final UiCommand cmdDownloadPrices = new UiCommand() {
@Override public void run() { @Override public void run() {
new GuiDownloader(new GuiDownloadPrices()).show(); new GuiDownloader(new GuiDownloadPrices()).show();
@@ -76,6 +77,7 @@ public enum CSubmenuDownloaders implements ICDoc {
view.setDownloadPicsCommand(cmdPicDownload); view.setDownloadPicsCommand(cmdPicDownload);
view.setDownloadSetPicsCommand(cmdSetDownload); view.setDownloadSetPicsCommand(cmdSetDownload);
view.setDownloadQuestImagesCommand(cmdQuestImages); view.setDownloadQuestImagesCommand(cmdQuestImages);
view.setDownloadAchievementImagesCommand(cmdAchievementImages);
view.setReportBugCommand(cmdReportBug); view.setReportBugCommand(cmdReportBug);
view.setImportPicturesCommand(cmdImportPictures); view.setImportPicturesCommand(cmdImportPictures);
view.setHowToPlayCommand(cmdHowToPlay); view.setHowToPlayCommand(cmdHowToPlay);

View File

@@ -38,19 +38,20 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
private final JPanel pnlContent = new JPanel(new MigLayout("insets 0, gap 0, wrap, ay center")); private final JPanel pnlContent = new JPanel(new MigLayout("insets 0, gap 0, wrap, ay center"));
private final FScrollPane scrContent = new FScrollPane(pnlContent, false); private final FScrollPane scrContent = new FScrollPane(pnlContent, false);
private final FLabel btnDownloadSetPics = _makeButton("Download LQ Set Pictures"); private final FLabel btnDownloadSetPics = _makeButton("Download LQ Set Pictures");
private final FLabel btnDownloadPics = _makeButton("Download LQ Card Pictures"); private final FLabel btnDownloadPics = _makeButton("Download LQ Card Pictures");
private final FLabel btnDownloadQuestImages = _makeButton("Download Quest Images"); private final FLabel btnDownloadQuestImages = _makeButton("Download Quest Images");
private final FLabel btnReportBug = _makeButton("Report a Bug"); private final FLabel btnDownloadAchievementImages = _makeButton("Download Achievement Images");
private final FLabel btnImportPictures = _makeButton("Import Data"); private final FLabel btnReportBug = _makeButton("Report a Bug");
private final FLabel btnHowToPlay = _makeButton("How To Play"); private final FLabel btnImportPictures = _makeButton("Import Data");
private final FLabel btnDownloadPrices = _makeButton("Download Card Prices"); private final FLabel btnHowToPlay = _makeButton("How To Play");
private final FLabel btnLicensing = _makeButton("License Details"); private final FLabel btnDownloadPrices = _makeButton("Download Card Prices");
private final FLabel btnLicensing = _makeButton("License Details");
/** /**
* Constructor. * Constructor.
*/ */
private VSubmenuDownloaders() { VSubmenuDownloaders() {
final String constraintsLBL = "w 90%!, h 20px!, center, gap 0 0 3px 8px"; final String constraintsLBL = "w 90%!, h 20px!, center, gap 0 0 3px 8px";
final String constraintsBTN = "h 30px!, w 50%!, center"; final String constraintsBTN = "h 30px!, w 50%!, center";
@@ -65,6 +66,9 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
pnlContent.add(btnDownloadQuestImages, constraintsBTN); pnlContent.add(btnDownloadQuestImages, constraintsBTN);
pnlContent.add(_makeLabel("Download tokens and icons used in Quest mode."), constraintsLBL); pnlContent.add(_makeLabel("Download tokens and icons used in Quest mode."), constraintsLBL);
pnlContent.add(btnDownloadAchievementImages, constraintsBTN);
pnlContent.add(_makeLabel("Download achievement images to really make your trophies stand out."), constraintsLBL);
pnlContent.add(btnDownloadPrices, constraintsBTN); pnlContent.add(btnDownloadPrices, constraintsBTN);
pnlContent.add(_makeLabel("Download up-to-date price list for in-game card shops."), constraintsLBL); pnlContent.add(_makeLabel("Download up-to-date price list for in-game card shops."), constraintsLBL);
@@ -103,14 +107,15 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
return EMenuGroup.SETTINGS; return EMenuGroup.SETTINGS;
} }
public void setDownloadPicsCommand(UiCommand command) { btnDownloadPics.setCommand(command); } public void setDownloadPicsCommand(UiCommand command) { btnDownloadPics.setCommand(command); }
public void setDownloadSetPicsCommand(UiCommand command) { btnDownloadSetPics.setCommand(command); } public void setDownloadSetPicsCommand(UiCommand command) { btnDownloadSetPics.setCommand(command); }
public void setDownloadQuestImagesCommand(UiCommand command) { btnDownloadQuestImages.setCommand(command); } public void setDownloadQuestImagesCommand(UiCommand command) { btnDownloadQuestImages.setCommand(command); }
public void setReportBugCommand(UiCommand command) { btnReportBug.setCommand(command); } public void setDownloadAchievementImagesCommand(UiCommand command) { btnDownloadAchievementImages.setCommand(command); }
public void setImportPicturesCommand(UiCommand command) { btnImportPictures.setCommand(command); } public void setReportBugCommand(UiCommand command) { btnReportBug.setCommand(command); }
public void setHowToPlayCommand(UiCommand command) { btnHowToPlay.setCommand(command); } public void setImportPicturesCommand(UiCommand command) { btnImportPictures.setCommand(command); }
public void setDownloadPricesCommand(UiCommand command) { btnDownloadPrices.setCommand(command); } public void setHowToPlayCommand(UiCommand command) { btnHowToPlay.setCommand(command); }
public void setLicensingCommand(UiCommand command) { btnLicensing.setCommand(command); } public void setDownloadPricesCommand(UiCommand command) { btnDownloadPrices.setCommand(command); }
public void setLicensingCommand(UiCommand command) { btnLicensing.setCommand(command); }
public void focusTopButton() { public void focusTopButton() {
btnDownloadPics.requestFocusInWindow(); btnDownloadPics.requestFocusInWindow();

View File

@@ -1,5 +1,6 @@
package forge.screens.settings; package forge.screens.settings;
import forge.download.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
@@ -8,11 +9,6 @@ import forge.Graphics;
import forge.assets.FSkinColor; import forge.assets.FSkinColor;
import forge.assets.FSkinFont; import forge.assets.FSkinFont;
import forge.assets.FSkinImage; import forge.assets.FSkinImage;
import forge.download.GuiDownloadPicturesLQ;
import forge.download.GuiDownloadPrices;
import forge.download.GuiDownloadQuestImages;
import forge.download.GuiDownloadService;
import forge.download.GuiDownloadSetPicturesLQ;
import forge.properties.ForgeProfileProperties; import forge.properties.ForgeProfileProperties;
import forge.screens.TabPageScreen.TabPage; import forge.screens.TabPageScreen.TabPage;
import forge.toolbox.FFileChooser; import forge.toolbox.FFileChooser;
@@ -56,6 +52,13 @@ public class FilesPage extends TabPage<SettingsScreen> {
return new GuiDownloadQuestImages(); return new GuiDownloadQuestImages();
} }
}, 0); }, 0);
lstItems.addItem(new ContentDownloader("Download Achievement Images",
"Download achievement images to really make your trophies stand out.") {
@Override
protected GuiDownloadService createService() {
return new GuiDownloadAchievementImages();
}
}, 0);
lstItems.addItem(new ContentDownloader("Download Card Prices", lstItems.addItem(new ContentDownloader("Download Card Prices",
"Download up-to-date price list for in-game card shops.") { "Download up-to-date price list for in-game card shops.") {
@Override @Override
@@ -98,7 +101,7 @@ public class FilesPage extends TabPage<SettingsScreen> {
protected String label; protected String label;
protected String description; protected String description;
public FilesItem(String label0, String description0) { FilesItem(String label0, String description0) {
label = label0; label = label0;
description = description0; description = description0;
} }
@@ -136,7 +139,7 @@ public class FilesPage extends TabPage<SettingsScreen> {
} }
private abstract class ContentDownloader extends FilesItem { private abstract class ContentDownloader extends FilesItem {
public ContentDownloader(String label0, String description0) { ContentDownloader(String label0, String description0) {
super(label0, description0); super(label0, description0);
} }
@@ -148,7 +151,7 @@ public class FilesPage extends TabPage<SettingsScreen> {
} }
private abstract class StorageOption extends FilesItem { private abstract class StorageOption extends FilesItem {
public StorageOption(String name0, String dir0) { StorageOption(String name0, String dir0) {
super(name0, dir0); super(name0, dir0);
} }

View File

@@ -39,6 +39,7 @@ public final class ForgeConstants {
public static final String IMAGE_LIST_QUEST_BOOSTERBOXES_FILE = LISTS_DIR + "boosterbox-images.txt"; public static final String IMAGE_LIST_QUEST_BOOSTERBOXES_FILE = LISTS_DIR + "boosterbox-images.txt";
public static final String IMAGE_LIST_QUEST_PRECONS_FILE = LISTS_DIR + "precon-images.txt"; public static final String IMAGE_LIST_QUEST_PRECONS_FILE = LISTS_DIR + "precon-images.txt";
public static final String IMAGE_LIST_QUEST_TOURNAMENTPACKS_FILE = LISTS_DIR + "tournamentpack-images.txt"; public static final String IMAGE_LIST_QUEST_TOURNAMENTPACKS_FILE = LISTS_DIR + "tournamentpack-images.txt";
public static final String IMAGE_LIST_ACHIEVEMENTS_FILE = LISTS_DIR + "achievement-images.txt";
public static final String NET_DECKS_LIST_FILE = LISTS_DIR + "net-decks.txt"; public static final String NET_DECKS_LIST_FILE = LISTS_DIR + "net-decks.txt";
public static final String NET_DECKS_COMMANDER_LIST_FILE = LISTS_DIR + "net-decks-commander.txt"; public static final String NET_DECKS_COMMANDER_LIST_FILE = LISTS_DIR + "net-decks-commander.txt";