mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Added content downloaders for achievement images.
This commit is contained in:
@@ -1,20 +1,16 @@
|
|||||||
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.
|
||||||
*
|
*
|
||||||
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
|
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -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);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import java.awt.*;
|
|||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assembles Swing components of utilities submenu singleton.
|
* Assembles Swing components of utilities submenu singleton.
|
||||||
*
|
*
|
||||||
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
|
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
|
||||||
@@ -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();
|
||||||
@@ -123,7 +128,7 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
|
|||||||
FPanel p = new FPanel(new MigLayout("insets dialog, wrap, center"));
|
FPanel p = new FPanel(new MigLayout("insets dialog, wrap, center"));
|
||||||
p.setOpaque(false);
|
p.setOpaque(false);
|
||||||
p.setBackgroundTexture(FSkin.getIcon(FSkinProp.BG_TEXTURE));
|
p.setBackgroundTexture(FSkin.getIcon(FSkinProp.BG_TEXTURE));
|
||||||
|
|
||||||
final FButton btnClose = new FButton("OK");
|
final FButton btnClose = new FButton("OK");
|
||||||
btnClose.addActionListener(new ActionListener() { @Override
|
btnClose.addActionListener(new ActionListener() { @Override
|
||||||
public void actionPerformed(final ActionEvent arg0) { SOverlayUtils.hideOverlay(); } });
|
public void actionPerformed(final ActionEvent arg0) { SOverlayUtils.hideOverlay(); } });
|
||||||
@@ -132,7 +137,7 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
|
|||||||
p.add(btnClose, "w 200!, h pref+12!, center, gaptop 30");
|
p.add(btnClose, "w 200!, h pref+12!, center, gaptop 30");
|
||||||
overlay.add(p, "gap 0 0 10% 10%");
|
overlay.add(p, "gap 0 0 10% 10%");
|
||||||
SOverlayUtils.showOverlay();
|
SOverlayUtils.showOverlay();
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -143,7 +148,7 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showLicensing() {
|
public void showLicensing() {
|
||||||
String license = "<html>Forge License Information<br><br>"
|
String license = "<html>Forge License Information<br><br>"
|
||||||
+ "This program is free software : you can redistribute it and/or modify "
|
+ "This program is free software : you can redistribute it and/or modify "
|
||||||
@@ -156,7 +161,7 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
|
|||||||
+ "GNU General Public License for more details.<br><br>"
|
+ "GNU General Public License for more details.<br><br>"
|
||||||
+ "You should have received a copy of the GNU General Public License "
|
+ "You should have received a copy of the GNU General Public License "
|
||||||
+ "along with this program. If not, see http://www.gnu.org/licenses/.</html>";
|
+ "along with this program. If not, see http://www.gnu.org/licenses/.</html>";
|
||||||
|
|
||||||
FLabel licenseLabel = new FLabel.Builder().text(license).fontSize(15).build();
|
FLabel licenseLabel = new FLabel.Builder().text(license).fontSize(15).build();
|
||||||
|
|
||||||
_showDialog(licenseLabel, null);
|
_showDialog(licenseLabel, null);
|
||||||
@@ -229,11 +234,11 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
|
|||||||
public DragCell getParentCell() {
|
public DragCell getParentCell() {
|
||||||
return parentCell;
|
return parentCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static FLabel _makeButton(String label) {
|
private static FLabel _makeButton(String label) {
|
||||||
return new FLabel.Builder().opaque().hoverable().text(label).fontSize(14).build();
|
return new FLabel.Builder().opaque().hoverable().text(label).fontSize(14).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static FLabel _makeLabel(String label) {
|
private static FLabel _makeLabel(String label) {
|
||||||
return new FLabel.Builder().fontAlign(SwingConstants.CENTER)
|
return new FLabel.Builder().fontAlign(SwingConstants.CENTER)
|
||||||
.text(label).fontStyle(Font.ITALIC).build();
|
.text(label).fontStyle(Font.ITALIC).build();
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -131,12 +134,12 @@ public class FilesPage extends TabPage<SettingsScreen> {
|
|||||||
|
|
||||||
g.drawText(value.label, font, foreColor, x, y, w, h, false, HAlignment.LEFT, false);
|
g.drawText(value.label, font, foreColor, x, y, w, h, false, HAlignment.LEFT, false);
|
||||||
h += SettingsScreen.SETTING_PADDING;
|
h += SettingsScreen.SETTING_PADDING;
|
||||||
g.drawText(value.description, SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + SettingsScreen.getInsets(w), true, HAlignment.LEFT, false);
|
g.drawText(value.description, SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + SettingsScreen.getInsets(w), true, HAlignment.LEFT, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user