mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
Move custom skins to cache
- added skins downloader
This commit is contained in:
@@ -60,6 +60,11 @@ public enum CSubmenuDownloaders implements ICDoc {
|
||||
new GuiDownloader(new GuiDownloadPrices()).show();
|
||||
}
|
||||
};
|
||||
private final UiCommand cmdDownloadSkins = new UiCommand() {
|
||||
@Override public void run() {
|
||||
new GuiDownloader(new GuiDownloadSkins()).show();
|
||||
}
|
||||
};
|
||||
private final UiCommand cmdHowToPlay = new UiCommand() {
|
||||
@Override public void run() {
|
||||
VSubmenuDownloaders.SINGLETON_INSTANCE.showHowToPlay();
|
||||
@@ -102,6 +107,7 @@ public enum CSubmenuDownloaders implements ICDoc {
|
||||
view.setImportPicturesCommand(cmdImportPictures);
|
||||
view.setHowToPlayCommand(cmdHowToPlay);
|
||||
view.setDownloadPricesCommand(cmdDownloadPrices);
|
||||
view.setDownloadSkinsCommand(cmdDownloadSkins);
|
||||
view.setLicensingCommand(cmdLicensing);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
|
||||
private final FLabel btnImportPictures = _makeButton(localizer.getMessage("btnImportPictures"));
|
||||
private final FLabel btnHowToPlay = _makeButton(localizer.getMessage("btnHowToPlay"));
|
||||
private final FLabel btnDownloadPrices = _makeButton(localizer.getMessage("btnDownloadPrices"));
|
||||
private final FLabel btnDownloadSkins = _makeButton(localizer.getMessage("btnDownloadSkins"));
|
||||
private final FLabel btnLicensing = _makeButton(localizer.getMessage("btnLicensing"));
|
||||
|
||||
/**
|
||||
@@ -102,6 +103,9 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
|
||||
pnlContent.add(btnDownloadPrices, constraintsBTN);
|
||||
pnlContent.add(_makeLabel(localizer.getMessage("lblDownloadPrices")), constraintsLBL);
|
||||
|
||||
pnlContent.add(btnDownloadSkins, constraintsBTN);
|
||||
pnlContent.add(_makeLabel(localizer.getMessage("lblDownloadSkins")), constraintsLBL);
|
||||
|
||||
} else {
|
||||
|
||||
String text = localizer.getMessage("lblYourVersionOfJavaIsTooOld");
|
||||
@@ -178,6 +182,7 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
|
||||
public void setHowToPlayCommand(UiCommand command) { btnHowToPlay.setCommand(command); }
|
||||
public void setDownloadPricesCommand(UiCommand command) { btnDownloadPrices.setCommand(command); }
|
||||
public void setLicensingCommand(UiCommand command) { btnLicensing.setCommand(command); }
|
||||
public void setDownloadSkinsCommand(UiCommand command) { btnDownloadSkins.setCommand(command); }
|
||||
|
||||
public void focusTopButton() {
|
||||
btnDownloadPics.requestFocusInWindow();
|
||||
|
||||
@@ -1089,6 +1089,7 @@ public class FSkin {
|
||||
|
||||
if (allSkins == null) { //initialize
|
||||
allSkins = new ArrayList<>();
|
||||
allSkins.add("Default");//init default
|
||||
final List<String> skinDirectoryNames = getSkinDirectoryNames();
|
||||
for (String skinDirectoryName : skinDirectoryNames) {
|
||||
allSkins.add(WordUtil.capitalize(skinDirectoryName.replace('_', ' ')));
|
||||
@@ -1101,7 +1102,7 @@ public class FSkin {
|
||||
|
||||
// Non-default (preferred) skin name and dir.
|
||||
preferredName = skinName.toLowerCase().replace(' ', '_');
|
||||
preferredDir = ForgeConstants.SKINS_DIR + preferredName + "/";
|
||||
preferredDir = preferredName.equals("default") ? ForgeConstants.DEFAULT_SKINS_DIR : ForgeConstants.CACHE_SKINS_DIR + preferredName + "/";
|
||||
|
||||
if (onInit) {
|
||||
final File f = new File(preferredDir + ForgeConstants.SPLASH_BG_FILE);
|
||||
@@ -1371,7 +1372,7 @@ public class FSkin {
|
||||
public static List<String> getSkinDirectoryNames() {
|
||||
final List<String> mySkins = new ArrayList<>();
|
||||
|
||||
final File dir = new File(ForgeConstants.SKINS_DIR);
|
||||
final File dir = new File(ForgeConstants.CACHE_SKINS_DIR);
|
||||
final String[] children = dir.list();
|
||||
if (children == null) {
|
||||
System.err.println("FSkin > can't find skins directory!");
|
||||
|
||||
Reference in New Issue
Block a user