mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Fix GUI refactoring issue that was preventing Android app from working on mobile devices
This commit is contained in:
@@ -21,6 +21,7 @@ import javax.swing.MenuElement;
|
|||||||
import javax.swing.MenuSelectionManager;
|
import javax.swing.MenuSelectionManager;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
@@ -83,7 +84,6 @@ import forge.view.PlayerView;
|
|||||||
import forge.view.SpellAbilityView;
|
import forge.view.SpellAbilityView;
|
||||||
|
|
||||||
public class GuiDesktop implements IGuiBase {
|
public class GuiDesktop implements IGuiBase {
|
||||||
|
|
||||||
private boolean showOverlay = true;
|
private boolean showOverlay = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -96,6 +96,12 @@ public class GuiDesktop implements IGuiBase {
|
|||||||
return BuildInfo.getVersionString();
|
return BuildInfo.getVersionString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAssetsDir() {
|
||||||
|
return StringUtils.containsIgnoreCase(BuildInfo.getVersionString(), "svn") ?
|
||||||
|
"../forge-gui/" : "";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invokeInEdtLater(Runnable proc) {
|
public void invokeInEdtLater(Runnable proc) {
|
||||||
SwingUtilities.invokeLater(proc);
|
SwingUtilities.invokeLater(proc);
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ package forge;
|
|||||||
|
|
||||||
import forge.control.FControl;
|
import forge.control.FControl;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.properties.ForgeProfileProperties;
|
|
||||||
import forge.view.FView;
|
import forge.view.FView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,8 +46,6 @@ public final class Singletons {
|
|||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ForgeProfileProperties.init(GuiBase.getInterface());
|
|
||||||
|
|
||||||
if (withUi) {
|
if (withUi) {
|
||||||
view = FView.SINGLETON_INSTANCE;
|
view = FView.SINGLETON_INSTANCE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,15 +17,11 @@
|
|||||||
*/
|
*/
|
||||||
package forge.view;
|
package forge.view;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import forge.GuiBase;
|
import forge.GuiBase;
|
||||||
import forge.GuiDesktop;
|
import forge.GuiDesktop;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.CardReaderExperiments;
|
import forge.card.CardReaderExperiments;
|
||||||
import forge.error.ExceptionHandler;
|
import forge.error.ExceptionHandler;
|
||||||
import forge.properties.ForgeConstants;
|
|
||||||
import forge.util.BuildInfo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main class for Forge's swing application view.
|
* Main class for Forge's swing application view.
|
||||||
@@ -35,10 +31,6 @@ public final class Main {
|
|||||||
* Main entrypoint for Forge
|
* Main entrypoint for Forge
|
||||||
*/
|
*/
|
||||||
public static void main(final String[] args) {
|
public static void main(final String[] args) {
|
||||||
// Init ForgeConstants
|
|
||||||
final String assetsDir = StringUtils.containsIgnoreCase(BuildInfo.getVersionString(), "svn") ? "../forge-gui/" : "";
|
|
||||||
ForgeConstants.init(assetsDir);
|
|
||||||
|
|
||||||
// HACK - temporary solution to "Comparison method violates it's general contract!" crash
|
// HACK - temporary solution to "Comparison method violates it's general contract!" crash
|
||||||
System.setProperty("java.util.Arrays.useLegacyMergeSort", "true");
|
System.setProperty("java.util.Arrays.useLegacyMergeSort", "true");
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@@ -16,7 +15,6 @@ import forge.card.CardRarity;
|
|||||||
import forge.card.CardRules;
|
import forge.card.CardRules;
|
||||||
import forge.card.DeckHints;
|
import forge.card.DeckHints;
|
||||||
import forge.properties.ForgeConstants;
|
import forge.properties.ForgeConstants;
|
||||||
import forge.util.BuildInfo;
|
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,10 +26,6 @@ public class DeckHintsTest {
|
|||||||
|
|
||||||
@BeforeTest
|
@BeforeTest
|
||||||
void setupTest() {
|
void setupTest() {
|
||||||
// Init ForgeConstants
|
|
||||||
final String assetsDir = StringUtils.containsIgnoreCase(BuildInfo.getVersionString(), "svn") ? "../forge-gui/" : "";
|
|
||||||
ForgeConstants.init(assetsDir);
|
|
||||||
|
|
||||||
GuiBase.setInterface(new GuiDesktop());
|
GuiBase.setInterface(new GuiDesktop());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,14 +11,12 @@ import com.badlogic.gdx.backends.lwjgl.LwjglClipboard;
|
|||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
import forge.assets.AssetsDownloader;
|
import forge.assets.AssetsDownloader;
|
||||||
import forge.interfaces.IDeviceAdapter;
|
import forge.interfaces.IDeviceAdapter;
|
||||||
import forge.properties.ForgeConstants;
|
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String assetsDir = AssetsDownloader.SHARE_DESKTOP_ASSETS ? "../forge-gui/" : "testAssets/";
|
String assetsDir = AssetsDownloader.SHARE_DESKTOP_ASSETS ? "../forge-gui/" : "testAssets/";
|
||||||
ForgeConstants.init(assetsDir);
|
|
||||||
if (!AssetsDownloader.SHARE_DESKTOP_ASSETS) {
|
if (!AssetsDownloader.SHARE_DESKTOP_ASSETS) {
|
||||||
FileUtil.ensureDirectoryExists(assetsDir);
|
FileUtil.ensureDirectoryExists(assetsDir);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,10 +55,9 @@ public class Forge implements ApplicationListener {
|
|||||||
|
|
||||||
public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0) {
|
public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0) {
|
||||||
if (GuiBase.getInterface() == null) {
|
if (GuiBase.getInterface() == null) {
|
||||||
ForgeConstants.init(assetDir0);
|
|
||||||
clipboard = clipboard0;
|
clipboard = clipboard0;
|
||||||
deviceAdapter = deviceAdapter0;
|
deviceAdapter = deviceAdapter0;
|
||||||
final IGuiBase gui = new GuiMobile();
|
final IGuiBase gui = new GuiMobile(assetDir0);
|
||||||
GuiBase.setInterface(gui);
|
GuiBase.setInterface(gui);
|
||||||
soundSystem = new SoundSystem(gui);
|
soundSystem = new SoundSystem(gui);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,8 +62,10 @@ import forge.view.PlayerView;
|
|||||||
import forge.view.SpellAbilityView;
|
import forge.view.SpellAbilityView;
|
||||||
|
|
||||||
public class GuiMobile implements IGuiBase {
|
public class GuiMobile implements IGuiBase {
|
||||||
|
private final String assetsDir;
|
||||||
|
|
||||||
public GuiMobile() {
|
public GuiMobile(String assetsDir0) {
|
||||||
|
assetsDir = assetsDir0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -76,6 +78,11 @@ public class GuiMobile implements IGuiBase {
|
|||||||
return Forge.CURRENT_VERSION;
|
return Forge.CURRENT_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAssetsDir() {
|
||||||
|
return assetsDir;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invokeInEdtLater(Runnable proc) {
|
public void invokeInEdtLater(Runnable proc) {
|
||||||
Gdx.app.postRunnable(proc);
|
Gdx.app.postRunnable(proc);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import forge.view.SpellAbilityView;
|
|||||||
public interface IGuiBase {
|
public interface IGuiBase {
|
||||||
boolean isRunningOnDesktop();
|
boolean isRunningOnDesktop();
|
||||||
String getCurrentVersion();
|
String getCurrentVersion();
|
||||||
|
String getAssetsDir();
|
||||||
void invokeInEdtLater(Runnable runnable);
|
void invokeInEdtLater(Runnable runnable);
|
||||||
void invokeInEdtAndWait(final Runnable proc);
|
void invokeInEdtAndWait(final Runnable proc);
|
||||||
boolean isGuiThread();
|
boolean isGuiThread();
|
||||||
|
|||||||
@@ -17,112 +17,133 @@
|
|||||||
*/
|
*/
|
||||||
package forge.properties;
|
package forge.properties;
|
||||||
|
|
||||||
|
import forge.GuiBase;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public final class ForgeConstants {
|
public final class ForgeConstants {
|
||||||
|
public static final String ASSETS_DIR = GuiBase.getInterface().getAssetsDir();
|
||||||
|
public static final String PROFILE_FILE = ASSETS_DIR + "forge.profile.properties";
|
||||||
|
public static final String PROFILE_TEMPLATE_FILE = PROFILE_FILE + ".example";
|
||||||
|
|
||||||
public static void init(final String assetsDir) {
|
public static final String RES_DIR = ASSETS_DIR + "res/";
|
||||||
ASSETS_DIR = assetsDir;
|
public static final String LISTS_DIR = RES_DIR + "lists/";
|
||||||
PROFILE_FILE = ASSETS_DIR + "forge.profile.properties";
|
public static final String KEYWORD_LIST_FILE = LISTS_DIR + "NonStackingKWList.txt";
|
||||||
PROFILE_TEMPLATE_FILE = PROFILE_FILE + ".example";
|
public static final String TYPE_LIST_FILE = LISTS_DIR + "TypeLists.txt";
|
||||||
|
public static final String IMAGE_LIST_TOKENS_FILE = LISTS_DIR + "token-images.txt";
|
||||||
|
public static final String IMAGE_LIST_QUEST_OPPONENT_ICONS_FILE = LISTS_DIR + "quest-opponent-icons.txt";
|
||||||
|
public static final String IMAGE_LIST_QUEST_PET_SHOP_ICONS_FILE = LISTS_DIR + "quest-pet-shop-icons.txt";
|
||||||
|
public static final String IMAGE_LIST_QUEST_TOKENS_FILE = LISTS_DIR + "quest-pet-token-images.txt";
|
||||||
|
public static final String IMAGE_LIST_QUEST_BOOSTERS_FILE = LISTS_DIR + "booster-images.txt";
|
||||||
|
public static final String IMAGE_LIST_QUEST_FATPACKS_FILE = LISTS_DIR + "fatpack-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_TOURNAMENTPACKS_FILE = LISTS_DIR + "tournamentpack-images.txt";
|
||||||
|
|
||||||
RES_DIR = ASSETS_DIR + "res/";
|
public static final String CHANGES_FILE = ASSETS_DIR + "CHANGES.txt";
|
||||||
LISTS_DIR = RES_DIR + "lists/";
|
public static final String LICENSE_FILE = ASSETS_DIR + "LICENSE.txt";
|
||||||
|
public static final String README_FILE = ASSETS_DIR + "README.txt";
|
||||||
|
public static final String HOWTO_FILE = RES_DIR + "howto.txt";
|
||||||
|
|
||||||
KEYWORD_LIST_FILE = LISTS_DIR + "NonStackingKWList.txt";
|
public static final String DRAFT_DIR = RES_DIR + "draft/";
|
||||||
TYPE_LIST_FILE = LISTS_DIR + "TypeLists.txt";
|
public static final String DRAFT_RANKINGS_FILE = DRAFT_DIR + "rankings.txt";
|
||||||
IMAGE_LIST_TOKENS_FILE = LISTS_DIR + "token-images.txt";
|
public static final String SEALED_DIR = RES_DIR + "sealed/";
|
||||||
IMAGE_LIST_QUEST_OPPONENT_ICONS_FILE = LISTS_DIR + "quest-opponent-icons.txt";
|
public static final String CARD_DATA_DIR = RES_DIR + "cardsfolder/";
|
||||||
IMAGE_LIST_QUEST_PET_SHOP_ICONS_FILE = LISTS_DIR + "quest-pet-shop-icons.txt";
|
public static final String EDITIONS_DIR = RES_DIR + "editions/";
|
||||||
IMAGE_LIST_QUEST_TOKENS_FILE = LISTS_DIR + "quest-pet-token-images.txt";
|
public static final String BLOCK_DATA_DIR = RES_DIR + "blockdata/";
|
||||||
IMAGE_LIST_QUEST_BOOSTERS_FILE = LISTS_DIR + "booster-images.txt";
|
public static final String DECK_CUBE_DIR = RES_DIR + "cube/";
|
||||||
IMAGE_LIST_QUEST_FATPACKS_FILE = LISTS_DIR + "fatpack-images.txt";
|
public static final String AI_PROFILE_DIR = RES_DIR + "ai/";
|
||||||
IMAGE_LIST_QUEST_BOOSTERBOXES_FILE = LISTS_DIR + "boosterbox-images.txt";
|
public static final String SOUND_DIR = RES_DIR + "sound/";
|
||||||
IMAGE_LIST_QUEST_PRECONS_FILE = LISTS_DIR + "precon-images.txt";
|
public static final String MUSIC_DIR = RES_DIR + "music/";
|
||||||
IMAGE_LIST_QUEST_TOURNAMENTPACKS_FILE = LISTS_DIR + "tournamentpack-images.txt";
|
public static final String LANG_DIR = RES_DIR + "languages/";
|
||||||
|
public static final String EFFECTS_DIR = RES_DIR + "effects/";
|
||||||
|
|
||||||
CHANGES_FILE = ASSETS_DIR + "CHANGES.txt";
|
private static final String QUEST_DIR = RES_DIR + "quest/";
|
||||||
LICENSE_FILE = ASSETS_DIR + "LICENSE.txt";
|
public static final String QUEST_WORLD_DIR = QUEST_DIR + "world/";
|
||||||
README_FILE = ASSETS_DIR + "README.txt";
|
public static final String QUEST_PRECON_DIR = QUEST_DIR + "precons/";
|
||||||
HOWTO_FILE = RES_DIR + "howto.txt";
|
public static final String PRICES_BOOSTER_FILE = QUEST_DIR + "booster-prices.txt";
|
||||||
|
public static final String BAZAAR_DIR = QUEST_DIR + "bazaar/";
|
||||||
|
public static final String BAZAAR_INDEX_FILE = BAZAAR_DIR + "index.xml";
|
||||||
|
public static final String DEFAULT_DUELS_DIR = QUEST_DIR + "duels";
|
||||||
|
public static final String DEFAULT_CHALLENGES_DIR = QUEST_DIR + "challenges";
|
||||||
|
public static final String THEMES_DIR = QUEST_DIR + "themes";
|
||||||
|
|
||||||
DRAFT_DIR = RES_DIR + "draft/";
|
public static final String SKINS_DIR = RES_DIR + "skins/";
|
||||||
DRAFT_RANKINGS_FILE = DRAFT_DIR + "rankings.txt";
|
public static final String DEFAULT_SKINS_DIR = SKINS_DIR + "default/";
|
||||||
SEALED_DIR = RES_DIR + "sealed/";
|
//don't associate these skin files with a directory since skin directory will be determined later
|
||||||
CARD_DATA_DIR = RES_DIR + "cardsfolder/";
|
public static final String SPRITE_ICONS_FILE = "sprite_icons.png";
|
||||||
EDITIONS_DIR = RES_DIR + "editions/";
|
public static final String SPRITE_FOILS_FILE = "sprite_foils.png";
|
||||||
BLOCK_DATA_DIR = RES_DIR + "blockdata/";
|
public static final String SPRITE_OLD_FOILS_FILE = "sprite_old_foils.png";
|
||||||
DECK_CUBE_DIR = RES_DIR + "cube/";
|
public static final String SPRITE_AVATARS_FILE = "sprite_avatars.png";
|
||||||
AI_PROFILE_DIR = RES_DIR + "ai/";
|
public static final String FONT_FILE = "font1.ttf";
|
||||||
SOUND_DIR = RES_DIR + "sound/";
|
public static final String SPLASH_BG_FILE = "bg_splash.png";
|
||||||
MUSIC_DIR = RES_DIR + "music/";
|
public static final String MATCH_BG_FILE = "bg_match.jpg";
|
||||||
LANG_DIR = RES_DIR + "languages/";
|
public static final String TEXTURE_BG_FILE = "bg_texture.jpg";
|
||||||
EFFECTS_DIR = RES_DIR + "effects/";
|
public static final String DRAFT_DECK_IMG_FILE = "bg_draft_deck.png";
|
||||||
|
public static final String TROPHIES_FILE = "sprite_trophies.png";
|
||||||
QUEST_DIR = RES_DIR + "quest/";
|
public static final String TROPHY_SHELF_FILE = "bg_trophy_shelf.png";
|
||||||
QUEST_WORLD_DIR = QUEST_DIR + "world/";
|
|
||||||
QUEST_PRECON_DIR = QUEST_DIR + "precons/";
|
|
||||||
PRICES_BOOSTER_FILE = QUEST_DIR + "booster-prices.txt";
|
|
||||||
BAZAAR_DIR = QUEST_DIR + "bazaar/";
|
|
||||||
BAZAAR_INDEX_FILE = BAZAAR_DIR + "index.xml";
|
|
||||||
DEFAULT_DUELS_DIR = QUEST_DIR + "duels";
|
|
||||||
DEFAULT_CHALLENGES_DIR = QUEST_DIR + "challenges";
|
|
||||||
THEMES_DIR = QUEST_DIR + "themes";
|
|
||||||
|
|
||||||
SKINS_DIR = RES_DIR + "skins/";
|
|
||||||
DEFAULT_SKINS_DIR = SKINS_DIR + "default/";
|
|
||||||
|
|
||||||
|
// data tree roots
|
||||||
|
public static final String USER_DIR;
|
||||||
|
public static final String CACHE_DIR;
|
||||||
|
public static final String CACHE_CARD_PICS_DIR;
|
||||||
|
public static final Map<String, String> CACHE_CARD_PICS_SUBDIR;
|
||||||
|
public static final int SERVER_PORT_NUMBER;
|
||||||
|
static {
|
||||||
ForgeProfileProperties.load();
|
ForgeProfileProperties.load();
|
||||||
USER_DIR = ForgeProfileProperties.getUserDir();
|
USER_DIR = ForgeProfileProperties.getUserDir();
|
||||||
CACHE_DIR = ForgeProfileProperties.getCacheDir();
|
CACHE_DIR = ForgeProfileProperties.getCacheDir();
|
||||||
CACHE_CARD_PICS_DIR = ForgeProfileProperties.getCardPicsDir();
|
CACHE_CARD_PICS_DIR = ForgeProfileProperties.getCardPicsDir();
|
||||||
CACHE_CARD_PICS_SUBDIR = Collections.unmodifiableMap(ForgeProfileProperties.getCardPicsSubDirs());
|
CACHE_CARD_PICS_SUBDIR = Collections.unmodifiableMap(ForgeProfileProperties.getCardPicsSubDirs());
|
||||||
SERVER_PORT_NUMBER = ForgeProfileProperties.getServerPort();
|
SERVER_PORT_NUMBER = ForgeProfileProperties.getServerPort();
|
||||||
|
}
|
||||||
|
|
||||||
USER_QUEST_DIR = USER_DIR + "quest/";
|
// data that is only in the profile dirs
|
||||||
USER_PREFS_DIR = USER_DIR + "preferences/";
|
public static final String USER_QUEST_DIR = USER_DIR + "quest/";
|
||||||
USER_GAMES_DIR = USER_DIR + "games/";
|
public static final String USER_PREFS_DIR = USER_DIR + "preferences/";
|
||||||
LOG_FILE = USER_DIR + "forge.log";
|
public static final String USER_GAMES_DIR = USER_DIR + "games/";
|
||||||
DECK_BASE_DIR = USER_DIR + "decks/";
|
public static final String LOG_FILE = USER_DIR + "forge.log";
|
||||||
ACHIEVEMENTS_DIR = USER_DIR + "achievements/";
|
public static final String DECK_BASE_DIR = USER_DIR + "decks/";
|
||||||
DECK_CONSTRUCTED_DIR = DECK_BASE_DIR + "constructed/";
|
public static final String ACHIEVEMENTS_DIR = USER_DIR + "achievements/";
|
||||||
DECK_DRAFT_DIR = DECK_BASE_DIR + "draft/";
|
public static final String DECK_CONSTRUCTED_DIR = DECK_BASE_DIR + "constructed/";
|
||||||
DECK_WINSTON_DIR = DECK_BASE_DIR + "winston/";
|
public static final String DECK_DRAFT_DIR = DECK_BASE_DIR + "draft/";
|
||||||
DECK_SEALED_DIR = DECK_BASE_DIR + "sealed/";
|
public static final String DECK_WINSTON_DIR = DECK_BASE_DIR + "winston/";
|
||||||
DECK_SCHEME_DIR = DECK_BASE_DIR + "scheme/";
|
public static final String DECK_SEALED_DIR = DECK_BASE_DIR + "sealed/";
|
||||||
DECK_PLANE_DIR = DECK_BASE_DIR + "planar/";
|
public static final String DECK_SCHEME_DIR = DECK_BASE_DIR + "scheme/";
|
||||||
DECK_COMMANDER_DIR = DECK_BASE_DIR + "commander/";
|
public static final String DECK_PLANE_DIR = DECK_BASE_DIR + "planar/";
|
||||||
QUEST_SAVE_DIR = USER_QUEST_DIR + "saves/";
|
public static final String DECK_COMMANDER_DIR = DECK_BASE_DIR + "commander/";
|
||||||
MAIN_PREFS_FILE = USER_PREFS_DIR + "forge.preferences";
|
public static final String QUEST_SAVE_DIR = USER_QUEST_DIR + "saves/";
|
||||||
CARD_PREFS_FILE = USER_PREFS_DIR + "card.preferences";
|
public static final String MAIN_PREFS_FILE = USER_PREFS_DIR + "forge.preferences";
|
||||||
DECK_PREFS_FILE = USER_PREFS_DIR + "deck.preferences";
|
public static final String CARD_PREFS_FILE = USER_PREFS_DIR + "card.preferences";
|
||||||
QUEST_PREFS_FILE = USER_PREFS_DIR + "quest.preferences";
|
public static final String DECK_PREFS_FILE = USER_PREFS_DIR + "deck.preferences";
|
||||||
ITEM_VIEW_PREFS_FILE = USER_PREFS_DIR + "item_view.preferences";
|
public static final String QUEST_PREFS_FILE = USER_PREFS_DIR + "quest.preferences";
|
||||||
|
public static final String ITEM_VIEW_PREFS_FILE = USER_PREFS_DIR + "item_view.preferences";
|
||||||
|
|
||||||
_DEFAULTS_DIR = RES_DIR + "defaults/";
|
// data that has defaults in the program dir but overrides/additions in the user dir
|
||||||
NO_CARD_FILE = _DEFAULTS_DIR + "no_card.jpg";
|
private static final String _DEFAULTS_DIR = RES_DIR + "defaults/";
|
||||||
|
public static final String NO_CARD_FILE = _DEFAULTS_DIR + "no_card.jpg";
|
||||||
|
public static final FileLocation WINDOW_LAYOUT_FILE = new FileLocation(_DEFAULTS_DIR, USER_PREFS_DIR, "window.xml");
|
||||||
|
public static final FileLocation MATCH_LAYOUT_FILE = new FileLocation(_DEFAULTS_DIR, USER_PREFS_DIR, "match.xml");
|
||||||
|
public static final FileLocation WORKSHOP_LAYOUT_FILE = new FileLocation(_DEFAULTS_DIR, USER_PREFS_DIR, "workshop.xml");
|
||||||
|
public static final FileLocation EDITOR_LAYOUT_FILE = new FileLocation(_DEFAULTS_DIR, USER_PREFS_DIR, "editor.xml");
|
||||||
|
public static final FileLocation GAUNTLET_DIR = new FileLocation(_DEFAULTS_DIR, USER_DIR, "gauntlet/");
|
||||||
|
|
||||||
WINDOW_LAYOUT_FILE = new FileLocation(_DEFAULTS_DIR, USER_PREFS_DIR, "window.xml");
|
// data that is only in the cached dir
|
||||||
MATCH_LAYOUT_FILE = new FileLocation(_DEFAULTS_DIR, USER_PREFS_DIR, "match.xml");
|
private static final String PICS_DIR = CACHE_DIR + "pics/";
|
||||||
WORKSHOP_LAYOUT_FILE = new FileLocation(_DEFAULTS_DIR, USER_PREFS_DIR, "workshop.xml");
|
public static final String DB_DIR = CACHE_DIR + "db/";
|
||||||
EDITOR_LAYOUT_FILE = new FileLocation(_DEFAULTS_DIR, USER_PREFS_DIR, "editor.xml");
|
public static final String FONTS_DIR = CACHE_DIR + "fonts/";
|
||||||
GAUNTLET_DIR = new FileLocation(_DEFAULTS_DIR, USER_DIR, "gauntlet/");
|
public static final String CACHE_TOKEN_PICS_DIR = PICS_DIR + "tokens/";
|
||||||
|
public static final String CACHE_ICON_PICS_DIR = PICS_DIR + "icons/";
|
||||||
|
public static final String CACHE_SYMBOLS_DIR = PICS_DIR + "symbols/";
|
||||||
|
public static final String CACHE_BOOSTER_PICS_DIR = PICS_DIR + "boosters/";
|
||||||
|
public static final String CACHE_FATPACK_PICS_DIR = PICS_DIR + "fatpacks/";
|
||||||
|
public static final String CACHE_BOOSTERBOX_PICS_DIR = PICS_DIR + "boosterboxes/";
|
||||||
|
public static final String CACHE_PRECON_PICS_DIR = PICS_DIR + "precons/";
|
||||||
|
public static final String CACHE_TOURNAMENTPACK_PICS_DIR = PICS_DIR + "tournamentpacks/";
|
||||||
|
public static final String QUEST_CARD_PRICE_FILE = DB_DIR + "all-prices.txt";
|
||||||
|
|
||||||
PICS_DIR = CACHE_DIR + "pics/";
|
public static final String[] PROFILE_DIRS = {
|
||||||
DB_DIR = CACHE_DIR + "db/";
|
|
||||||
FONTS_DIR = CACHE_DIR + "fonts/";
|
|
||||||
CACHE_TOKEN_PICS_DIR = PICS_DIR + "tokens/";
|
|
||||||
CACHE_ICON_PICS_DIR = PICS_DIR + "icons/";
|
|
||||||
CACHE_SYMBOLS_DIR = PICS_DIR + "symbols/";
|
|
||||||
CACHE_BOOSTER_PICS_DIR = PICS_DIR + "boosters/";
|
|
||||||
CACHE_FATPACK_PICS_DIR = PICS_DIR + "fatpacks/";
|
|
||||||
CACHE_BOOSTERBOX_PICS_DIR = PICS_DIR + "boosterboxes/";
|
|
||||||
CACHE_PRECON_PICS_DIR = PICS_DIR + "precons/";
|
|
||||||
CACHE_TOURNAMENTPACK_PICS_DIR = PICS_DIR + "tournamentpacks/";
|
|
||||||
QUEST_CARD_PRICE_FILE = DB_DIR + "all-prices.txt";
|
|
||||||
|
|
||||||
PROFILE_DIRS = new String[] {
|
|
||||||
USER_DIR,
|
USER_DIR,
|
||||||
CACHE_DIR,
|
CACHE_DIR,
|
||||||
CACHE_CARD_PICS_DIR,
|
CACHE_CARD_PICS_DIR,
|
||||||
@@ -142,122 +163,6 @@ public final class ForgeConstants {
|
|||||||
CACHE_BOOSTERBOX_PICS_DIR,
|
CACHE_BOOSTERBOX_PICS_DIR,
|
||||||
CACHE_PRECON_PICS_DIR,
|
CACHE_PRECON_PICS_DIR,
|
||||||
CACHE_TOURNAMENTPACK_PICS_DIR };
|
CACHE_TOURNAMENTPACK_PICS_DIR };
|
||||||
}
|
|
||||||
|
|
||||||
public static String ASSETS_DIR;
|
|
||||||
public static String PROFILE_FILE;
|
|
||||||
public static String PROFILE_TEMPLATE_FILE;
|
|
||||||
|
|
||||||
public static String RES_DIR;
|
|
||||||
public static String LISTS_DIR;
|
|
||||||
public static String KEYWORD_LIST_FILE;
|
|
||||||
public static String TYPE_LIST_FILE;
|
|
||||||
public static String IMAGE_LIST_TOKENS_FILE;
|
|
||||||
public static String IMAGE_LIST_QUEST_OPPONENT_ICONS_FILE;
|
|
||||||
public static String IMAGE_LIST_QUEST_PET_SHOP_ICONS_FILE;
|
|
||||||
public static String IMAGE_LIST_QUEST_TOKENS_FILE;
|
|
||||||
public static String IMAGE_LIST_QUEST_BOOSTERS_FILE;
|
|
||||||
public static String IMAGE_LIST_QUEST_FATPACKS_FILE;
|
|
||||||
public static String IMAGE_LIST_QUEST_BOOSTERBOXES_FILE;
|
|
||||||
public static String IMAGE_LIST_QUEST_PRECONS_FILE;
|
|
||||||
public static String IMAGE_LIST_QUEST_TOURNAMENTPACKS_FILE;
|
|
||||||
|
|
||||||
public static String CHANGES_FILE;
|
|
||||||
public static String LICENSE_FILE;
|
|
||||||
public static String README_FILE;
|
|
||||||
public static String HOWTO_FILE;
|
|
||||||
|
|
||||||
public static String DRAFT_DIR;
|
|
||||||
public static String DRAFT_RANKINGS_FILE;
|
|
||||||
public static String SEALED_DIR;
|
|
||||||
public static String CARD_DATA_DIR;
|
|
||||||
public static String EDITIONS_DIR;
|
|
||||||
public static String BLOCK_DATA_DIR;
|
|
||||||
public static String DECK_CUBE_DIR;
|
|
||||||
public static String AI_PROFILE_DIR;
|
|
||||||
public static String SOUND_DIR;
|
|
||||||
public static String MUSIC_DIR;
|
|
||||||
public static String LANG_DIR;
|
|
||||||
public static String EFFECTS_DIR;
|
|
||||||
|
|
||||||
private static String QUEST_DIR;
|
|
||||||
public static String QUEST_WORLD_DIR;
|
|
||||||
public static String QUEST_PRECON_DIR;
|
|
||||||
public static String PRICES_BOOSTER_FILE;
|
|
||||||
public static String BAZAAR_DIR;
|
|
||||||
public static String BAZAAR_INDEX_FILE;
|
|
||||||
public static String DEFAULT_DUELS_DIR;
|
|
||||||
public static String DEFAULT_CHALLENGES_DIR;
|
|
||||||
public static String THEMES_DIR;
|
|
||||||
|
|
||||||
public static String SKINS_DIR;
|
|
||||||
public static String DEFAULT_SKINS_DIR;
|
|
||||||
//don't associate these skin files with a directory since skin directory will be determined later
|
|
||||||
public static final String SPRITE_ICONS_FILE = "sprite_icons.png";
|
|
||||||
public static final String SPRITE_FOILS_FILE = "sprite_foils.png";
|
|
||||||
public static final String SPRITE_OLD_FOILS_FILE = "sprite_old_foils.png";
|
|
||||||
public static final String SPRITE_AVATARS_FILE = "sprite_avatars.png";
|
|
||||||
public static final String TROPHIES_FILE = "sprite_trophies.png";
|
|
||||||
public static final String TROPHY_SHELF_FILE = "bg_trophy_shelf.png";
|
|
||||||
public static final String FONT_FILE = "font1.ttf";
|
|
||||||
public static final String SPLASH_BG_FILE = "bg_splash.png";
|
|
||||||
public static final String MATCH_BG_FILE = "bg_match.jpg";
|
|
||||||
public static final String TEXTURE_BG_FILE = "bg_texture.jpg";
|
|
||||||
public static final String DRAFT_DECK_IMG_FILE = "bg_draft_deck.png";
|
|
||||||
|
|
||||||
// data tree roots
|
|
||||||
public static String USER_DIR;
|
|
||||||
public static String CACHE_DIR;
|
|
||||||
public static String CACHE_CARD_PICS_DIR;
|
|
||||||
public static Map<String, String> CACHE_CARD_PICS_SUBDIR;
|
|
||||||
public static int SERVER_PORT_NUMBER;
|
|
||||||
|
|
||||||
// data that is only in the profile dirs
|
|
||||||
public static String USER_QUEST_DIR;
|
|
||||||
public static String USER_PREFS_DIR;
|
|
||||||
public static String USER_GAMES_DIR;
|
|
||||||
public static String LOG_FILE;
|
|
||||||
public static String DECK_BASE_DIR;
|
|
||||||
public static String ACHIEVEMENTS_DIR;
|
|
||||||
public static String DECK_CONSTRUCTED_DIR;
|
|
||||||
public static String DECK_DRAFT_DIR;
|
|
||||||
public static String DECK_WINSTON_DIR;
|
|
||||||
public static String DECK_SEALED_DIR;
|
|
||||||
public static String DECK_SCHEME_DIR;
|
|
||||||
public static String DECK_PLANE_DIR;
|
|
||||||
public static String DECK_COMMANDER_DIR;
|
|
||||||
public static String QUEST_SAVE_DIR;
|
|
||||||
public static String MAIN_PREFS_FILE;
|
|
||||||
public static String CARD_PREFS_FILE;
|
|
||||||
public static String DECK_PREFS_FILE;
|
|
||||||
public static String QUEST_PREFS_FILE;
|
|
||||||
public static String ITEM_VIEW_PREFS_FILE;
|
|
||||||
public static String ACHIEVEMENTS_FILE;
|
|
||||||
|
|
||||||
// data that has defaults in the program dir but overrides/additions in the user dir
|
|
||||||
private static String _DEFAULTS_DIR;
|
|
||||||
public static String NO_CARD_FILE;
|
|
||||||
public static FileLocation WINDOW_LAYOUT_FILE;
|
|
||||||
public static FileLocation MATCH_LAYOUT_FILE;
|
|
||||||
public static FileLocation WORKSHOP_LAYOUT_FILE;
|
|
||||||
public static FileLocation EDITOR_LAYOUT_FILE;
|
|
||||||
public static FileLocation GAUNTLET_DIR;
|
|
||||||
|
|
||||||
// data that is only in the cached dir
|
|
||||||
private static String PICS_DIR;
|
|
||||||
public static String DB_DIR;
|
|
||||||
public static String FONTS_DIR;
|
|
||||||
public static String CACHE_TOKEN_PICS_DIR;
|
|
||||||
public static String CACHE_ICON_PICS_DIR;
|
|
||||||
public static String CACHE_SYMBOLS_DIR;
|
|
||||||
public static String CACHE_BOOSTER_PICS_DIR;
|
|
||||||
public static String CACHE_FATPACK_PICS_DIR;
|
|
||||||
public static String CACHE_BOOSTERBOX_PICS_DIR;
|
|
||||||
public static String CACHE_PRECON_PICS_DIR;
|
|
||||||
public static String CACHE_TOURNAMENTPACK_PICS_DIR;
|
|
||||||
public static String QUEST_CARD_PRICE_FILE;
|
|
||||||
|
|
||||||
public static String[] PROFILE_DIRS;
|
|
||||||
|
|
||||||
// URLs
|
// URLs
|
||||||
private static final String URL_CARDFORGE = "http://cardforge.org";
|
private static final String URL_CARDFORGE = "http://cardforge.org";
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import java.util.Properties;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import forge.interfaces.IGuiBase;
|
import forge.GuiBase;
|
||||||
import forge.util.FileSection;
|
import forge.util.FileSection;
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
|
|
||||||
@@ -36,7 +36,6 @@ import forge.util.FileUtil;
|
|||||||
* so they can be easily appended with further path elements.
|
* so they can be easily appended with further path elements.
|
||||||
*/
|
*/
|
||||||
public class ForgeProfileProperties {
|
public class ForgeProfileProperties {
|
||||||
private static boolean isRunningOnDesktop;
|
|
||||||
private static String userDir;
|
private static String userDir;
|
||||||
private static String cacheDir;
|
private static String cacheDir;
|
||||||
private static String cardPicsDir;
|
private static String cardPicsDir;
|
||||||
@@ -53,8 +52,7 @@ public class ForgeProfileProperties {
|
|||||||
//prevent initializing static class
|
//prevent initializing static class
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init(final IGuiBase gui) {
|
public static void init() {
|
||||||
isRunningOnDesktop = gui.isRunningOnDesktop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void load() {
|
public static void load() {
|
||||||
@@ -149,7 +147,7 @@ public class ForgeProfileProperties {
|
|||||||
|
|
||||||
// returns a pair <userDir, cacheDir>
|
// returns a pair <userDir, cacheDir>
|
||||||
private static Pair<String, String> getDefaultDirs() {
|
private static Pair<String, String> getDefaultDirs() {
|
||||||
if (isRunningOnDesktop) { //special case for mobile devices
|
if (!GuiBase.getInterface().isRunningOnDesktop()) { //special case for mobile devices
|
||||||
String assetsDir = ForgeConstants.ASSETS_DIR;
|
String assetsDir = ForgeConstants.ASSETS_DIR;
|
||||||
return Pair.of(assetsDir + "data" + File.separator, assetsDir + "cache" + File.separator);
|
return Pair.of(assetsDir + "data" + File.separator, assetsDir + "cache" + File.separator);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user