2013-04-12 19:32:25 -07:00
|
|
|
package magic.data;
|
|
|
|
|
2015-05-20 13:19:52 -07:00
|
|
|
import java.awt.Color;
|
2016-03-29 13:22:49 -07:00
|
|
|
import java.awt.Dimension;
|
|
|
|
import java.awt.Point;
|
|
|
|
import java.awt.Rectangle;
|
2013-04-12 19:32:25 -07:00
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
2014-08-02 10:55:45 -07:00
|
|
|
import java.net.InetSocketAddress;
|
|
|
|
import java.net.Proxy;
|
2014-05-23 00:31:38 -07:00
|
|
|
import java.nio.file.Path;
|
2014-05-24 02:55:39 -07:00
|
|
|
import java.nio.file.Paths;
|
2015-03-14 13:41:42 -07:00
|
|
|
import java.text.ParseException;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.Date;
|
2013-04-12 19:32:25 -07:00
|
|
|
import java.util.Properties;
|
2015-12-12 01:26:22 -08:00
|
|
|
import magic.ui.CardTextLanguage;
|
2016-12-14 13:48:12 -08:00
|
|
|
import magic.ui.dialog.prefs.ImageSizePresets;
|
2017-01-21 00:33:35 -08:00
|
|
|
import magic.ui.screen.images.download.CardImageDisplayMode;
|
2016-10-05 05:29:34 -07:00
|
|
|
import magic.ui.widget.duel.animation.AnimationFx;
|
2016-10-05 05:02:39 -07:00
|
|
|
import magic.ui.widget.message.MessageStyle;
|
2016-12-14 13:48:12 -08:00
|
|
|
import magic.utility.FileIO;
|
2014-08-17 01:21:23 -07:00
|
|
|
import magic.utility.MagicFileSystem;
|
2013-04-12 19:32:25 -07:00
|
|
|
|
|
|
|
public class GeneralConfig {
|
|
|
|
|
2015-08-21 01:40:30 -07:00
|
|
|
private static final GeneralConfig INSTANCE = new GeneralConfig();
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2014-05-27 12:06:31 -07:00
|
|
|
public static final String CONFIG_FILENAME="general.cfg";
|
2015-12-16 00:01:15 -08:00
|
|
|
|
2016-10-31 12:53:44 -07:00
|
|
|
private Properties settings;
|
|
|
|
|
2015-12-16 00:01:15 -08:00
|
|
|
private boolean isMissingFiles = false;
|
|
|
|
|
2016-03-29 13:22:49 -07:00
|
|
|
private static final String FRAME_LEFT = "left";
|
|
|
|
private int frameLeft = -1;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2016-03-29 13:22:49 -07:00
|
|
|
private static final String FRAME_TOP = "top";
|
|
|
|
private int frameTop = -1;
|
2015-12-20 19:39:14 -08:00
|
|
|
|
2016-03-29 13:22:49 -07:00
|
|
|
private static final String FRAME_WIDTH = "width";
|
|
|
|
public static final int DEFAULT_FRAME_WIDTH = 1024;
|
|
|
|
private int frameWidth = DEFAULT_FRAME_WIDTH;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2016-03-29 13:22:49 -07:00
|
|
|
private static final String FRAME_HEIGHT = "height";
|
|
|
|
public static final int DEFAULT_FRAME_HEIGHT = 600;
|
|
|
|
private int frameHeight = DEFAULT_FRAME_HEIGHT;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
private static final String MAXIMIZED="maximized";
|
2015-12-16 00:01:15 -08:00
|
|
|
private boolean maximized=false;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
private static final String THEME="theme";
|
2015-12-16 00:01:15 -08:00
|
|
|
private String theme="felt";
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
private static final String AVATAR="avatar";
|
2015-12-16 00:01:15 -08:00
|
|
|
private String avatar="legend";
|
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
private static final String HIGHLIGHT = "highlight";
|
2015-12-16 00:01:15 -08:00
|
|
|
private String highlight = "theme";
|
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
private static final String SKIP_SINGLE="single";
|
2015-12-16 00:01:15 -08:00
|
|
|
private boolean skipSingle = true;
|
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
private static final String ALWAYS_PASS="pass";
|
2015-12-16 00:01:15 -08:00
|
|
|
private boolean alwaysPass = true;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
private static final String SMART_TARGET="target";
|
2015-12-16 00:01:15 -08:00
|
|
|
private boolean smartTarget = false;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
private static final String POPUP_DELAY="popup";
|
2015-12-16 00:01:15 -08:00
|
|
|
private int popupDelay = 300;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
private static final String MESSAGE_DELAY = "message";
|
2015-12-16 00:01:15 -08:00
|
|
|
private int messageDelay = 2000;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
private static final String TOUCHSCREEN = "touchscreen";
|
2015-12-16 00:01:15 -08:00
|
|
|
private boolean touchscreen = false;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2013-10-26 18:25:33 -07:00
|
|
|
private static final String MOUSEWHEEL_POPUP = "mousewheel";
|
2015-12-16 00:01:15 -08:00
|
|
|
private boolean mouseWheelPopup = false;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2013-12-01 10:01:06 -08:00
|
|
|
private static final String FULLSCREEN = "fullScreen";
|
2015-12-16 00:01:15 -08:00
|
|
|
private boolean fullScreen = false;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2013-12-03 03:38:10 -08:00
|
|
|
private static final String PREVIEW_CARD_ON_SELECT = "previewCardOnSelect";
|
2015-12-16 00:01:15 -08:00
|
|
|
private boolean previewCardOnSelect = true;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2013-12-11 03:00:34 -08:00
|
|
|
private static final String SHOW_LOG_MESSAGES = "showLogMessages";
|
2015-12-16 00:01:15 -08:00
|
|
|
private boolean showLogMessages = true;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2014-01-23 12:44:12 -08:00
|
|
|
private static final String MULLIGAN_SCREEN = "mulliganScreen";
|
2015-12-16 00:01:15 -08:00
|
|
|
private boolean isMulliganScreenActive = true;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2014-02-03 22:36:15 -08:00
|
|
|
private static final String RECENT_DECK = "MostRecentDeckFilename";
|
2015-12-16 00:01:15 -08:00
|
|
|
private String mostRecentDeckFilename = "";
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2014-04-22 09:43:17 -07:00
|
|
|
private static final String CUSTOM_BACKGROUND = "customBackground";
|
2015-12-16 00:01:15 -08:00
|
|
|
private boolean isCustomBackground = false;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2014-05-23 00:31:38 -07:00
|
|
|
private static final String CARD_IMAGES_PATH = "cardImagesPath";
|
2015-12-16 00:01:15 -08:00
|
|
|
private String cardImagesPath = "";
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2014-05-26 23:33:48 -07:00
|
|
|
private static final String ANIMATE_GAMEPLAY = "animateGameplay";
|
2015-12-16 00:01:15 -08:00
|
|
|
private boolean animateGameplay = true;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2015-12-16 00:01:15 -08:00
|
|
|
private static final String ANIMATION_FLAGS = "animationFlags";
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2014-07-21 01:30:06 -07:00
|
|
|
private static final String DECK_FILE_MAX_LINES = "deckFileMaxLines";
|
2015-12-16 00:01:15 -08:00
|
|
|
private int deckFileMaxLines = 500;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2014-08-02 10:55:45 -07:00
|
|
|
private static final String PROXY_SETTINGS = "proxySettings";
|
2015-12-16 00:01:15 -08:00
|
|
|
private String proxySettings = "";
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2014-09-03 10:15:41 -07:00
|
|
|
private static final String FIREMIND_ACCESS_TOKEN = "firemindAccessToken";
|
2015-12-16 00:01:15 -08:00
|
|
|
private String firemindAccessToken = "";
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2014-09-11 03:22:59 -07:00
|
|
|
private static final String NEWTURN_ALERT_DURATION = "newTurnAlertDuration";
|
2015-12-16 00:01:15 -08:00
|
|
|
private int newTurnAlertDuration = 3000; // msecs
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2014-09-11 04:24:07 -07:00
|
|
|
private static final String LAND_PREVIEW_DURATION = "landPreviewDuration";
|
2015-12-16 00:01:15 -08:00
|
|
|
private int landPreviewDuration = 5000; // msecs
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2014-09-11 04:24:07 -07:00
|
|
|
private static final String NONLAND_PREVIEW_DURATION = "nonLandPreviewDuration";
|
2015-12-16 00:01:15 -08:00
|
|
|
private int nonLandPreviewDuration = 10000; // msecs
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2014-09-23 05:30:49 -07:00
|
|
|
private static final String SPLITVIEW_DECKEDITOR = "splitViewDeckEditor";
|
2015-12-16 00:01:15 -08:00
|
|
|
private boolean isSplitViewDeckEditor = false;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2014-11-12 03:12:13 -08:00
|
|
|
private static final String OVERLAY_PERMANENT_MIN_HEIGHT = "overlayPermanentMinHeight";
|
2015-12-16 00:01:15 -08:00
|
|
|
private int overlayPermanentMinHeight = 30; // pixels
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2014-11-25 07:36:19 -08:00
|
|
|
private static final String IGNORED_VERSION_ALERT = "ignoredVersionAlert";
|
2015-12-16 00:01:15 -08:00
|
|
|
private String ignoredVersionAlert = "";
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2014-12-02 12:27:30 -08:00
|
|
|
private static final String PAUSE_GAME_POPUP = "pauseGamePopup";
|
2015-12-16 00:01:15 -08:00
|
|
|
private boolean isGamePausedOnPopup = false;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2015-11-16 06:08:00 -08:00
|
|
|
private static final String MISSING_DOWNLOAD_DATE = "missingImagesDownloadDate";
|
2016-03-26 03:14:53 -07:00
|
|
|
private String unimplementedImagesDownloadDate = "1970-01-01";
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2015-12-16 00:01:15 -08:00
|
|
|
private static final String PLAYABLE_DOWNLOAD_DATE = "imageDownloaderRunDate";
|
|
|
|
private String playableImagesDownloadDate = "1970-01-01";
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2015-03-22 10:54:08 -07:00
|
|
|
private static final String DUEL_SIDEBAR_LAYOUT ="duelSidebarLayout";
|
2015-12-16 00:01:15 -08:00
|
|
|
private String duelSidebarLayout = "LOGSTACK,PLAYER2,TURNINFO,PLAYER1";
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2015-03-29 09:24:57 -07:00
|
|
|
private static final String HIDE_AI_ACTION_PROMPT ="hideAiActionPrompt";
|
2015-12-16 00:01:15 -08:00
|
|
|
private boolean hideAiActionPrompt = false;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2015-05-20 13:19:52 -07:00
|
|
|
private static final String ROLLOVER_COLOR ="rolloverColor";
|
2015-12-16 00:01:15 -08:00
|
|
|
private Color rolloverColor = Color.YELLOW;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2016-01-02 17:44:41 -08:00
|
|
|
private static final String UI_VOLUME = "uiSoundVolume";
|
|
|
|
private int uiVolume = 80;
|
|
|
|
|
|
|
|
private static final String GAME_VOLUME = "gameVolume";
|
|
|
|
private int gameVolume = 80;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2015-06-30 12:18:41 -07:00
|
|
|
private static final String TRANSLATION = "translation";
|
2015-07-07 06:33:47 -07:00
|
|
|
public static final String DEFAULT_TRANSLATION = "";
|
2015-06-30 12:18:41 -07:00
|
|
|
private String translation = DEFAULT_TRANSLATION;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2015-12-16 00:01:15 -08:00
|
|
|
private static final String LOG_MESSAGE_STYLE = "logMessageStyle";
|
2015-09-24 13:39:06 -07:00
|
|
|
private MessageStyle logMessageStyle = MessageStyle.PLAIN;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2015-12-16 00:01:15 -08:00
|
|
|
private static final String PREF_IMAGE_SIZE = "prefImageSize";
|
2015-12-14 12:57:53 -08:00
|
|
|
private ImageSizePresets preferredImageSize = ImageSizePresets.SIZE_ORIGINAL;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2015-12-16 00:01:15 -08:00
|
|
|
private static final String CARD_TEXT_LANG = "cardTextLanguage";
|
2015-12-12 01:26:22 -08:00
|
|
|
private CardTextLanguage cardTextLanguage = CardTextLanguage.ENGLISH;
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2016-03-18 05:13:43 -07:00
|
|
|
private static final String IMAGES_ON_DEMAND = "imagesOnDemand";
|
|
|
|
private boolean imagesOnDemand = false;
|
|
|
|
|
2016-10-06 03:50:13 -07:00
|
|
|
private static final String CUSTOM_SCROLLBAR = "customScrollBar";
|
|
|
|
private boolean isCustomScrollBar = true;
|
|
|
|
|
2016-10-14 11:50:32 -07:00
|
|
|
private static final String KEYWORDS_SCREEN = "keywordsScreen";
|
|
|
|
private String keywordsScreen;
|
|
|
|
|
2017-01-21 00:33:35 -08:00
|
|
|
private static final String CARD_DISPLAY_MODE = "cardImageDisplayMode";
|
|
|
|
private CardImageDisplayMode cardDisplayMode = CardImageDisplayMode.PRINTED;
|
2017-01-10 09:50:52 -08:00
|
|
|
|
2016-01-30 10:30:16 -08:00
|
|
|
private boolean isStatsVisible = true;
|
|
|
|
|
2014-04-17 11:46:55 -07:00
|
|
|
private GeneralConfig() { }
|
|
|
|
|
2014-08-02 10:55:45 -07:00
|
|
|
public Proxy getProxy() {
|
|
|
|
final String DELIM = "\\|";
|
|
|
|
final String proxyString = proxySettings.trim();
|
|
|
|
if (proxyString.isEmpty() || proxyString.split(DELIM).length != 3) {
|
|
|
|
return Proxy.NO_PROXY;
|
|
|
|
} else {
|
|
|
|
final Proxy.Type proxyType = Proxy.Type.valueOf(proxyString.split(DELIM)[0]);
|
|
|
|
final int port = Integer.parseInt(proxyString.split(DELIM)[1]);
|
|
|
|
final String urlAddress = proxyString.split(DELIM)[2];
|
|
|
|
return new Proxy(proxyType, new InetSocketAddress(urlAddress, port));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setProxy(final Proxy proxy) {
|
|
|
|
final String DELIM = "|";
|
|
|
|
if (proxy != Proxy.NO_PROXY && proxy.type() != Proxy.Type.DIRECT) {
|
|
|
|
final StringBuffer sb = new StringBuffer();
|
|
|
|
sb.append(proxy.type().toString()).append(DELIM);
|
|
|
|
sb.append(Integer.toString(((InetSocketAddress)proxy.address()).getPort())).append(DELIM);
|
|
|
|
sb.append(proxy.address().toString());
|
|
|
|
proxySettings = sb.toString();
|
|
|
|
} else {
|
|
|
|
proxySettings = "";
|
2015-12-31 02:54:52 -08:00
|
|
|
}
|
2014-08-02 10:55:45 -07:00
|
|
|
}
|
|
|
|
|
2014-07-21 01:30:06 -07:00
|
|
|
public int getDeckFileMaxLines() {
|
|
|
|
return deckFileMaxLines;
|
|
|
|
}
|
|
|
|
|
2015-11-26 05:34:02 -08:00
|
|
|
public boolean showGameplayAnimations() {
|
2016-01-16 20:56:03 -08:00
|
|
|
return animateGameplay;
|
2014-05-26 23:33:48 -07:00
|
|
|
}
|
2014-09-04 22:15:28 -07:00
|
|
|
|
|
|
|
public boolean getAnimateGameplay() {
|
|
|
|
return animateGameplay;
|
|
|
|
}
|
2014-05-26 23:33:48 -07:00
|
|
|
public void setAnimateGameplay(boolean b) {
|
|
|
|
animateGameplay = b;
|
|
|
|
}
|
|
|
|
|
2014-05-24 02:55:39 -07:00
|
|
|
public Path getCardImagesPath() {
|
2014-05-25 09:56:20 -07:00
|
|
|
if (cardImagesPath.isEmpty()) {
|
2015-10-14 03:59:01 -07:00
|
|
|
return MagicFileSystem.getDataPath(MagicFileSystem.DataPath.IMAGES);
|
2014-05-25 09:56:20 -07:00
|
|
|
} else {
|
|
|
|
return Paths.get(cardImagesPath);
|
|
|
|
}
|
2014-05-23 00:31:38 -07:00
|
|
|
}
|
2015-10-26 04:39:15 -07:00
|
|
|
public void setCardImagesPath(final Path p) {
|
|
|
|
if (MagicFileSystem.directoryContains(MagicFileSystem.INSTALL_PATH, p)) {
|
2014-05-25 09:56:20 -07:00
|
|
|
this.cardImagesPath = "";
|
|
|
|
} else {
|
2015-10-26 04:39:15 -07:00
|
|
|
this.cardImagesPath = p.toAbsolutePath().toString();
|
2014-05-25 09:56:20 -07:00
|
|
|
}
|
2014-05-23 00:31:38 -07:00
|
|
|
}
|
|
|
|
|
2014-04-22 09:43:17 -07:00
|
|
|
public boolean isCustomBackground() {
|
|
|
|
return isCustomBackground;
|
|
|
|
}
|
|
|
|
public void setCustomBackground(boolean isCustomBackground) {
|
|
|
|
this.isCustomBackground = isCustomBackground;
|
|
|
|
}
|
|
|
|
|
2014-02-04 15:36:39 -08:00
|
|
|
public boolean isMissingFiles() {
|
|
|
|
return isMissingFiles;
|
|
|
|
}
|
|
|
|
public void setIsMissingFiles(final boolean b) {
|
|
|
|
isMissingFiles = b;
|
|
|
|
}
|
|
|
|
|
2014-07-20 13:15:53 -07:00
|
|
|
/**
|
|
|
|
* Gets fully qualified path of last deck file to be opened in the deck editor.
|
|
|
|
*
|
|
|
|
* @return path object or null if setting is missing.
|
|
|
|
*/
|
|
|
|
public Path getMostRecentDeckFilePath() {
|
|
|
|
return !mostRecentDeckFilename.isEmpty() ? Paths.get(mostRecentDeckFilename) : null;
|
2014-02-03 22:36:15 -08:00
|
|
|
}
|
|
|
|
public void setMostRecentDeckFilename(final String filename) {
|
2014-07-20 13:15:53 -07:00
|
|
|
mostRecentDeckFilename = filename.trim();
|
2014-02-03 22:36:15 -08:00
|
|
|
}
|
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public boolean isMaximized() {
|
|
|
|
return maximized;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setMaximized(final boolean maximized) {
|
|
|
|
this.maximized=maximized;
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public String getTheme() {
|
|
|
|
return theme;
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public void setTheme(final String theme) {
|
|
|
|
this.theme=theme;
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public String getAvatar() {
|
|
|
|
return avatar;
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public boolean isHighlightNone() {
|
|
|
|
return "none".equals(highlight);
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public boolean isHighlightOverlay() {
|
|
|
|
return "overlay".equals(highlight);
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public boolean isHighlightTheme() {
|
|
|
|
return "theme".equals(highlight);
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public String getHighlight() {
|
|
|
|
return highlight;
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public void setHighlight(final String highlight) {
|
|
|
|
this.highlight = highlight;
|
|
|
|
}
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2014-09-03 10:15:41 -07:00
|
|
|
public String getFiremindAccessToken() {
|
|
|
|
return firemindAccessToken;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setFiremindAccessToken(final String firemindAccessToken) {
|
|
|
|
this.firemindAccessToken = firemindAccessToken;
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public boolean getSkipSingle() {
|
|
|
|
return skipSingle;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSkipSingle(final boolean skipSingle) {
|
|
|
|
this.skipSingle=skipSingle;
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public boolean getAlwaysPass() {
|
|
|
|
return alwaysPass;
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public void setAlwaysPass(final boolean alwaysPass) {
|
|
|
|
this.alwaysPass=alwaysPass;
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
|
|
|
public boolean getSmartTarget() {
|
2013-04-12 19:32:25 -07:00
|
|
|
return smartTarget;
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public void setSmartTarget(final boolean smartTarget) {
|
|
|
|
this.smartTarget=smartTarget;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getPopupDelay() {
|
|
|
|
return popupDelay;
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public void setPopupDelay(final int popupDelay) {
|
|
|
|
this.popupDelay=popupDelay;
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public int getMessageDelay() {
|
|
|
|
return messageDelay;
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public void setMessageDelay(final int messageDelay) {
|
|
|
|
this.messageDelay = messageDelay;
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public boolean isTouchscreen() {
|
|
|
|
return touchscreen;
|
|
|
|
}
|
|
|
|
|
2013-06-23 18:33:35 -07:00
|
|
|
public void setTouchscreen(final boolean touchscreen) {
|
2013-04-12 19:32:25 -07:00
|
|
|
this.touchscreen = touchscreen;
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-10-26 18:25:33 -07:00
|
|
|
public boolean isMouseWheelPopup() {
|
|
|
|
return mouseWheelPopup;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setMouseWheelPopup(final boolean mouseWheelPopup) {
|
|
|
|
this.mouseWheelPopup = mouseWheelPopup;
|
|
|
|
}
|
|
|
|
|
2013-12-01 10:01:06 -08:00
|
|
|
public boolean isFullScreen() {
|
|
|
|
return fullScreen;
|
|
|
|
}
|
|
|
|
public void setFullScreen(final boolean b) {
|
|
|
|
this.fullScreen = b;
|
|
|
|
}
|
|
|
|
|
2013-12-03 03:38:10 -08:00
|
|
|
public boolean isPreviewCardOnSelect() {
|
|
|
|
return previewCardOnSelect;
|
|
|
|
}
|
|
|
|
public void setPreviewCardOnSelect(final boolean b) {
|
|
|
|
this.previewCardOnSelect = b;
|
|
|
|
}
|
|
|
|
|
2013-12-11 03:00:34 -08:00
|
|
|
public boolean isLogMessagesVisible() {
|
|
|
|
return showLogMessages;
|
|
|
|
}
|
|
|
|
public void setLogMessagesVisible(final boolean b) {
|
|
|
|
showLogMessages = b;
|
|
|
|
}
|
|
|
|
|
2014-01-23 12:44:12 -08:00
|
|
|
public boolean showMulliganScreen() {
|
2016-01-16 20:56:03 -08:00
|
|
|
return isMulliganScreenActive;
|
2014-01-23 12:44:12 -08:00
|
|
|
}
|
2014-09-04 22:18:05 -07:00
|
|
|
|
2017-01-13 10:12:18 -08:00
|
|
|
public void setShowMulliganScreen(final boolean b) {
|
2014-01-23 12:44:12 -08:00
|
|
|
isMulliganScreenActive = b;
|
|
|
|
}
|
2013-12-03 03:38:10 -08:00
|
|
|
|
2014-09-11 03:22:59 -07:00
|
|
|
public int getNewTurnAlertDuration() {
|
|
|
|
return newTurnAlertDuration;
|
2014-09-03 10:04:53 -07:00
|
|
|
}
|
2014-09-11 03:22:59 -07:00
|
|
|
public void setNewTurnAlertDuration(final int value) {
|
|
|
|
newTurnAlertDuration = value;
|
2014-09-03 10:04:53 -07:00
|
|
|
}
|
2014-05-11 12:22:46 -07:00
|
|
|
|
2014-09-11 04:24:07 -07:00
|
|
|
public int getLandPreviewDuration() {
|
|
|
|
return landPreviewDuration;
|
|
|
|
}
|
|
|
|
public void setLandPreviewDuration(final int value) {
|
|
|
|
landPreviewDuration = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getNonLandPreviewDuration() {
|
|
|
|
return nonLandPreviewDuration;
|
|
|
|
}
|
|
|
|
public void setNonLandPreviewDuration(final int value) {
|
|
|
|
nonLandPreviewDuration = value;
|
|
|
|
}
|
|
|
|
|
2014-09-23 05:30:49 -07:00
|
|
|
public boolean isSplitViewDeckEditor() {
|
|
|
|
return isSplitViewDeckEditor;
|
|
|
|
}
|
|
|
|
public void setIsSplitViewDeckEditor(boolean b) {
|
|
|
|
isSplitViewDeckEditor = b;
|
|
|
|
}
|
2014-09-11 04:24:07 -07:00
|
|
|
|
2014-11-25 07:36:19 -08:00
|
|
|
public String getIgnoredVersionAlert() {
|
|
|
|
return ignoredVersionAlert;
|
|
|
|
}
|
|
|
|
public void setIgnoredVersionAlert(final String version) {
|
|
|
|
ignoredVersionAlert = version;
|
|
|
|
}
|
|
|
|
|
2014-11-12 03:12:13 -08:00
|
|
|
/**
|
|
|
|
* Minimum height of card image on which overlays such as P/T,
|
|
|
|
* ability icons, etc should be shown.
|
|
|
|
* <p>
|
|
|
|
* Non-user: requires manual update of config file to change.
|
|
|
|
*/
|
|
|
|
public int getOverlayMinimumHeight() {
|
|
|
|
return overlayPermanentMinHeight;
|
|
|
|
}
|
|
|
|
|
2014-12-02 12:27:30 -08:00
|
|
|
public boolean isGamePausedOnPopup() {
|
|
|
|
return isGamePausedOnPopup;
|
|
|
|
}
|
|
|
|
public void setIsGamePausedOnPopup(final boolean b) {
|
|
|
|
isGamePausedOnPopup = b;
|
|
|
|
}
|
|
|
|
|
2015-03-22 10:54:08 -07:00
|
|
|
public String getDuelSidebarLayout() {
|
|
|
|
return duelSidebarLayout;
|
|
|
|
}
|
2015-03-26 06:07:57 -07:00
|
|
|
public void setDuelSidebarLayout(final String layout) {
|
|
|
|
duelSidebarLayout = layout;
|
|
|
|
}
|
2015-03-22 20:18:01 -07:00
|
|
|
|
2015-11-16 05:40:12 -08:00
|
|
|
/**
|
|
|
|
* Gets the last date playable images were downloaded.
|
|
|
|
* <p>
|
|
|
|
* If missing then date is set to "1970-01-01".
|
|
|
|
*/
|
|
|
|
public Date getPlayableImagesDownloadDate() {
|
2015-03-14 13:41:42 -07:00
|
|
|
try {
|
|
|
|
final SimpleDateFormat df = new SimpleDateFormat(CardProperty.IMAGE_UPDATED_FORMAT);
|
2015-11-16 05:40:12 -08:00
|
|
|
return df.parse(playableImagesDownloadDate);
|
2015-03-14 13:41:42 -07:00
|
|
|
} catch (ParseException ex) {
|
|
|
|
throw new RuntimeException(ex);
|
|
|
|
}
|
|
|
|
}
|
2015-11-16 05:40:12 -08:00
|
|
|
public void setPlayableImagesDownloadDate(final Date runDate) {
|
2015-03-14 13:41:42 -07:00
|
|
|
final SimpleDateFormat df = new SimpleDateFormat(CardProperty.IMAGE_UPDATED_FORMAT);
|
2015-11-16 05:40:12 -08:00
|
|
|
playableImagesDownloadDate = df.format(runDate);
|
2015-03-14 13:41:42 -07:00
|
|
|
}
|
|
|
|
|
2015-11-16 06:08:00 -08:00
|
|
|
/**
|
2016-03-26 03:14:53 -07:00
|
|
|
* Gets the last date unimplemented images were downloaded.
|
2015-11-16 06:08:00 -08:00
|
|
|
* <p>
|
|
|
|
* If missing then date is set to "1970-01-01".
|
|
|
|
*/
|
2016-03-26 03:14:53 -07:00
|
|
|
public Date getUnimplementedImagesDownloadDate() {
|
2015-11-16 06:08:00 -08:00
|
|
|
try {
|
|
|
|
final SimpleDateFormat df = new SimpleDateFormat(CardProperty.IMAGE_UPDATED_FORMAT);
|
2016-03-26 03:14:53 -07:00
|
|
|
return df.parse(unimplementedImagesDownloadDate);
|
2015-11-16 06:08:00 -08:00
|
|
|
} catch (ParseException ex) {
|
|
|
|
throw new RuntimeException(ex);
|
|
|
|
}
|
|
|
|
}
|
2016-03-26 03:14:53 -07:00
|
|
|
public void setUnimplementedImagesDownloadDate(final Date runDate) {
|
2015-11-16 06:08:00 -08:00
|
|
|
final SimpleDateFormat df = new SimpleDateFormat(CardProperty.IMAGE_UPDATED_FORMAT);
|
2016-03-26 03:14:53 -07:00
|
|
|
unimplementedImagesDownloadDate = df.format(runDate);
|
2015-11-16 06:08:00 -08:00
|
|
|
}
|
|
|
|
|
2015-03-29 09:24:57 -07:00
|
|
|
public boolean getHideAiActionPrompt() {
|
|
|
|
return hideAiActionPrompt;
|
|
|
|
}
|
|
|
|
public void setHideAiActionPrompt(final boolean b) {
|
|
|
|
hideAiActionPrompt = b;
|
|
|
|
}
|
2015-03-14 13:41:42 -07:00
|
|
|
|
2015-05-20 13:19:52 -07:00
|
|
|
public Color getRolloverColor() {
|
|
|
|
return rolloverColor;
|
|
|
|
}
|
|
|
|
public void setRolloverColor(final Color aColor) {
|
|
|
|
rolloverColor = aColor;
|
|
|
|
}
|
|
|
|
|
2016-01-02 17:44:41 -08:00
|
|
|
public int getUiVolume() {
|
|
|
|
return uiVolume;
|
2015-06-18 16:17:19 -07:00
|
|
|
}
|
2016-01-02 17:44:41 -08:00
|
|
|
public void setUiVolume(final int aInt) {
|
|
|
|
uiVolume = aInt;
|
2015-06-18 16:17:19 -07:00
|
|
|
}
|
|
|
|
|
2015-06-30 12:18:41 -07:00
|
|
|
public String getTranslation() {
|
|
|
|
return translation;
|
|
|
|
}
|
|
|
|
public void setTranslation(final String aString) {
|
|
|
|
translation = aString;
|
|
|
|
}
|
|
|
|
|
2015-09-24 13:39:06 -07:00
|
|
|
public MessageStyle getLogMessageStyle() {
|
|
|
|
return logMessageStyle;
|
|
|
|
}
|
|
|
|
public void setLogMessageStyle(MessageStyle aStyle) {
|
|
|
|
logMessageStyle = aStyle;
|
|
|
|
}
|
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
private void load(final Properties properties) {
|
2016-10-31 12:53:44 -07:00
|
|
|
this.settings = properties;
|
2016-03-29 13:22:49 -07:00
|
|
|
frameLeft=Integer.parseInt(properties.getProperty(FRAME_LEFT,""+frameLeft));
|
|
|
|
frameTop=Integer.parseInt(properties.getProperty(FRAME_TOP,""+frameTop));
|
|
|
|
frameWidth=Integer.parseInt(properties.getProperty(FRAME_WIDTH,""+frameWidth));
|
|
|
|
frameHeight=Integer.parseInt(properties.getProperty(FRAME_HEIGHT,""+frameHeight));
|
2015-12-16 00:01:15 -08:00
|
|
|
maximized=Boolean.parseBoolean(properties.getProperty(MAXIMIZED,""+maximized));
|
|
|
|
theme=properties.getProperty(THEME,theme);
|
|
|
|
avatar=properties.getProperty(AVATAR,avatar);
|
|
|
|
highlight = properties.getProperty(HIGHLIGHT, highlight);
|
|
|
|
skipSingle=Boolean.parseBoolean(properties.getProperty(SKIP_SINGLE,""+skipSingle));
|
|
|
|
alwaysPass=Boolean.parseBoolean(properties.getProperty(ALWAYS_PASS,""+alwaysPass));
|
|
|
|
smartTarget=Boolean.parseBoolean(properties.getProperty(SMART_TARGET,""+smartTarget));
|
|
|
|
popupDelay=Integer.parseInt(properties.getProperty(POPUP_DELAY,""+popupDelay));
|
|
|
|
messageDelay = Integer.parseInt(properties.getProperty(MESSAGE_DELAY,"" + messageDelay));
|
|
|
|
touchscreen = Boolean.parseBoolean(properties.getProperty(TOUCHSCREEN,""+touchscreen));
|
|
|
|
mouseWheelPopup = Boolean.parseBoolean(properties.getProperty(MOUSEWHEEL_POPUP, "" + mouseWheelPopup));
|
|
|
|
fullScreen = Boolean.parseBoolean(properties.getProperty(FULLSCREEN, "" + fullScreen));
|
|
|
|
previewCardOnSelect = Boolean.parseBoolean(properties.getProperty(PREVIEW_CARD_ON_SELECT, "" + previewCardOnSelect));
|
|
|
|
showLogMessages = Boolean.parseBoolean(properties.getProperty(SHOW_LOG_MESSAGES, "" + showLogMessages));
|
|
|
|
isMulliganScreenActive = Boolean.parseBoolean(properties.getProperty(MULLIGAN_SCREEN, "" + isMulliganScreenActive));
|
|
|
|
mostRecentDeckFilename = properties.getProperty(RECENT_DECK, mostRecentDeckFilename).trim();
|
|
|
|
isCustomBackground = Boolean.parseBoolean(properties.getProperty(CUSTOM_BACKGROUND, "" + isCustomBackground));
|
|
|
|
cardImagesPath = properties.getProperty(CARD_IMAGES_PATH, cardImagesPath);
|
2015-12-15 23:53:26 -08:00
|
|
|
animateGameplay = Boolean.parseBoolean(properties.getProperty(ANIMATE_GAMEPLAY, "" + animateGameplay));
|
2015-12-16 00:01:15 -08:00
|
|
|
deckFileMaxLines = Integer.parseInt(properties.getProperty(DECK_FILE_MAX_LINES, ""+ deckFileMaxLines));
|
|
|
|
proxySettings = properties.getProperty(PROXY_SETTINGS, proxySettings);
|
|
|
|
firemindAccessToken = properties.getProperty(FIREMIND_ACCESS_TOKEN, firemindAccessToken);
|
|
|
|
newTurnAlertDuration = Integer.parseInt(properties.getProperty(NEWTURN_ALERT_DURATION,"" + newTurnAlertDuration));
|
|
|
|
landPreviewDuration = Integer.parseInt(properties.getProperty(LAND_PREVIEW_DURATION,"" + landPreviewDuration));
|
|
|
|
nonLandPreviewDuration = Integer.parseInt(properties.getProperty(NONLAND_PREVIEW_DURATION,"" + nonLandPreviewDuration));
|
2015-12-15 23:53:26 -08:00
|
|
|
isSplitViewDeckEditor = Boolean.parseBoolean(properties.getProperty(SPLITVIEW_DECKEDITOR, "" + isSplitViewDeckEditor));
|
2015-12-16 00:01:15 -08:00
|
|
|
overlayPermanentMinHeight = Integer.parseInt(properties.getProperty(OVERLAY_PERMANENT_MIN_HEIGHT, "" + overlayPermanentMinHeight));
|
|
|
|
ignoredVersionAlert = properties.getProperty(IGNORED_VERSION_ALERT, ignoredVersionAlert);
|
|
|
|
isGamePausedOnPopup = Boolean.parseBoolean(properties.getProperty(PAUSE_GAME_POPUP, "" + isGamePausedOnPopup));
|
2016-03-26 03:14:53 -07:00
|
|
|
unimplementedImagesDownloadDate = properties.getProperty(MISSING_DOWNLOAD_DATE, unimplementedImagesDownloadDate);
|
2015-12-16 00:01:15 -08:00
|
|
|
playableImagesDownloadDate = properties.getProperty(PLAYABLE_DOWNLOAD_DATE, playableImagesDownloadDate);
|
|
|
|
duelSidebarLayout = properties.getProperty(DUEL_SIDEBAR_LAYOUT, duelSidebarLayout);
|
|
|
|
hideAiActionPrompt = Boolean.parseBoolean(properties.getProperty(HIDE_AI_ACTION_PROMPT, "" + hideAiActionPrompt));
|
|
|
|
rolloverColor = new Color(Integer.parseInt(properties.getProperty(ROLLOVER_COLOR, "" + rolloverColor.getRGB())));
|
2016-01-02 17:44:41 -08:00
|
|
|
uiVolume = Integer.parseInt(properties.getProperty(UI_VOLUME, "" + uiVolume));
|
2015-12-16 00:01:15 -08:00
|
|
|
translation = properties.getProperty(TRANSLATION, translation);
|
|
|
|
logMessageStyle = MessageStyle.valueOf(properties.getProperty(LOG_MESSAGE_STYLE, logMessageStyle.name()));
|
2015-11-29 12:17:06 -08:00
|
|
|
AnimationFx.setFlags(Integer.parseInt(properties.getProperty(ANIMATION_FLAGS, "" + AnimationFx.getFlags())));
|
2015-12-16 00:01:15 -08:00
|
|
|
preferredImageSize = ImageSizePresets.valueOf(properties.getProperty(PREF_IMAGE_SIZE, preferredImageSize.name()));
|
|
|
|
cardTextLanguage = CardTextLanguage.valueOf(properties.getProperty(CARD_TEXT_LANG, cardTextLanguage.name()));
|
2016-01-02 17:44:41 -08:00
|
|
|
gameVolume = Integer.parseInt(properties.getProperty(GAME_VOLUME, "" + gameVolume));
|
2016-03-18 05:13:43 -07:00
|
|
|
imagesOnDemand = Boolean.parseBoolean(properties.getProperty(IMAGES_ON_DEMAND, "" + imagesOnDemand));
|
2016-10-06 03:50:13 -07:00
|
|
|
isCustomScrollBar = Boolean.parseBoolean(properties.getProperty(CUSTOM_SCROLLBAR, "" + isCustomScrollBar));
|
2016-10-14 11:50:32 -07:00
|
|
|
keywordsScreen = properties.getProperty(KEYWORDS_SCREEN, "");
|
2017-01-21 00:33:35 -08:00
|
|
|
cardDisplayMode = CardImageDisplayMode.valueOf(properties.getProperty(CARD_DISPLAY_MODE, cardDisplayMode.name()));
|
2013-04-12 19:32:25 -07:00
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public void load() {
|
|
|
|
load(FileIO.toProp(getConfigFile()));
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
private void save(final Properties properties) {
|
2016-03-29 13:22:49 -07:00
|
|
|
properties.setProperty(FRAME_LEFT,String.valueOf(frameLeft));
|
|
|
|
properties.setProperty(FRAME_TOP,String.valueOf(frameTop));
|
|
|
|
properties.setProperty(FRAME_WIDTH,String.valueOf(frameWidth));
|
|
|
|
properties.setProperty(FRAME_HEIGHT,String.valueOf(frameHeight));
|
2013-04-12 19:32:25 -07:00
|
|
|
properties.setProperty(MAXIMIZED,String.valueOf(maximized));
|
|
|
|
properties.setProperty(THEME,theme);
|
|
|
|
properties.setProperty(AVATAR,avatar);
|
|
|
|
properties.setProperty(HIGHLIGHT,highlight);
|
|
|
|
properties.setProperty(SKIP_SINGLE,String.valueOf(skipSingle));
|
|
|
|
properties.setProperty(ALWAYS_PASS,String.valueOf(alwaysPass));
|
|
|
|
properties.setProperty(SMART_TARGET,String.valueOf(smartTarget));
|
|
|
|
properties.setProperty(POPUP_DELAY,String.valueOf(popupDelay));
|
|
|
|
properties.setProperty(MESSAGE_DELAY,String.valueOf(messageDelay));
|
|
|
|
properties.setProperty(TOUCHSCREEN,String.valueOf(touchscreen));
|
2013-10-26 18:25:33 -07:00
|
|
|
properties.setProperty(MOUSEWHEEL_POPUP, String.valueOf(mouseWheelPopup));
|
2013-12-01 10:01:06 -08:00
|
|
|
properties.setProperty(FULLSCREEN, String.valueOf(fullScreen));
|
2013-12-03 03:38:10 -08:00
|
|
|
properties.setProperty(PREVIEW_CARD_ON_SELECT, String.valueOf(previewCardOnSelect));
|
2013-12-11 03:00:34 -08:00
|
|
|
properties.setProperty(SHOW_LOG_MESSAGES, String.valueOf(showLogMessages));
|
2014-01-23 12:44:12 -08:00
|
|
|
properties.setProperty(MULLIGAN_SCREEN, String.valueOf(isMulliganScreenActive));
|
2014-02-03 22:36:15 -08:00
|
|
|
properties.setProperty(RECENT_DECK, mostRecentDeckFilename);
|
2014-04-22 09:43:17 -07:00
|
|
|
properties.setProperty(CUSTOM_BACKGROUND, String.valueOf(isCustomBackground));
|
2014-05-25 09:56:20 -07:00
|
|
|
properties.setProperty(CARD_IMAGES_PATH, cardImagesPath);
|
2014-05-26 23:33:48 -07:00
|
|
|
properties.setProperty(ANIMATE_GAMEPLAY, String.valueOf(animateGameplay));
|
2014-08-02 10:55:45 -07:00
|
|
|
properties.setProperty(PROXY_SETTINGS, proxySettings);
|
2014-09-03 22:51:04 -07:00
|
|
|
properties.setProperty(FIREMIND_ACCESS_TOKEN, firemindAccessToken);
|
2014-09-11 03:22:59 -07:00
|
|
|
properties.setProperty(NEWTURN_ALERT_DURATION, String.valueOf(newTurnAlertDuration));
|
2014-09-11 04:24:07 -07:00
|
|
|
properties.setProperty(LAND_PREVIEW_DURATION, String.valueOf(landPreviewDuration));
|
|
|
|
properties.setProperty(NONLAND_PREVIEW_DURATION, String.valueOf(nonLandPreviewDuration));
|
2014-09-23 05:30:49 -07:00
|
|
|
properties.setProperty(SPLITVIEW_DECKEDITOR, String.valueOf(isSplitViewDeckEditor));
|
2014-11-25 07:36:19 -08:00
|
|
|
properties.setProperty(IGNORED_VERSION_ALERT, ignoredVersionAlert);
|
2014-12-02 12:27:30 -08:00
|
|
|
properties.setProperty(PAUSE_GAME_POPUP, String.valueOf(isGamePausedOnPopup));
|
2016-03-26 03:14:53 -07:00
|
|
|
properties.setProperty(MISSING_DOWNLOAD_DATE, unimplementedImagesDownloadDate);
|
2015-11-16 05:40:12 -08:00
|
|
|
properties.setProperty(PLAYABLE_DOWNLOAD_DATE, playableImagesDownloadDate);
|
2015-03-22 10:54:08 -07:00
|
|
|
properties.setProperty(DUEL_SIDEBAR_LAYOUT, duelSidebarLayout);
|
2015-03-29 09:24:57 -07:00
|
|
|
properties.setProperty(HIDE_AI_ACTION_PROMPT, String.valueOf(hideAiActionPrompt));
|
2015-05-20 13:19:52 -07:00
|
|
|
properties.setProperty(ROLLOVER_COLOR, String.valueOf(rolloverColor.getRGB()));
|
2016-01-02 17:44:41 -08:00
|
|
|
properties.setProperty(UI_VOLUME, String.valueOf(uiVolume));
|
2015-06-30 12:18:41 -07:00
|
|
|
properties.setProperty(TRANSLATION, translation);
|
2015-09-24 13:39:06 -07:00
|
|
|
properties.setProperty(LOG_MESSAGE_STYLE, logMessageStyle.name());
|
2015-11-29 12:17:06 -08:00
|
|
|
properties.setProperty(ANIMATION_FLAGS, String.valueOf(AnimationFx.getFlags()));
|
2015-12-14 12:57:53 -08:00
|
|
|
properties.setProperty(PREF_IMAGE_SIZE, preferredImageSize.name());
|
2015-12-12 01:26:22 -08:00
|
|
|
properties.setProperty(CARD_TEXT_LANG, cardTextLanguage.name());
|
2016-01-02 17:44:41 -08:00
|
|
|
properties.setProperty(GAME_VOLUME, String.valueOf(gameVolume));
|
2016-03-18 05:13:43 -07:00
|
|
|
properties.setProperty(IMAGES_ON_DEMAND, String.valueOf(imagesOnDemand));
|
2016-10-06 03:50:13 -07:00
|
|
|
properties.setProperty(CUSTOM_SCROLLBAR, String.valueOf(isCustomScrollBar));
|
2016-10-14 11:50:32 -07:00
|
|
|
properties.setProperty(KEYWORDS_SCREEN, keywordsScreen);
|
2017-01-21 00:33:35 -08:00
|
|
|
properties.setProperty(CARD_DISPLAY_MODE, cardDisplayMode.name());
|
2013-04-12 19:32:25 -07:00
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
public void save() {
|
2016-10-31 12:53:44 -07:00
|
|
|
save(settings);
|
2016-10-14 11:50:32 -07:00
|
|
|
try {
|
2016-10-31 12:53:44 -07:00
|
|
|
FileIO.toFile(getConfigFile(), settings, "Magarena settings");
|
2013-04-12 19:32:25 -07:00
|
|
|
} catch (final IOException ex) {
|
|
|
|
System.err.println("ERROR! Unable to save general config");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private static File getConfigFile() {
|
2014-08-17 01:21:23 -07:00
|
|
|
return MagicFileSystem.getDataPath().resolve(CONFIG_FILENAME).toFile();
|
2013-04-12 19:32:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public static GeneralConfig getInstance() {
|
|
|
|
return INSTANCE;
|
|
|
|
}
|
2013-12-01 10:01:06 -08:00
|
|
|
|
2015-07-17 19:19:02 -07:00
|
|
|
public boolean isCustomCardImagesPath() {
|
|
|
|
return cardImagesPath.isEmpty() == false;
|
|
|
|
}
|
|
|
|
|
2015-12-14 12:57:53 -08:00
|
|
|
public ImageSizePresets getPreferredImageSize() {
|
2015-12-01 09:10:03 -08:00
|
|
|
return preferredImageSize;
|
|
|
|
}
|
|
|
|
|
2015-12-14 12:57:53 -08:00
|
|
|
public void setPreferredImageSize(ImageSizePresets preset) {
|
|
|
|
this.preferredImageSize = preset;
|
2015-12-01 09:10:03 -08:00
|
|
|
}
|
|
|
|
|
2015-12-12 01:26:22 -08:00
|
|
|
public CardTextLanguage getCardTextLanguage() {
|
|
|
|
return cardTextLanguage;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setCardTextLanguage(CardTextLanguage aLang) {
|
|
|
|
this.cardTextLanguage = aLang;
|
|
|
|
}
|
|
|
|
|
2016-01-02 17:44:41 -08:00
|
|
|
public int getGameVolume() {
|
|
|
|
return gameVolume;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setGameVolume(int value) {
|
|
|
|
gameVolume = value;
|
|
|
|
}
|
2016-01-30 10:30:16 -08:00
|
|
|
|
|
|
|
public boolean isStatsVisible() {
|
|
|
|
return isStatsVisible;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setStatsVisible(boolean b) {
|
|
|
|
isStatsVisible = b;
|
|
|
|
}
|
2016-03-18 05:13:43 -07:00
|
|
|
|
|
|
|
public boolean getImagesOnDemand() {
|
|
|
|
return imagesOnDemand;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setImagesOnDemand(boolean b) {
|
|
|
|
imagesOnDemand = b;
|
|
|
|
}
|
2016-03-29 13:22:49 -07:00
|
|
|
|
|
|
|
public Rectangle getSizableFrameBounds() {
|
|
|
|
return new Rectangle(frameLeft, frameTop, frameWidth, frameHeight);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSizableFrameBounds(Rectangle aRect) {
|
|
|
|
frameLeft = aRect.x;
|
|
|
|
frameTop = aRect.y;
|
|
|
|
frameWidth = aRect.width;
|
|
|
|
frameHeight = aRect.height;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSizableFrameBounds(Point aPoint, Dimension aSize) {
|
|
|
|
frameLeft = aPoint.x;
|
|
|
|
frameTop = aPoint.y;
|
|
|
|
frameWidth = aSize.width;
|
|
|
|
frameHeight = aSize.height;
|
|
|
|
}
|
2016-06-17 19:12:34 -07:00
|
|
|
|
2016-10-27 13:04:16 -07:00
|
|
|
public void setCustomScrollBar(boolean b) {
|
|
|
|
isCustomScrollBar = b;
|
|
|
|
}
|
|
|
|
|
2016-10-06 03:50:13 -07:00
|
|
|
public boolean isCustomScrollBar() {
|
|
|
|
return isCustomScrollBar;
|
|
|
|
}
|
|
|
|
|
2016-10-14 11:50:32 -07:00
|
|
|
public void setKeywordsSettings(String text) {
|
|
|
|
keywordsScreen = text;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getKeywordsSettings() {
|
|
|
|
return keywordsScreen;
|
|
|
|
}
|
|
|
|
|
2016-10-31 12:53:44 -07:00
|
|
|
public void set(String name, int value) {
|
|
|
|
settings.setProperty(name, Integer.toString(value));
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getInt(String name, int value) {
|
|
|
|
return Integer.parseInt(settings.getProperty(name, Integer.toString(value)));
|
|
|
|
}
|
|
|
|
|
2017-01-21 00:33:35 -08:00
|
|
|
public CardImageDisplayMode getCardImageDisplayMode() {
|
|
|
|
return cardDisplayMode;
|
2017-01-10 09:50:52 -08:00
|
|
|
}
|
|
|
|
|
2017-01-21 00:33:35 -08:00
|
|
|
public void setCardImageDisplayMode(CardImageDisplayMode newMode) {
|
|
|
|
cardDisplayMode = newMode;
|
2017-01-10 09:50:52 -08:00
|
|
|
}
|
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
}
|