mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
ForgePreferences fully converted to enum architecture. All preference-style files are now standardized using enums.
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -10801,7 +10801,6 @@ res/quest/price.txt svneol=native#text/plain
|
|||||||
res/quest/quest-opponent-icons.txt -text
|
res/quest/quest-opponent-icons.txt -text
|
||||||
res/quest/quest-pet-shop-icons.txt -text
|
res/quest/quest-pet-shop-icons.txt -text
|
||||||
res/quest/quest-pet-token-images.txt -text
|
res/quest/quest-pet-token-images.txt -text
|
||||||
res/quest/quest.preferences -text
|
|
||||||
res/quest/quest.properties svneol=native#text/plain
|
res/quest/quest.properties svneol=native#text/plain
|
||||||
res/quest/themes/-1[!!-~]-1[!!-~]Counters[!!-~]BG.thm -text
|
res/quest/themes/-1[!!-~]-1[!!-~]Counters[!!-~]BG.thm -text
|
||||||
res/quest/themes/Anti[!!-~]Black[!!-~]WB.thm -text
|
res/quest/themes/Anti[!!-~]Black[!!-~]WB.thm -text
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
BOOSTER_COMMONS=11
|
|
||||||
BOOSTER_UNCOMMONS=3
|
|
||||||
BOOSTER_RARES=1
|
|
||||||
REWARDS_BASE=30
|
|
||||||
REWARDS_UNDEFEATED=25
|
|
||||||
REWARDS_WINS_MULTIPLIER=0.3
|
|
||||||
REWARDS_POISON=50
|
|
||||||
REWARDS_MILLED=40
|
|
||||||
REWARDS_MULLIGAN0=500
|
|
||||||
REWARDS_ALTERNATIVE=100
|
|
||||||
REWARDS_TURN15=5
|
|
||||||
REWARDS_TURN10=50
|
|
||||||
REWARDS_TURN5=250
|
|
||||||
REWARDS_TURN1=1500
|
|
||||||
STARTING_BASIC_LANDS=20
|
|
||||||
STARTING_SNOW_LANDS=5
|
|
||||||
|
|
||||||
STARTING_COMMONS_EASY=82
|
|
||||||
STARTING_COMMONS_MEDIUM=80
|
|
||||||
STARTING_COMMONS_HARD=78
|
|
||||||
STARTING_COMMONS_EXPERT=76
|
|
||||||
|
|
||||||
STARTING_UNCOMMONS_EASY=40
|
|
||||||
STARTING_UNCOMMONS_MEDIUM=36
|
|
||||||
STARTING_UNCOMMONS_HARD=32
|
|
||||||
STARTING_UNCOMMONS_EXPERT=28
|
|
||||||
|
|
||||||
STARTING_RARES_EASY=20
|
|
||||||
STARTING_RARES_MEDIUM=18
|
|
||||||
STARTING_RARES_HARD=16
|
|
||||||
STARTING_RARES_EXPERT=15
|
|
||||||
|
|
||||||
STARTING_CREDITS_EASY=250
|
|
||||||
STARTING_CREDITS_MEDIUM=200
|
|
||||||
STARTING_CREDITS_HARD=150
|
|
||||||
STARTING_CREDITS_EXPERT=100
|
|
||||||
|
|
||||||
WINS_BOOSTER_EASY=1
|
|
||||||
WINS_BOOSTER_MEDIUM=1
|
|
||||||
WINS_BOOSTER_HARD=2
|
|
||||||
WINS_BOOSTER_EXPERT=2
|
|
||||||
|
|
||||||
WINS_RANKUP_EASY=3
|
|
||||||
WINS_RANKUP_MEDIUM=4
|
|
||||||
WINS_RANKUP_HARD=5
|
|
||||||
WINS_RANKUP_EXPERT=6
|
|
||||||
|
|
||||||
WINS_MEDIUMAI_EASY=10
|
|
||||||
WINS_MEDIUMAI_MEDIUM=9
|
|
||||||
WINS_MEDIUMAI_HARD=8
|
|
||||||
WINS_MEDIUMAI_EXPERT=7
|
|
||||||
|
|
||||||
WINS_HARDAI_EASY=20
|
|
||||||
WINS_HARDAI_MEDIUM=18
|
|
||||||
WINS_HARDAI_HARD=16
|
|
||||||
WINS_HARDAI_EXPERT=14
|
|
||||||
|
|
||||||
WINS_EXPERTAI_EASY=40
|
|
||||||
WINS_EXPERTAI_MEDIUM=36
|
|
||||||
WINS_EXPERTAI_HARD=32
|
|
||||||
WINS_EXPERTAI_EXPERT=28
|
|
||||||
@@ -45,6 +45,7 @@ import forge.CardContainer;
|
|||||||
import forge.Counters;
|
import forge.Counters;
|
||||||
import forge.ImageCache;
|
import forge.ImageCache;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.view.toolbox.CardFaceSymbols;
|
import forge.view.toolbox.CardFaceSymbols;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -585,7 +586,7 @@ public class CardPanel extends JPanel implements CardContainer {
|
|||||||
* a {@link forge.Card} object.
|
* a {@link forge.Card} object.
|
||||||
*/
|
*/
|
||||||
public final void setText(final Card card) {
|
public final void setText(final Card card) {
|
||||||
if ((card == null) || !Singletons.getModel().getPreferences().isCardOverlay()) {
|
if ((card == null) || !Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_CARD_OVERLAY)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -635,7 +636,7 @@ public class CardPanel extends JPanel implements CardContainer {
|
|||||||
final Insets i = this.getInsets();
|
final Insets i = this.getInsets();
|
||||||
final Image image = card == null ? null : ImageCache.getImage(card, this.getWidth() - i.left - i.right,
|
final Image image = card == null ? null : ImageCache.getImage(card, this.getWidth() - i.left - i.right,
|
||||||
this.getHeight() - i.top - i.bottom);
|
this.getHeight() - i.top - i.bottom);
|
||||||
if ((this.getGameCard() != null) && Singletons.getModel().getPreferences().isCardOverlay()) {
|
if ((this.getGameCard() != null) && Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_CARD_OVERLAY)) {
|
||||||
this.setText(this.getGameCard());
|
this.setText(this.getGameCard());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ import forge.gui.input.InputPayManaCost;
|
|||||||
import forge.gui.input.InputPayManaCostAbility;
|
import forge.gui.input.InputPayManaCostAbility;
|
||||||
import forge.gui.input.InputPayManaCostUtil;
|
import forge.gui.input.InputPayManaCostUtil;
|
||||||
import forge.item.CardPrinted;
|
import forge.item.CardPrinted;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
import forge.properties.NewConstants.Lang.GameAction.GameActionText;
|
import forge.properties.NewConstants.Lang.GameAction.GameActionText;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
@@ -873,7 +874,6 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.canShowWinLose && this.checkEndGameState()) {
|
if (this.canShowWinLose && this.checkEndGameState()) {
|
||||||
AllZone.getDisplay().savePrefs();
|
|
||||||
new ViewWinLose();
|
new ViewWinLose();
|
||||||
this.canShowWinLose = false;
|
this.canShowWinLose = false;
|
||||||
return;
|
return;
|
||||||
@@ -1437,7 +1437,7 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (card.hasKeyword("Remove CARDNAME from your deck before playing if you're not playing for ante.")
|
if (card.hasKeyword("Remove CARDNAME from your deck before playing if you're not playing for ante.")
|
||||||
&& !Singletons.getModel().getPreferences().isPlayForAnte()) {
|
&& !Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE)) {
|
||||||
hAnteRemoved.add(card.getName());
|
hAnteRemoved.add(card.getName());
|
||||||
} else {
|
} else {
|
||||||
AllZone.getHumanPlayer().getZone(Zone.Library).add(card);
|
AllZone.getHumanPlayer().getZone(Zone.Library).add(card);
|
||||||
@@ -1479,7 +1479,7 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (card.hasKeyword("Remove CARDNAME from your deck before playing if you're not playing for ante.")
|
if (card.hasKeyword("Remove CARDNAME from your deck before playing if you're not playing for ante.")
|
||||||
&& !Singletons.getModel().getPreferences().isPlayForAnte()) {
|
&& !Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE)) {
|
||||||
cAnteRemoved.add(card.getName());
|
cAnteRemoved.add(card.getName());
|
||||||
} else {
|
} else {
|
||||||
AllZone.getComputerPlayer().getZone(Zone.Library).add(card);
|
AllZone.getComputerPlayer().getZone(Zone.Library).add(card);
|
||||||
@@ -1583,7 +1583,7 @@ public class GameAction {
|
|||||||
this.computerStartsGame();
|
this.computerStartsGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Singletons.getModel().getPreferences().isPlayForAnte()) {
|
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE)) {
|
||||||
final String nl = System.getProperty("line.separator");
|
final String nl = System.getProperty("line.separator");
|
||||||
final StringBuilder msg = new StringBuilder();
|
final StringBuilder msg = new StringBuilder();
|
||||||
for (final Player p : AllZone.getPlayersInGame()) {
|
for (final Player p : AllZone.getPlayersInGame()) {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import com.google.common.util.concurrent.UncheckedExecutionException;
|
|||||||
import com.mortennobel.imagescaling.ResampleOp;
|
import com.mortennobel.imagescaling.ResampleOp;
|
||||||
|
|
||||||
import forge.item.InventoryItem;
|
import forge.item.InventoryItem;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
import forge.properties.NewConstants;
|
import forge.properties.NewConstants;
|
||||||
|
|
||||||
@@ -176,7 +177,7 @@ public class ImageCache {
|
|||||||
double scale = Math.min((double) width / original.getWidth(), (double) height / original.getHeight());
|
double scale = Math.min((double) width / original.getWidth(), (double) height / original.getHeight());
|
||||||
// here would be the place to limit the scaling, scaling option in menu
|
// here would be the place to limit the scaling, scaling option in menu
|
||||||
// ?
|
// ?
|
||||||
if ((scale > 1) && !Singletons.getModel().getPreferences().isScaleLargerThanOriginal()) {
|
if ((scale > 1) && !Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_SCALE_LARGER)) {
|
||||||
scale = 1;
|
scale = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +204,7 @@ public class ImageCache {
|
|||||||
|
|
||||||
double scale = Math.min((double) width / original.getWidth(), (double) height / original.getHeight());
|
double scale = Math.min((double) width / original.getWidth(), (double) height / original.getHeight());
|
||||||
// here would be the place to limit the scaling option in menu ?
|
// here would be the place to limit the scaling option in menu ?
|
||||||
if ((scale > 1) && !Singletons.getModel().getPreferences().isScaleLargerThanOriginal()) {
|
if ((scale > 1) && !Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_SCALE_LARGER)) {
|
||||||
scale = 1;
|
scale = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import javax.swing.KeyStroke;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.view.GuiTopLevel;
|
import forge.view.GuiTopLevel;
|
||||||
import forge.view.home.ViewSettings.KeyboardShortcutField;
|
import forge.view.home.ViewSettings.KeyboardShortcutField;
|
||||||
|
|
||||||
@@ -100,12 +101,12 @@ public class KeyboardShortcuts {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//========== Instantiate shortcut objects and add to list.
|
//========== Instantiate shortcut objects and add to list.
|
||||||
list.add(new Shortcut("shortcut.showstack", "Match: show stack panel", actShowStack, am, im));
|
list.add(new Shortcut(FPref.SHORTCUT_SHOWSTACK, "Match: show stack panel", actShowStack, am, im));
|
||||||
list.add(new Shortcut("shortcut.showcombat", "Match: show combat panel", actShowCombat, am, im));
|
list.add(new Shortcut(FPref.SHORTCUT_SHOWCOMBAT, "Match: show combat panel", actShowCombat, am, im));
|
||||||
list.add(new Shortcut("shortcut.showconsole", "Match: show console panel", actShowConsole, am, im));
|
list.add(new Shortcut(FPref.SHORTCUT_SHOWCONSOLE, "Match: show console panel", actShowConsole, am, im));
|
||||||
list.add(new Shortcut("shortcut.showplayers", "Match: show players panel", actShowPlayers, am, im));
|
list.add(new Shortcut(FPref.SHORTCUT_SHOWPLAYERS, "Match: show players panel", actShowPlayers, am, im));
|
||||||
list.add(new Shortcut("shortcut.showdev", "Match: show dev panel", actShowDev, am, im));
|
list.add(new Shortcut(FPref.SHORTCUT_SHOWDEV, "Match: show dev panel", actShowDev, am, im));
|
||||||
list.add(new Shortcut("shortcut.concede", "Match: concede game", actConcede, am, im));
|
list.add(new Shortcut(FPref.SHORTCUT_CONCEDE, "Match: concede game", actConcede, am, im));
|
||||||
return list;
|
return list;
|
||||||
} // End initMatchShortcuts()
|
} // End initMatchShortcuts()
|
||||||
|
|
||||||
@@ -158,7 +159,7 @@ public class KeyboardShortcuts {
|
|||||||
*/
|
*/
|
||||||
public static class Shortcut {
|
public static class Shortcut {
|
||||||
/** */
|
/** */
|
||||||
private String prefkey;
|
private FPref prefkey;
|
||||||
/** */
|
/** */
|
||||||
private String description;
|
private String description;
|
||||||
/** */
|
/** */
|
||||||
@@ -183,7 +184,7 @@ public class KeyboardShortcuts {
|
|||||||
* @param am0 ActionMap, of container targeted by shortcut
|
* @param am0 ActionMap, of container targeted by shortcut
|
||||||
* @param im0 InputMap, of container targeted by shortcut
|
* @param im0 InputMap, of container targeted by shortcut
|
||||||
*/
|
*/
|
||||||
public Shortcut(final String prefkey0, final String description0,
|
public Shortcut(final FPref prefkey0, final String description0,
|
||||||
final Action handler0, final ActionMap am0, final InputMap im0) {
|
final Action handler0, final ActionMap am0, final InputMap im0) {
|
||||||
|
|
||||||
prefkey = prefkey0;
|
prefkey = prefkey0;
|
||||||
@@ -203,14 +204,14 @@ public class KeyboardShortcuts {
|
|||||||
* String ident key in forge.preferences.
|
* String ident key in forge.preferences.
|
||||||
* @return {@link java.lang.String}
|
* @return {@link java.lang.String}
|
||||||
*/
|
*/
|
||||||
public String getPrefKey() {
|
public FPref getPrefKey() {
|
||||||
return prefkey;
|
return prefkey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
public void attach() {
|
public void attach() {
|
||||||
detach();
|
detach();
|
||||||
str = Singletons.getModel().getPreferences().getKeyboardShortcut(prefkey);
|
str = Singletons.getModel().getPreferences().getPref(prefkey);
|
||||||
key = KeyStroke.getKeyStroke(KeyboardShortcuts.codes2Chars(str));
|
key = KeyStroke.getKeyStroke(KeyboardShortcuts.codes2Chars(str));
|
||||||
inputMap.put(key, str);
|
inputMap.put(key, str);
|
||||||
actionMap.put(str, handler);
|
actionMap.put(str, handler);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import forge.Constant;
|
|||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.properties.ForgePreferences;
|
import forge.properties.ForgePreferences;
|
||||||
import forge.properties.ForgePreferences.CardSizeType;
|
import forge.properties.ForgePreferences.CardSizeType;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.view.GuiTopLevel;
|
import forge.view.GuiTopLevel;
|
||||||
import forge.view.home.ViewSettings;
|
import forge.view.home.ViewSettings;
|
||||||
import forge.view.toolbox.FSkin;
|
import forge.view.toolbox.FSkin;
|
||||||
@@ -56,7 +57,7 @@ public class ControlSettings {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
final boolean toggle = ControlSettings.this.view.getCbAnte().isSelected();
|
final boolean toggle = ControlSettings.this.view.getCbAnte().isSelected();
|
||||||
prefs.setPlayForAnte(toggle);
|
prefs.setPref(FPref.UI_ANTE, String.valueOf(toggle));
|
||||||
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -65,7 +66,7 @@ public class ControlSettings {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
final boolean toggle = ControlSettings.this.view.getCbScaleLarger().isSelected();
|
final boolean toggle = ControlSettings.this.view.getCbScaleLarger().isSelected();
|
||||||
prefs.setScaleLargerThanOriginal(toggle);
|
prefs.setPref(FPref.UI_SCALE_LARGER, String.valueOf(toggle));
|
||||||
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -74,7 +75,7 @@ public class ControlSettings {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
final boolean toggle = ControlSettings.this.view.getCbDevMode().isSelected();
|
final boolean toggle = ControlSettings.this.view.getCbDevMode().isSelected();
|
||||||
prefs.setDeveloperMode(toggle);
|
prefs.setPref(FPref.DEV_MODE_ENABLED, String.valueOf(toggle));
|
||||||
Constant.Runtime.DEV_MODE[0] = toggle;
|
Constant.Runtime.DEV_MODE[0] = toggle;
|
||||||
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
||||||
}
|
}
|
||||||
@@ -84,7 +85,7 @@ public class ControlSettings {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
final boolean toggle = ControlSettings.this.view.getCbRemoveSmall().isSelected();
|
final boolean toggle = ControlSettings.this.view.getCbRemoveSmall().isSelected();
|
||||||
prefs.setDeckGenRmvSmall(toggle);
|
prefs.setPref(FPref.DECKGEN_NOSMALL, String.valueOf(toggle));
|
||||||
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -93,7 +94,7 @@ public class ControlSettings {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
final boolean toggle = ControlSettings.this.view.getCbRemoveArtifacts().isSelected();
|
final boolean toggle = ControlSettings.this.view.getCbRemoveArtifacts().isSelected();
|
||||||
prefs.setDeckGenRmvArtifacts(toggle);
|
prefs.setPref(FPref.DECKGEN_ARTIFACTS, String.valueOf(toggle));
|
||||||
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -102,7 +103,7 @@ public class ControlSettings {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
final boolean toggle = ControlSettings.this.view.getCbSingletons().isSelected();
|
final boolean toggle = ControlSettings.this.view.getCbSingletons().isSelected();
|
||||||
prefs.setDeckGenSingletons(toggle);
|
prefs.setPref(FPref.DECKGEN_SINGLETONS, String.valueOf(toggle));
|
||||||
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -111,7 +112,7 @@ public class ControlSettings {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
final boolean toggle = ControlSettings.this.view.getCbUploadDraft().isSelected();
|
final boolean toggle = ControlSettings.this.view.getCbUploadDraft().isSelected();
|
||||||
prefs.setUploadDraftAI(toggle);
|
prefs.setPref(FPref.UI_UPLOAD_DRAFT , String.valueOf(toggle));
|
||||||
Constant.Runtime.UPLOAD_DRAFT[0] = toggle;
|
Constant.Runtime.UPLOAD_DRAFT[0] = toggle;
|
||||||
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
||||||
}
|
}
|
||||||
@@ -121,7 +122,7 @@ public class ControlSettings {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
final boolean toggle = ControlSettings.this.view.getCbStackLand().isSelected();
|
final boolean toggle = ControlSettings.this.view.getCbStackLand().isSelected();
|
||||||
prefs.setStackAiLand(toggle);
|
prefs.setPref(FPref.UI_SMOOTH_LAND, String.valueOf(toggle));
|
||||||
Constant.Runtime.SMOOTH[0] = toggle;
|
Constant.Runtime.SMOOTH[0] = toggle;
|
||||||
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
||||||
}
|
}
|
||||||
@@ -131,7 +132,7 @@ public class ControlSettings {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
final boolean toggle = ControlSettings.this.view.getCbRandomFoil().isSelected();
|
final boolean toggle = ControlSettings.this.view.getCbRandomFoil().isSelected();
|
||||||
prefs.setRandCFoil(toggle);
|
prefs.setPref(FPref.UI_RANDOM_FOIL, String.valueOf(toggle));
|
||||||
Constant.Runtime.RANDOM_FOIL[0] = toggle;
|
Constant.Runtime.RANDOM_FOIL[0] = toggle;
|
||||||
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
||||||
}
|
}
|
||||||
@@ -141,7 +142,7 @@ public class ControlSettings {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
final boolean toggle = ControlSettings.this.view.getCbTextMana().isSelected();
|
final boolean toggle = ControlSettings.this.view.getCbTextMana().isSelected();
|
||||||
prefs.setCardOverlay(toggle);
|
prefs.setPref(FPref.UI_CARD_OVERLAY, String.valueOf(toggle));
|
||||||
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -153,7 +154,7 @@ public class ControlSettings {
|
|||||||
|
|
||||||
skin.loadFontsAndImages();
|
skin.loadFontsAndImages();
|
||||||
|
|
||||||
prefs.setSkin(name);
|
prefs.setPref(FPref.UI_SKIN, name);
|
||||||
Singletons.getView().setSkin(skin);
|
Singletons.getView().setSkin(skin);
|
||||||
((GuiTopLevel) AllZone.getDisplay()).getController().changeState(0);
|
((GuiTopLevel) AllZone.getDisplay()).getController().changeState(0);
|
||||||
|
|
||||||
@@ -167,7 +168,7 @@ public class ControlSettings {
|
|||||||
* @throws Exception */
|
* @throws Exception */
|
||||||
public void updateCardSize(JRadioButton rad0) throws Exception {
|
public void updateCardSize(JRadioButton rad0) throws Exception {
|
||||||
CardSizeType cst = CardSizeType.valueOf(rad0.getText().toLowerCase());
|
CardSizeType cst = CardSizeType.valueOf(rad0.getText().toLowerCase());
|
||||||
Singletons.getModel().getPreferences().setCardSize(cst);
|
Singletons.getModel().getPreferences().setPref(FPref.UI_CARD_SIZE, cst.toString());
|
||||||
prefs.save();
|
prefs.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import forge.AllZone;
|
|||||||
import forge.GuiDisplayUtil;
|
import forge.GuiDisplayUtil;
|
||||||
import forge.MyObservable;
|
import forge.MyObservable;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.view.match.ViewTabber;
|
import forge.view.match.ViewTabber;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,13 +62,13 @@ public class ControlTabber extends MyObservable {
|
|||||||
public ControlTabber(final ViewTabber v) {
|
public ControlTabber(final ViewTabber v) {
|
||||||
this.view = v;
|
this.view = v;
|
||||||
|
|
||||||
if (Singletons.getModel().getPreferences().isMillingLossCondition()) {
|
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.DEV_MILLING_LOSS)) {
|
||||||
this.view.getLblMilling().setEnabled(true);
|
this.view.getLblMilling().setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
this.view.getLblMilling().setEnabled(false);
|
this.view.getLblMilling().setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Singletons.getModel().getPreferences().isUnlimitedLand()) {
|
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.DEV_UNLIMITED_LAND)) {
|
||||||
this.view.getLblUnlimitedLands().setEnabled(true);
|
this.view.getLblUnlimitedLands().setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
this.view.getLblUnlimitedLands().setEnabled(false);
|
this.view.getLblUnlimitedLands().setEnabled(false);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import forge.game.GameType;
|
|||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiUtils;
|
||||||
import forge.item.CardDb;
|
import forge.item.CardDb;
|
||||||
import forge.item.CardPrinted;
|
import forge.item.CardPrinted;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.view.GuiTopLevel;
|
import forge.view.GuiTopLevel;
|
||||||
import forge.view.match.ViewWinLose;
|
import forge.view.match.ViewWinLose;
|
||||||
|
|
||||||
@@ -84,7 +85,7 @@ public class ControlWinLose {
|
|||||||
* with other game modes.
|
* with other game modes.
|
||||||
*/
|
*/
|
||||||
public void startNextRound() {
|
public void startNextRound() {
|
||||||
boolean isAnte = Singletons.getModel().getPreferences().isPlayForAnte();
|
boolean isAnte = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE);
|
||||||
GameType gameType = Constant.Runtime.getGameType();
|
GameType gameType = Constant.Runtime.getGameType();
|
||||||
|
|
||||||
//This is called from QuestWinLoseHandler also. If we're in a quest, this is already handled elsewhere
|
//This is called from QuestWinLoseHandler also. If we're in a quest, this is already handled elsewhere
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import forge.Constant;
|
|||||||
import forge.PlayerType;
|
import forge.PlayerType;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.error.ErrorViewer;
|
import forge.error.ErrorViewer;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
@@ -81,7 +82,7 @@ public class Generate2ColorDeck {
|
|||||||
this.notColors.add("red");
|
this.notColors.add("red");
|
||||||
this.notColors.add("green");
|
this.notColors.add("green");
|
||||||
|
|
||||||
if (Singletons.getModel().getPreferences().isDeckGenSingletons()) {
|
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_SINGLETONS)) {
|
||||||
this.maxDuplicates = 1;
|
this.maxDuplicates = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +146,7 @@ public class Generate2ColorDeck {
|
|||||||
|
|
||||||
// reduce to cards that match the colors
|
// reduce to cards that match the colors
|
||||||
CardList cl1 = allCards.getColor(this.color1);
|
CardList cl1 = allCards.getColor(this.color1);
|
||||||
if (!Singletons.getModel().getPreferences().isDeckGenRmvArtifacts()) {
|
if (!Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_ARTIFACTS)) {
|
||||||
cl1.addAll(allCards.getColor(Constant.Color.COLORLESS));
|
cl1.addAll(allCards.getColor(Constant.Color.COLORLESS));
|
||||||
}
|
}
|
||||||
CardList cl2 = allCards.getColor(this.color2);
|
CardList cl2 = allCards.getColor(this.color2);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import forge.Constant;
|
|||||||
import forge.PlayerType;
|
import forge.PlayerType;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.error.ErrorViewer;
|
import forge.error.ErrorViewer;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
@@ -84,7 +85,7 @@ public class Generate3ColorDeck {
|
|||||||
this.notColors.add("red");
|
this.notColors.add("red");
|
||||||
this.notColors.add("green");
|
this.notColors.add("green");
|
||||||
|
|
||||||
if (Singletons.getModel().getPreferences().isDeckGenSingletons()) {
|
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_SINGLETONS)) {
|
||||||
this.maxDuplicates = 1;
|
this.maxDuplicates = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +158,7 @@ public class Generate3ColorDeck {
|
|||||||
|
|
||||||
// reduce to cards that match the colors
|
// reduce to cards that match the colors
|
||||||
CardList cl1 = allCards.getColor(this.color1);
|
CardList cl1 = allCards.getColor(this.color1);
|
||||||
if (!Singletons.getModel().getPreferences().isDeckGenRmvArtifacts()) {
|
if (!Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_ARTIFACTS)) {
|
||||||
cl1.addAll(allCards.getColor(Constant.Color.COLORLESS));
|
cl1.addAll(allCards.getColor(Constant.Color.COLORLESS));
|
||||||
}
|
}
|
||||||
CardList cl2 = allCards.getColor(this.color2);
|
CardList cl2 = allCards.getColor(this.color2);
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import forge.PlayerType;
|
|||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.error.ErrorViewer;
|
import forge.error.ErrorViewer;
|
||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -110,7 +111,7 @@ public class Generate5ColorDeck {
|
|||||||
this.notColors.remove(this.color4);
|
this.notColors.remove(this.color4);
|
||||||
this.notColors.remove(this.color5);
|
this.notColors.remove(this.color5);
|
||||||
|
|
||||||
if (Singletons.getModel().getPreferences().isDeckGenSingletons()) {
|
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_SINGLETONS)) {
|
||||||
this.maxDuplicates = 1;
|
this.maxDuplicates = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +156,7 @@ public class Generate5ColorDeck {
|
|||||||
|
|
||||||
// reduce to cards that match the colors
|
// reduce to cards that match the colors
|
||||||
CardList cL1 = allCards.getColor(this.color1);
|
CardList cL1 = allCards.getColor(this.color1);
|
||||||
if (!Singletons.getModel().getPreferences().isDeckGenRmvArtifacts()) {
|
if (!Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_ARTIFACTS)) {
|
||||||
cL1.addAll(allCards.getColor(Constant.Color.COLORLESS));
|
cL1.addAll(allCards.getColor(Constant.Color.COLORLESS));
|
||||||
}
|
}
|
||||||
CardList cL2 = allCards.getColor(this.color2);
|
CardList cL2 = allCards.getColor(this.color2);
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import forge.CardListUtil;
|
|||||||
import forge.CardUtil;
|
import forge.CardUtil;
|
||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -182,7 +183,7 @@ public class GenerateConstructedDeck {
|
|||||||
// is this really a colorless artifact and not something
|
// is this really a colorless artifact and not something
|
||||||
// weird like Sarcomite Myr which is a colored artifact
|
// weird like Sarcomite Myr which is a colored artifact
|
||||||
return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.COLORLESS)
|
return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.COLORLESS)
|
||||||
&& !Singletons.getModel().getPreferences().isDeckGenRmvArtifacts();
|
&& !Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_ARTIFACTS);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
out.addAll(artifact);
|
out.addAll(artifact);
|
||||||
@@ -191,7 +192,7 @@ public class GenerateConstructedDeck {
|
|||||||
@Override
|
@Override
|
||||||
public boolean addCard(final Card c) {
|
public boolean addCard(final Card c) {
|
||||||
if (c.isCreature() && (c.getNetAttack() <= 1)
|
if (c.isCreature() && (c.getNetAttack() <= 1)
|
||||||
&& Singletons.getModel().getPreferences().isDeckGenRmvSmall()) {
|
&& Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_NOSMALL)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import forge.CardListUtil;
|
|||||||
import forge.CardUtil;
|
import forge.CardUtil;
|
||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -381,7 +382,7 @@ public class GenerateConstructedMultiColorDeck {
|
|||||||
// is this really a colorless artifact and not something
|
// is this really a colorless artifact and not something
|
||||||
// wierd like Sarcomite Myr which is a colored artifact
|
// wierd like Sarcomite Myr which is a colored artifact
|
||||||
return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.COLORLESS)
|
return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.COLORLESS)
|
||||||
&& !Singletons.getModel().getPreferences().isDeckGenRmvArtifacts();
|
&& !Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_ARTIFACTS);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
out.addAll(artifact);
|
out.addAll(artifact);
|
||||||
@@ -390,7 +391,7 @@ public class GenerateConstructedMultiColorDeck {
|
|||||||
@Override
|
@Override
|
||||||
public boolean addCard(final Card c) {
|
public boolean addCard(final Card c) {
|
||||||
if (c.isCreature() && (c.getNetAttack() <= 1)
|
if (c.isCreature() && (c.getNetAttack() <= 1)
|
||||||
&& Singletons.getModel().getPreferences().isDeckGenRmvSmall()) {
|
&& Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_NOSMALL)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,7 +437,7 @@ public class GenerateConstructedMultiColorDeck {
|
|||||||
// is this really a colorless artifact and not something
|
// is this really a colorless artifact and not something
|
||||||
// wierd like Sarcomite Myr which is a colored artifact
|
// wierd like Sarcomite Myr which is a colored artifact
|
||||||
return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.COLORLESS)
|
return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.COLORLESS)
|
||||||
&& !Singletons.getModel().getPreferences().isDeckGenRmvArtifacts();
|
&& !Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_ARTIFACTS);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
out.addAll(artifact);
|
out.addAll(artifact);
|
||||||
@@ -445,7 +446,7 @@ public class GenerateConstructedMultiColorDeck {
|
|||||||
@Override
|
@Override
|
||||||
public boolean addCard(final Card c) {
|
public boolean addCard(final Card c) {
|
||||||
if (c.isCreature() && (c.getNetAttack() <= 1)
|
if (c.isCreature() && (c.getNetAttack() <= 1)
|
||||||
&& Singletons.getModel().getPreferences().isDeckGenRmvSmall()) {
|
&& Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_NOSMALL)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ import org.mantisbt.connect.ui.DefaultSubmitter;
|
|||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.model.BuildInfo;
|
import forge.model.BuildInfo;
|
||||||
import forge.properties.ForgePreferences;
|
import forge.properties.ForgePreferences;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
import forge.properties.NewConstants;
|
import forge.properties.NewConstants;
|
||||||
|
|
||||||
@@ -188,10 +189,10 @@ public class BugzReporter extends JDialog {
|
|||||||
this.contentPanel.add(this.txtUserName);
|
this.contentPanel.add(this.txtUserName);
|
||||||
this.txtUserName.setColumns(4);
|
this.txtUserName.setColumns(4);
|
||||||
try {
|
try {
|
||||||
this.prefs = new ForgePreferences("forge.preferences");
|
this.prefs = new ForgePreferences();
|
||||||
if (!this.prefs.getBugzName().equals("")) {
|
if (!this.prefs.getPref(FPref.UI_BUGZ_NAME).equals("")) {
|
||||||
this.txtUserName.setText(this.prefs.getBugzName());
|
this.txtUserName.setText(this.prefs.getPref(FPref.UI_BUGZ_NAME));
|
||||||
this.txtPassword.setText(this.prefs.getBugzPwd());
|
this.txtPassword.setText(this.prefs.getPref(FPref.UI_BUGZ_PWD));
|
||||||
this.chkReportAnonymously.setSelected(false);
|
this.chkReportAnonymously.setSelected(false);
|
||||||
} else {
|
} else {
|
||||||
this.chkReportAnonymously.setSelected(true);
|
this.chkReportAnonymously.setSelected(true);
|
||||||
@@ -209,9 +210,9 @@ public class BugzReporter extends JDialog {
|
|||||||
BugzReporter.this.txtUserName.setText("ForgeGUI");
|
BugzReporter.this.txtUserName.setText("ForgeGUI");
|
||||||
BugzReporter.this.txtPassword.setText("vi2ccTbfBUu^");
|
BugzReporter.this.txtPassword.setText("vi2ccTbfBUu^");
|
||||||
} else {
|
} else {
|
||||||
if (!BugzReporter.this.prefs.getBugzName().equals("")) {
|
if (!BugzReporter.this.prefs.getPref(FPref.UI_BUGZ_NAME).equals("")) {
|
||||||
BugzReporter.this.txtUserName.setText(BugzReporter.this.prefs.getBugzName());
|
BugzReporter.this.txtUserName.setText(BugzReporter.this.prefs.getPref(FPref.UI_BUGZ_NAME));
|
||||||
BugzReporter.this.txtPassword.setText(BugzReporter.this.prefs.getBugzPwd());
|
BugzReporter.this.txtPassword.setText(BugzReporter.this.prefs.getPref(FPref.UI_BUGZ_PWD));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -458,8 +459,8 @@ public class BugzReporter extends JDialog {
|
|||||||
break Report;
|
break Report;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.prefs.setBugzName(this.txtUserName.getText());
|
this.prefs.setPref(FPref.UI_BUGZ_NAME, this.txtUserName.getText());
|
||||||
this.prefs.setBugzPwd(String.valueOf(this.txtPassword.getPassword()));
|
this.prefs.setPref(FPref.UI_BUGZ_PWD, String.valueOf(this.txtPassword.getPassword()));
|
||||||
try {
|
try {
|
||||||
this.prefs.save();
|
this.prefs.save();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import forge.gui.input.InputControl;
|
|||||||
import forge.properties.ForgePreferences;
|
import forge.properties.ForgePreferences;
|
||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
import forge.properties.NewConstants;
|
import forge.properties.NewConstants;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.quest.data.QuestPreferences;
|
import forge.quest.data.QuestPreferences;
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
import forge.util.HttpUtil;
|
import forge.util.HttpUtil;
|
||||||
@@ -86,7 +87,7 @@ public class FModel {
|
|||||||
|
|
||||||
// Instantiate preferences
|
// Instantiate preferences
|
||||||
try {
|
try {
|
||||||
this.preferences = new ForgePreferences("forge.preferences");
|
this.preferences = new ForgePreferences();
|
||||||
} catch (final Exception exn) {
|
} catch (final Exception exn) {
|
||||||
throw new RuntimeException(exn);
|
throw new RuntimeException(exn);
|
||||||
}
|
}
|
||||||
@@ -99,7 +100,7 @@ public class FModel {
|
|||||||
// Unfortunately, they're tied up in legacy code in the Display interface,
|
// Unfortunately, they're tied up in legacy code in the Display interface,
|
||||||
// currently in GuiTopLevel. When that code is updated, this TODO should be resolved.
|
// currently in GuiTopLevel. When that code is updated, this TODO should be resolved.
|
||||||
// Doublestrike 24-01-12
|
// Doublestrike 24-01-12
|
||||||
Constant.Runtime.DEV_MODE[0] = preferences.isDeveloperMode();
|
Constant.Runtime.DEV_MODE[0] = preferences.getPrefBoolean(FPref.DEV_MODE_ENABLED);
|
||||||
|
|
||||||
// Instantiate AI
|
// Instantiate AI
|
||||||
AllZone.setInputControl(new InputControl(FModel.this));
|
AllZone.setInputControl(new InputControl(FModel.this));
|
||||||
|
|||||||
@@ -19,14 +19,12 @@ package forge.properties;
|
|||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeSet;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -40,117 +38,118 @@ import java.util.TreeSet;
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class ForgePreferences {
|
public class ForgePreferences {
|
||||||
private String fileName = "forge.preferences";
|
private Map<FPref, String> preferenceValues;
|
||||||
private Map<String, String> prefs;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes default values for preferences and sets a file address.
|
* Preference identifiers, and their default values.
|
||||||
*
|
* When this class is instantiated, these enum values are used
|
||||||
* Note: preferences must be loaded separately.
|
* in a map that is populated with the current preferences
|
||||||
*
|
* from the text file.
|
||||||
* @param s0   File address string
|
|
||||||
*/
|
*/
|
||||||
public ForgePreferences(String s0) {
|
public enum FPref { /** */
|
||||||
this.fileName = s0;
|
UI_USE_OLD ("false"), /** */
|
||||||
File f = new File(fileName);
|
UI_RANDOM_FOIL ("false"), /** */
|
||||||
|
UI_LAYOUT_PARAMS ("0.15,0.55,0.68,0.73,0.44,0.40"), /** */
|
||||||
|
UI_SMOOTH_LAND ("false"), /** */
|
||||||
|
UI_USE_SKIN ("default"), /** */
|
||||||
|
UI_CARD_OVERLAY ("true"), /** */
|
||||||
|
UI_UPLOAD_DRAFT ("false"), /** */
|
||||||
|
UI_SCALE_LARGER ("false"), /** */
|
||||||
|
UI_MAX_STACK ("3"), /** */
|
||||||
|
UI_STACK_OFFSET ("tiny"), /** */
|
||||||
|
UI_CARD_SIZE ("small"), /** */
|
||||||
|
UI_BUGZ_NAME (""), /** */
|
||||||
|
UI_BUGZ_PWD (""), /** */
|
||||||
|
UI_ANTE ("false"), /** */
|
||||||
|
UI_SKIN ("default"), /** */
|
||||||
|
|
||||||
if (!f.exists()) { makeNew(); }
|
DEV_MODE_ENABLED ("false"), /** */
|
||||||
else { load(); }
|
DEV_MILLING_LOSS ("true"), /** */
|
||||||
|
DEV_UNLIMITED_LAND ("false"), /** */
|
||||||
|
|
||||||
// Test for existence of old file
|
DECKGEN_SINGLETONS ("false"), /** */
|
||||||
if (prefs.get("ui.use.skin") == null) {
|
DECKGEN_ARTIFACTS ("false"), /** */
|
||||||
makeNew();
|
DECKGEN_NOSMALL ("false"), /** */
|
||||||
|
|
||||||
|
PHASE_AI_UPKEEP ("true"), /** */
|
||||||
|
PHASE_AI_DRAW ("true"), /** */
|
||||||
|
PHASE_AI_MAIN1 ("true"), /** */
|
||||||
|
PHASE_AI_BEGINCOMBAT ("true"), /** */
|
||||||
|
PHASE_AI_DECLAREATTACKERS ("true"), /** */
|
||||||
|
PHASE_AI_DECLAREBLOCKERS ("true"), /** */
|
||||||
|
PHASE_AI_FIRSTSTRIKE ("true"), /** */
|
||||||
|
PHASE_AI_COMBATDAMAGE ("true"), /** */
|
||||||
|
PHASE_AI_ENDCOMBAT ("true"), /** */
|
||||||
|
PHASE_AI_MAIN2 ("true"), /** */
|
||||||
|
PHASE_AI_EOT ("true"), /** */
|
||||||
|
PHASE_AI_CLEANUP ("true"), /** */
|
||||||
|
|
||||||
|
PHASE_HUMAN_UPKEEP ("true"), /** */
|
||||||
|
PHASE_HUMAN_DRAW ("true"), /** */
|
||||||
|
PHASE_HUMAN_MAIN1 ("true"), /** */
|
||||||
|
PHASE_HUMAN_BEGINCOMBAT ("true"), /** */
|
||||||
|
PHASE_HUMAN_DECLAREATTACKERS ("true"), /** */
|
||||||
|
PHASE_HUMAN_DECLAREBLOCKERS ("true"), /** */
|
||||||
|
PHASE_HUMAN_FIRSTSTRIKE ("true"), /** */
|
||||||
|
PHASE_HUMAN_COMBATDAMAGE ("true"), /** */
|
||||||
|
PHASE_HUMAN_ENDCOMBAT ("true"), /** */
|
||||||
|
PHASE_HUMAN_MAIN2 ("true"), /** */
|
||||||
|
PHASE_HUMAN_EOT ("true"), /** */
|
||||||
|
PHASE_HUMAN_CLEANUP ("true"), /** */
|
||||||
|
|
||||||
|
SHORTCUT_SHOWSTACK ("83"), /** */
|
||||||
|
SHORTCUT_SHOWCOMBAT ("67"), /** */
|
||||||
|
SHORTCUT_SHOWCONSOLE ("76"), /** */
|
||||||
|
SHORTCUT_SHOWPLAYERS ("80"), /** */
|
||||||
|
SHORTCUT_SHOWDEV ("68"), /** */
|
||||||
|
SHORTCUT_CONCEDE ("17");
|
||||||
|
|
||||||
|
private final String strDefaultVal;
|
||||||
|
|
||||||
|
/** @param s0   {@link java.lang.String} */
|
||||||
|
FPref(String s0) {
|
||||||
|
this.strDefaultVal = s0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @return {@link java.lang.String} */
|
||||||
|
public String getDefault() {
|
||||||
|
return strDefaultVal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void makeNew() {
|
/** */
|
||||||
prefs = new HashMap<String, String>();
|
public enum CardSizeType {
|
||||||
//========== Default values for all preferences:
|
/** */
|
||||||
// UI preferences
|
tiny, smaller, small, medium, large, huge
|
||||||
prefs.put("ui.use.old", "false");
|
|
||||||
prefs.put("ui.random.foil", "false");
|
|
||||||
prefs.put("ui.layout.params", "");
|
|
||||||
prefs.put("ui.smooth.land", "false");
|
|
||||||
prefs.put("ui.use.skin", "default");
|
|
||||||
prefs.put("ui.card.overlay", "true");
|
|
||||||
prefs.put("ui.upload.draft", "false");
|
|
||||||
prefs.put("ui.scale.larger", "false");
|
|
||||||
prefs.put("ui.max.stack", "3");
|
|
||||||
prefs.put("ui.stack.offset", "tiny");
|
|
||||||
prefs.put("ui.card.size", "small");
|
|
||||||
prefs.put("ui.bugz.name", "");
|
|
||||||
prefs.put("ui.bugz.pwd", "");
|
|
||||||
prefs.put("ui.ante", "false");
|
|
||||||
|
|
||||||
// Devmode preferences
|
|
||||||
prefs.put("dev.mode", "false");
|
|
||||||
prefs.put("dev.milling.loss", "true");
|
|
||||||
prefs.put("dev.unlimited.land", "false");
|
|
||||||
|
|
||||||
//Deck generation preferences
|
|
||||||
prefs.put("deckgen.singletons", "false");
|
|
||||||
prefs.put("deckgen.artifacts", "false");
|
|
||||||
prefs.put("deckgen.nosmall", "false");
|
|
||||||
|
|
||||||
// Phase toggle preferences
|
|
||||||
prefs.put("phase.ai.upkeep", "true");
|
|
||||||
prefs.put("phase.ai.draw", "true");
|
|
||||||
prefs.put("phase.ai.main1", "true");
|
|
||||||
prefs.put("phase.ai.beginCombat", "true");
|
|
||||||
prefs.put("phase.ai.declareAttackers", "true");
|
|
||||||
prefs.put("phase.ai.declareBlockers", "true");
|
|
||||||
prefs.put("phase.ai.firstStrike", "true");
|
|
||||||
prefs.put("phase.ai.combatDamage", "true");
|
|
||||||
prefs.put("phase.ai.endCombat", "true");
|
|
||||||
prefs.put("phase.ai.main2", "true");
|
|
||||||
prefs.put("phase.ai.eot", "true");
|
|
||||||
prefs.put("phase.ai.cleanup", "true");
|
|
||||||
|
|
||||||
prefs.put("phase.human.upkeep", "true");
|
|
||||||
prefs.put("phase.human.draw", "true");
|
|
||||||
prefs.put("phase.human.main1", "true");
|
|
||||||
prefs.put("phase.human.beginCombat", "true");
|
|
||||||
prefs.put("phase.human.declareAttackers", "true");
|
|
||||||
prefs.put("phase.human.declareBlockers", "true");
|
|
||||||
prefs.put("phase.human.firstStrike", "true");
|
|
||||||
prefs.put("phase.human.combatDamage", "true");
|
|
||||||
prefs.put("phase.human.endCombat", "true");
|
|
||||||
prefs.put("phase.human.main2", "true");
|
|
||||||
prefs.put("phase.human.eot", "true");
|
|
||||||
prefs.put("phase.human.cleanup", "true");
|
|
||||||
|
|
||||||
// Keyboard shortcuts
|
|
||||||
prefs.put("shortcut.showstack", "83");
|
|
||||||
prefs.put("shortcut.showcombat", "67");
|
|
||||||
prefs.put("shortcut.showconsole", "76");
|
|
||||||
prefs.put("shortcut.showplayers", "80");
|
|
||||||
prefs.put("shortcut.showdev", "68");
|
|
||||||
prefs.put("shortcut.concede", "17");
|
|
||||||
|
|
||||||
save();
|
|
||||||
}
|
}
|
||||||
//========== File handling
|
|
||||||
|
|
||||||
/** Loads preferences from file into prefs map. */
|
/** */
|
||||||
public void load() {
|
public enum StackOffsetType {
|
||||||
BufferedReader reader = null;
|
/** */
|
||||||
|
tiny, small, medium, large
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Instantiates a ForgePreferences object. */
|
||||||
|
public ForgePreferences() {
|
||||||
|
preferenceValues = new HashMap<FPref, String>();
|
||||||
try {
|
try {
|
||||||
|
final BufferedReader input = new BufferedReader(new FileReader(NewConstants.PREFERENCE_FILE));
|
||||||
String line = null;
|
String line = null;
|
||||||
reader = new BufferedReader(new FileReader(fileName));
|
while ((line = input.readLine()) != null) {
|
||||||
prefs = new HashMap<String, String>();
|
if (line.startsWith("#") || (line.length() == 0)) {
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
String[] pair = line.split("=");
|
|
||||||
if (pair.length != 2) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
prefs.put(pair[0], pair[1]);
|
|
||||||
|
final String[] split = line.split("=");
|
||||||
|
|
||||||
|
if (split.length == 2) {
|
||||||
|
this.setPref(split[0], split[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
reader.close();
|
|
||||||
} catch (FileNotFoundException ex) {
|
} catch (FileNotFoundException ex) {
|
||||||
ex.printStackTrace();
|
//ex.printStackTrace();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
ex.printStackTrace();
|
//ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,10 +158,9 @@ public class ForgePreferences {
|
|||||||
BufferedWriter writer = null;
|
BufferedWriter writer = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
writer = new BufferedWriter(new FileWriter(fileName));
|
writer = new BufferedWriter(new FileWriter(NewConstants.PREFERENCE_FILE));
|
||||||
TreeSet<String> keys = new TreeSet<String>(prefs.keySet());
|
for (FPref key : FPref.values()) {
|
||||||
for (String key : keys) {
|
writer.write(key + "=" + getPref(key));
|
||||||
writer.write(key + "=" + prefs.get(key));
|
|
||||||
writer.newLine();
|
writer.newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,286 +173,62 @@ public class ForgePreferences {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//========== Enums
|
/**
|
||||||
/** */
|
* DUE TO BE DEPRECATED:
|
||||||
public static enum CardSizeType {
|
* Transition code between preference manager for v1.2.2 and v1.2.3.
|
||||||
/** */
|
* (string-based vs. enum-based)
|
||||||
tiny, smaller, small, medium, large, huge
|
*
|
||||||
|
* @param s0   {@link java.lang.String} identifier of preference
|
||||||
|
* @param s1   {@link java.lang.String} value
|
||||||
|
*/
|
||||||
|
public void setPref(String s0, String s1) {
|
||||||
|
try {
|
||||||
|
preferenceValues.put(FPref.valueOf(s0), s1);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
|
||||||
public static enum StackOffsetType {
|
|
||||||
/** */
|
|
||||||
tiny, small, medium, large
|
|
||||||
}
|
|
||||||
|
|
||||||
//========== Setters / getters: UI prefs
|
|
||||||
|
|
||||||
/** @return boolean */
|
|
||||||
public boolean isStackAiLand() {
|
|
||||||
return Boolean.parseBoolean(prefs.get("ui.smooth.land"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param b0   boolean */
|
|
||||||
public void setStackAiLand(boolean b0) {
|
|
||||||
prefs.put("ui.smooth.land", Boolean.toString(b0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return boolean */
|
|
||||||
public boolean isOldGui() {
|
|
||||||
return Boolean.parseBoolean(prefs.get("ui.use.old"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param b0   boolean */
|
|
||||||
public void setOldGui(boolean b0) {
|
|
||||||
prefs.put("ui.use.old", Boolean.toString(b0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return String of six values, comma delimited */
|
|
||||||
public String getUILayout() {
|
|
||||||
return prefs.get("ui.layout.params");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param s0   String of six values, comma delimited */
|
|
||||||
public void setUILayout(String s0) {
|
|
||||||
prefs.put("ui.layout.params", s0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return boolean */
|
|
||||||
public boolean isUploadDraftAI() {
|
|
||||||
return Boolean.parseBoolean(prefs.get("ui.upload.draft"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param b0   boolean */
|
|
||||||
public void setUploadDraftAI(boolean b0) {
|
|
||||||
prefs.put("ui.upload.draft", Boolean.toString(b0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return the randCFoil */
|
|
||||||
public boolean isRandCFoil() {
|
|
||||||
return Boolean.parseBoolean(prefs.get("ui.random.foil"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param b0   boolean */
|
|
||||||
public void setRandCFoil(boolean b0) {
|
|
||||||
prefs.put("ui.random.foil", Boolean.toString(b0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param skin0   String skin name*/
|
|
||||||
public void setSkin(String skin0) {
|
|
||||||
prefs.put("ui.use.skin", skin0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return boolean*/
|
|
||||||
public boolean isCardOverlay() {
|
|
||||||
return Boolean.parseBoolean(prefs.get("ui.card.overlay"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param b0   boolean */
|
|
||||||
public void setCardOverlay(boolean b0) {
|
|
||||||
prefs.put("ui.card.overlay", Boolean.toString(b0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return int */
|
|
||||||
public int getMaxStackSize() {
|
|
||||||
return Integer.parseInt(prefs.get("ui.max.stack"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param i0   int, max stack size */
|
|
||||||
public void setMaxStackSize(int i0) {
|
|
||||||
prefs.put("ui.max.stack", Integer.toString(i0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return boolean */
|
|
||||||
public boolean isScaleLargerThanOriginal() {
|
|
||||||
return Boolean.parseBoolean(prefs.get("ui.scale.larger"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param b0 boolean */
|
|
||||||
public void setScaleLargerThanOriginal(boolean b0) {
|
|
||||||
prefs.put("ui.scale.larger", Boolean.toString(b0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return boolean */
|
|
||||||
public boolean isPlayForAnte() {
|
|
||||||
return Boolean.parseBoolean(prefs.get("ui.ante"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param b0 boolean */
|
|
||||||
public void setPlayForAnte(boolean b0) {
|
|
||||||
prefs.put("ui.ante", Boolean.toString(b0));
|
|
||||||
}
|
|
||||||
|
|
||||||
//========== Setters / getters: Dev mode prefs
|
|
||||||
|
|
||||||
/** @return boolean */
|
|
||||||
public boolean isMillingLossCondition() {
|
|
||||||
return Boolean.parseBoolean(prefs.get("dev.milling.loss"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param b0   boolean */
|
|
||||||
public void setMillingLossCondition(boolean b0) {
|
|
||||||
prefs.put("dev.milling.loss", Boolean.toString(b0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return boolean */
|
|
||||||
public boolean isUnlimitedLand() {
|
|
||||||
return Boolean.parseBoolean(prefs.get("dev.unlimited.land"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param b0   boolean */
|
|
||||||
public void setUnlimitedLand(boolean b0) {
|
|
||||||
prefs.put("dev.unlimited.land", Boolean.toString(b0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return boolean */
|
|
||||||
public boolean isDeveloperMode() {
|
|
||||||
return Boolean.parseBoolean(prefs.get("dev.mode"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param b0   boolean */
|
|
||||||
public void setDeveloperMode(boolean b0) {
|
|
||||||
prefs.put("dev.mode", Boolean.toString(b0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return CardSizeType */
|
|
||||||
public CardSizeType getCardSize() {
|
|
||||||
return CardSizeType.valueOf(prefs.get("ui.card.size"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param cst0   CardSizeType */
|
|
||||||
public void setCardSize(CardSizeType cst0) {
|
|
||||||
prefs.put("ui.card.size", cst0.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return StackOffsetType */
|
|
||||||
public StackOffsetType getStackOffset() {
|
|
||||||
return StackOffsetType.valueOf(prefs.get("ui.stack.offset"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param sot0   StackOffsetType */
|
|
||||||
public void setStackOffset(StackOffsetType sot0) {
|
|
||||||
prefs.put("ui.stack.offset", sot0.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return String skin name */
|
|
||||||
public String getSkin() {
|
|
||||||
return prefs.get("ui.use.skin");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return String */
|
|
||||||
public String getBugzName() {
|
|
||||||
return prefs.get("ui.bugz.name");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param s0   String bugzName */
|
|
||||||
public void setBugzName(String s0) {
|
|
||||||
prefs.put("ui.bugz.name", s0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return String */
|
|
||||||
public String getBugzPwd() {
|
|
||||||
return prefs.get("ui.bugz.pwd");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param s0   String password */
|
|
||||||
public void setBugzPwd(String s0) {
|
|
||||||
prefs.put("ui.bugz.pwd", s0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//========== Setters / getters: Deck generation prefs
|
|
||||||
|
|
||||||
/** @return boolean */
|
|
||||||
public boolean isDeckGenSingletons() {
|
|
||||||
return Boolean.parseBoolean(prefs.get("deckgen.singletons"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param b0   boolean */
|
|
||||||
public void setDeckGenSingletons(boolean b0) {
|
|
||||||
prefs.put("deckgen.singletons", Boolean.toString(b0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return boolean */
|
|
||||||
public boolean isDeckGenRmvArtifacts() {
|
|
||||||
return Boolean.parseBoolean(prefs.get("deckgen.artifacts"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param b0   boolean */
|
|
||||||
public void setDeckGenRmvArtifacts(boolean b0) {
|
|
||||||
prefs.put("deckgen.artifacts", Boolean.toString(b0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return boolean */
|
|
||||||
public boolean isDeckGenRmvSmall() {
|
|
||||||
return Boolean.parseBoolean(prefs.get("deckgen.nosmall"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param b0   boolean */
|
|
||||||
public void setDeckGenRmvSmall(boolean b0) {
|
|
||||||
prefs.put("deckgen.nosmall", Boolean.toString(b0));
|
|
||||||
}
|
|
||||||
|
|
||||||
//========== Phase and shortcut setter/getter
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints exception stack trace if phase name is not in the list.
|
* @param q0   {@link forge.properties.ForgePreferences.FPref}
|
||||||
* @param s0   String phase name
|
* @param s0   {@link java.lang.String} value
|
||||||
|
*/
|
||||||
|
public void setPref(FPref q0, String s0) {
|
||||||
|
preferenceValues.put(q0, s0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a non-difficulty-indexed preference value.
|
||||||
|
*
|
||||||
|
* @param fp0   {@link forge.quest.data.ForgePreferences.FPref}
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public String getPref(FPref fp0) {
|
||||||
|
String val;
|
||||||
|
|
||||||
|
val = preferenceValues.get(fp0);
|
||||||
|
if (val == null) { val = fp0.getDefault(); }
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a non-difficulty-indexed preference value, as an int.
|
||||||
|
*
|
||||||
|
* @param fp0   {@link forge.quest.data.ForgePreferences.FPref}
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public int getPrefInt(FPref fp0) {
|
||||||
|
return Integer.parseInt(getPref(fp0));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a non-difficulty-indexed preference value, as a boolean.
|
||||||
|
*
|
||||||
|
* @param fp0   {@link forge.quest.data.ForgePreferences.FPref}
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean isShowPhase(String s0) {
|
public boolean getPrefBoolean(FPref fp0) {
|
||||||
if (prefs.get(s0) != null) {
|
return Boolean.parseBoolean(getPref(fp0));
|
||||||
return Boolean.parseBoolean(prefs.get(s0));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Exception ex = new Exception();
|
|
||||||
ex.printStackTrace();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prints exception stack trace if phase name is not in the list.
|
|
||||||
* @param s0   String phase name
|
|
||||||
* @param b0   boolean
|
|
||||||
*/
|
|
||||||
public void setShowPhase(String s0, boolean b0) {
|
|
||||||
if (prefs.get(s0) != null) {
|
|
||||||
prefs.put(s0, Boolean.toString(b0));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Exception ex = new Exception();
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prints exception stack trace if shortcut is not in the list.
|
|
||||||
* @param s0   String shortcut key code(s)
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public String getKeyboardShortcut(String s0) {
|
|
||||||
if (prefs.get(s0) != null) {
|
|
||||||
return prefs.get(s0);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Exception ex = new Exception();
|
|
||||||
ex.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prints exception stack trace if shortcut is not in the list.
|
|
||||||
* @param s0   String shortcut name
|
|
||||||
* @param s1   String shortcut key code(s)
|
|
||||||
*/
|
|
||||||
public void setKeyboardShortcut(String s0, String s1) {
|
|
||||||
if (prefs.get(s0) != null) {
|
|
||||||
prefs.put(s0, s1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Exception ex = new Exception();
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ public final class NewConstants {
|
|||||||
/** Constant <code>CARDFORGE_URL = "program/cardforgeURL"</code>. */
|
/** Constant <code>CARDFORGE_URL = "program/cardforgeURL"</code>. */
|
||||||
public static final String CARDFORGE_URL = "program/cardforgeURL";
|
public static final String CARDFORGE_URL = "program/cardforgeURL";
|
||||||
|
|
||||||
|
/** Constant <code>CARDFORGE_URL = "program/cardforgeURL"</code>. */
|
||||||
|
public static final String PREFERENCE_FILE = "forge.preferences";
|
||||||
|
|
||||||
/** Constant <code>DECKS="decks"</code>. */
|
/** Constant <code>DECKS="decks"</code>. */
|
||||||
public static final String DECKS = "decks";
|
public static final String DECKS = "decks";
|
||||||
/** Constant <code>BOOSTER_DECKS="booster-decks"</code>. */
|
/** Constant <code>BOOSTER_DECKS="booster-decks"</code>. */
|
||||||
@@ -50,7 +53,6 @@ public final class NewConstants {
|
|||||||
/** Constant <code>NEW_DECKS="decks-dir"</code>. */
|
/** Constant <code>NEW_DECKS="decks-dir"</code>. */
|
||||||
public static final String NEW_DECKS = "decks-dir";
|
public static final String NEW_DECKS = "decks-dir";
|
||||||
|
|
||||||
|
|
||||||
/** Constant <code>TOKENS="tokens"</code>. */
|
/** Constant <code>TOKENS="tokens"</code>. */
|
||||||
public static final String TOKENS = "tokens";
|
public static final String TOKENS = "tokens";
|
||||||
/** Constant <code>CARD_PICTURES="card-pictures"</code>. */
|
/** Constant <code>CARD_PICTURES="card-pictures"</code>. */
|
||||||
@@ -210,6 +212,7 @@ public final class NewConstants {
|
|||||||
/** The PET_TOKEN_IMAGES. */
|
/** The PET_TOKEN_IMAGES. */
|
||||||
public static final String PET_TOKEN_IMAGES = "quest/pet/tokens";
|
public static final String PET_TOKEN_IMAGES = "quest/pet/tokens";
|
||||||
|
|
||||||
|
/** */
|
||||||
public static final String PRECONS = "quest/precons-dir";
|
public static final String PRECONS = "quest/precons-dir";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ import forge.properties.NewConstants.Quest;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class QuestPreferences implements Serializable {
|
public class QuestPreferences implements Serializable {
|
||||||
|
|
||||||
private Map<QPref, String> preferenceValues;
|
private Map<QPref, String> preferenceValues;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -151,12 +150,15 @@ public class QuestPreferences implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final String[] split = line.split("=");
|
final String[] split = line.split("=");
|
||||||
this.setPreference(split[0], split[1]);
|
|
||||||
|
if (split.length == 2) {
|
||||||
|
this.setPreference(split[0], split[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException ex) {
|
} catch (FileNotFoundException ex) {
|
||||||
ex.printStackTrace();
|
//ex.printStackTrace();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
ex.printStackTrace();
|
//ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,8 +189,7 @@ public class QuestPreferences implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* DUE TO BE DEPRECATED:
|
* DUE TO BE DEPRECATED:
|
||||||
* Transition code between preference manager for v1.2.2 and v1.2.3.
|
* Transition code between preference manager for v1.2.2 and v1.2.3.
|
||||||
* Should be able to delete very neatly after release of 1.2.3,
|
* (string-based vs. enum-based)
|
||||||
* perhaps sooner.
|
|
||||||
*
|
*
|
||||||
* @param s0   {@link java.lang.String} identifier of preference
|
* @param s0   {@link java.lang.String} identifier of preference
|
||||||
* @param s1   {@link java.lang.String} value
|
* @param s1   {@link java.lang.String} value
|
||||||
@@ -202,7 +203,7 @@ public class QuestPreferences implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param q0   {@link forge.quest.data.CopyOfQuestPreferences.QPref}
|
* @param q0   {@link forge.quest.data.QuestPreferences.QPref}
|
||||||
* @param s0   {@link java.lang.String} value
|
* @param s0   {@link java.lang.String} value
|
||||||
*/
|
*/
|
||||||
public void setPreference(QPref q0, String s0) {
|
public void setPreference(QPref q0, String s0) {
|
||||||
@@ -212,7 +213,7 @@ public class QuestPreferences implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* Returns a non-difficulty-indexed preference value.
|
* Returns a non-difficulty-indexed preference value.
|
||||||
*
|
*
|
||||||
* @param qp0   {@link forge.quest.data.CopyOfQuestPreferences.QPref}
|
* @param qp0   {@link forge.quest.data.QuestPreferences.QPref}
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String getPreference(QPref qp0) {
|
public String getPreference(QPref qp0) {
|
||||||
@@ -237,7 +238,7 @@ public class QuestPreferences implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* Returns a preference value according to a difficulty index.
|
* Returns a preference value according to a difficulty index.
|
||||||
*
|
*
|
||||||
* @param qp0   {@link forge.quest.data.CopyOfQuestPreferences.QPref}
|
* @param qp0   {@link forge.quest.data.QuestPreferences.QPref}
|
||||||
* @param i0   int difficulty index
|
* @param i0   int difficulty index
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
@@ -269,7 +270,7 @@ public class QuestPreferences implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* Returns a non-difficulty-indexed preference value, as an int.
|
* Returns a non-difficulty-indexed preference value, as an int.
|
||||||
*
|
*
|
||||||
* @param qp0   {@link forge.quest.data.CopyOfQuestPreferences.QPref}
|
* @param qp0   {@link forge.quest.data.QuestPreferences.QPref}
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public int getPreferenceInt(QPref qp0) {
|
public int getPreferenceInt(QPref qp0) {
|
||||||
@@ -279,7 +280,7 @@ public class QuestPreferences implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* Returns a difficulty-indexed preference value, as an int.
|
* Returns a difficulty-indexed preference value, as an int.
|
||||||
*
|
*
|
||||||
* @param qp0   {@link forge.quest.data.CopyOfQuestPreferences.QPref}
|
* @param qp0   {@link forge.quest.data.QuestPreferences.QPref}
|
||||||
* @param i0   int difficulty index
|
* @param i0   int difficulty index
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import forge.gui.GuiUtils;
|
|||||||
import forge.gui.ListChooser;
|
import forge.gui.ListChooser;
|
||||||
import forge.item.CardPrinted;
|
import forge.item.CardPrinted;
|
||||||
import forge.model.FMatchState;
|
import forge.model.FMatchState;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.quest.data.QuestChallenge;
|
import forge.quest.data.QuestChallenge;
|
||||||
import forge.quest.data.QuestData;
|
import forge.quest.data.QuestData;
|
||||||
import forge.quest.data.QuestEvent;
|
import forge.quest.data.QuestEvent;
|
||||||
@@ -103,7 +104,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
|
|||||||
this.model.qPrefs = Singletons.getModel().getQuestPreferences();
|
this.model.qPrefs = Singletons.getModel().getQuestPreferences();
|
||||||
this.wonMatch = this.model.matchState.isMatchWonBy(AllZone.getHumanPlayer().getName());
|
this.wonMatch = this.model.matchState.isMatchWonBy(AllZone.getHumanPlayer().getName());
|
||||||
this.skin = Singletons.getView().getSkin();
|
this.skin = Singletons.getView().getSkin();
|
||||||
this.isAnte = Singletons.getModel().getPreferences().isPlayForAnte();
|
this.isAnte = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JLayeredPane;
|
import javax.swing.JLayeredPane;
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
|
|
||||||
import forge.AllZone;
|
import forge.AllZone;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
@@ -39,8 +38,8 @@ import forge.Singletons;
|
|||||||
import forge.control.FControl;
|
import forge.control.FControl;
|
||||||
import forge.control.match.ControlField;
|
import forge.control.match.ControlField;
|
||||||
import forge.properties.ForgePreferences;
|
import forge.properties.ForgePreferences;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.view.match.ViewField;
|
import forge.view.match.ViewField;
|
||||||
import forge.view.match.ViewTabber;
|
|
||||||
import forge.view.toolbox.FOverlay;
|
import forge.view.toolbox.FOverlay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -317,41 +316,42 @@ public class GuiTopLevel extends JFrame implements Display, CardContainer {
|
|||||||
final ForgePreferences fp = Singletons.getModel().getPreferences();
|
final ForgePreferences fp = Singletons.getModel().getPreferences();
|
||||||
final List<ViewField> fieldViews = this.control.getMatchController().getView().getFieldViews();
|
final List<ViewField> fieldViews = this.control.getMatchController().getView().getFieldViews();
|
||||||
|
|
||||||
Constant.Runtime.MILL[0] = fp.isMillingLossCondition();
|
Constant.Runtime.MILL[0] = fp.getPrefBoolean(FPref.DEV_MILLING_LOSS);
|
||||||
Constant.Runtime.DEV_MODE[0] = fp.isDeveloperMode();
|
Constant.Runtime.DEV_MODE[0] = fp.getPrefBoolean(FPref.DEV_MODE_ENABLED);
|
||||||
Constant.Runtime.UPLOAD_DRAFT[0] = fp.isUploadDraftAI();
|
Constant.Runtime.UPLOAD_DRAFT[0] = fp.getPrefBoolean(FPref.UI_UPLOAD_DRAFT);
|
||||||
Constant.Runtime.RANDOM_FOIL[0] = fp.isRandCFoil();
|
Constant.Runtime.RANDOM_FOIL[0] = fp.getPrefBoolean(FPref.UI_RANDOM_FOIL);
|
||||||
Constant.Runtime.UPLOAD_DRAFT[0] = (Constant.Runtime.NET_CONN[0] ? fp.isUploadDraftAI() : false);
|
Constant.Runtime.UPLOAD_DRAFT[0] =
|
||||||
|
(Constant.Runtime.NET_CONN[0] ? fp.getPrefBoolean(FPref.UI_UPLOAD_DRAFT) : false);
|
||||||
|
|
||||||
// AI field is at index [0]
|
// AI field is at index [0]
|
||||||
fieldViews.get(0).getLblUpkeep().setEnabled(fp.isShowPhase("phase.ai.upkeep"));
|
fieldViews.get(0).getLblUpkeep().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_UPKEEP));
|
||||||
fieldViews.get(0).getLblDraw().setEnabled(fp.isShowPhase("phase.ai.draw"));
|
fieldViews.get(0).getLblDraw().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_DRAW));
|
||||||
fieldViews.get(0).getLblMain1().setEnabled(fp.isShowPhase("phase.ai.main1"));
|
fieldViews.get(0).getLblMain1().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_MAIN1));
|
||||||
fieldViews.get(0).getLblBeginCombat().setEnabled(fp.isShowPhase("phase.ai.beginCombat"));
|
fieldViews.get(0).getLblBeginCombat().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_BEGINCOMBAT));
|
||||||
fieldViews.get(0).getLblDeclareAttackers().setEnabled(fp.isShowPhase("phase.ai.declareAttackers"));
|
fieldViews.get(0).getLblDeclareAttackers().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_DECLAREATTACKERS));
|
||||||
fieldViews.get(0).getLblDeclareBlockers().setEnabled(fp.isShowPhase("phase.ai.declareBlockers"));
|
fieldViews.get(0).getLblDeclareBlockers().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_DECLAREBLOCKERS));
|
||||||
fieldViews.get(0).getLblFirstStrike().setEnabled(fp.isShowPhase("phase.ai.firstStrike"));
|
fieldViews.get(0).getLblFirstStrike().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_FIRSTSTRIKE));
|
||||||
fieldViews.get(0).getLblCombatDamage().setEnabled(fp.isShowPhase("phase.ai.combatDamage"));
|
fieldViews.get(0).getLblCombatDamage().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_COMBATDAMAGE));
|
||||||
fieldViews.get(0).getLblEndCombat().setEnabled(fp.isShowPhase("phase.ai.endCombat"));
|
fieldViews.get(0).getLblEndCombat().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_ENDCOMBAT));
|
||||||
fieldViews.get(0).getLblMain2().setEnabled(fp.isShowPhase("phase.ai.main2"));
|
fieldViews.get(0).getLblMain2().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_MAIN2));
|
||||||
fieldViews.get(0).getLblEndTurn().setEnabled(fp.isShowPhase("phase.ai.eot"));
|
fieldViews.get(0).getLblEndTurn().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_EOT));
|
||||||
fieldViews.get(0).getLblCleanup().setEnabled(fp.isShowPhase("phase.ai.cleanup"));
|
fieldViews.get(0).getLblCleanup().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_CLEANUP));
|
||||||
|
|
||||||
// Human field is at index [1]
|
// Human field is at index [1]
|
||||||
fieldViews.get(1).getLblUpkeep().setEnabled(fp.isShowPhase("phase.human.upkeep"));
|
fieldViews.get(1).getLblUpkeep().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_UPKEEP));
|
||||||
fieldViews.get(1).getLblDraw().setEnabled(fp.isShowPhase("phase.human.draw"));
|
fieldViews.get(1).getLblDraw().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_DRAW));
|
||||||
fieldViews.get(1).getLblMain1().setEnabled(fp.isShowPhase("phase.human.main1"));
|
fieldViews.get(1).getLblMain1().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_MAIN1));
|
||||||
fieldViews.get(1).getLblBeginCombat().setEnabled(fp.isShowPhase("phase.human.beginCombat"));
|
fieldViews.get(1).getLblBeginCombat().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_BEGINCOMBAT));
|
||||||
fieldViews.get(1).getLblDeclareAttackers().setEnabled(fp.isShowPhase("phase.human.declareAttackers"));
|
fieldViews.get(1).getLblDeclareAttackers().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_DECLAREATTACKERS));
|
||||||
fieldViews.get(1).getLblDeclareBlockers().setEnabled(fp.isShowPhase("phase.human.declareBlockers"));
|
fieldViews.get(1).getLblDeclareBlockers().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_DECLAREBLOCKERS));
|
||||||
fieldViews.get(1).getLblFirstStrike().setEnabled(fp.isShowPhase("phase.human.firstStrike"));
|
fieldViews.get(1).getLblFirstStrike().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_FIRSTSTRIKE));
|
||||||
fieldViews.get(1).getLblCombatDamage().setEnabled(fp.isShowPhase("phase.human.combatDamage"));
|
fieldViews.get(1).getLblCombatDamage().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_COMBATDAMAGE));
|
||||||
fieldViews.get(1).getLblEndCombat().setEnabled(fp.isShowPhase("phase.human.endCombat"));
|
fieldViews.get(1).getLblEndCombat().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_ENDCOMBAT));
|
||||||
fieldViews.get(1).getLblMain2().setEnabled(fp.isShowPhase("phase.human.main2"));
|
fieldViews.get(1).getLblMain2().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_MAIN2));
|
||||||
fieldViews.get(1).getLblEndTurn().setEnabled(fp.isShowPhase("phase.human.eot"));
|
fieldViews.get(1).getLblEndTurn().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_EOT));
|
||||||
fieldViews.get(1).getLblCleanup().setEnabled(fp.isShowPhase("phase.human.cleanup"));
|
fieldViews.get(1).getLblCleanup().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_CLEANUP));
|
||||||
|
|
||||||
this.control.getMatchController().getView().setLayoutParams(fp.getUILayout());
|
this.control.getMatchController().getView().setLayoutParams(fp.getPref(FPref.UI_LAYOUT_PARAMS));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,54 +367,6 @@ public class GuiTopLevel extends JFrame implements Display, CardContainer {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final boolean savePrefs() {
|
public final boolean savePrefs() {
|
||||||
final ForgePreferences fp = Singletons.getModel().getPreferences();
|
|
||||||
final List<ViewField> fieldViews = this.control.getMatchController().getView().getFieldViews();
|
|
||||||
|
|
||||||
// AI field is at index [0]
|
|
||||||
fp.setShowPhase("phase.ai.upkeep", fieldViews.get(0).getLblUpkeep().getEnabled());
|
|
||||||
fp.setShowPhase("phase.ai.draw", fieldViews.get(0).getLblDraw().getEnabled());
|
|
||||||
fp.setShowPhase("phase.ai.main1", fieldViews.get(0).getLblMain1().getEnabled());
|
|
||||||
fp.setShowPhase("phase.ai.beginCombat", fieldViews.get(0).getLblBeginCombat().getEnabled());
|
|
||||||
fp.setShowPhase("phase.ai.declareAttackers", fieldViews.get(0).getLblDeclareAttackers().getEnabled());
|
|
||||||
fp.setShowPhase("phase.ai.declareBlockers", fieldViews.get(0).getLblDeclareBlockers().getEnabled());
|
|
||||||
fp.setShowPhase("phase.ai.firstStrike", fieldViews.get(0).getLblFirstStrike().getEnabled());
|
|
||||||
fp.setShowPhase("phase.ai.combatDamage", fieldViews.get(0).getLblCombatDamage().getEnabled());
|
|
||||||
fp.setShowPhase("phase.ai.endCombat", fieldViews.get(0).getLblEndCombat().getEnabled());
|
|
||||||
fp.setShowPhase("phase.ai.main2", fieldViews.get(0).getLblMain2().getEnabled());
|
|
||||||
fp.setShowPhase("phase.ai.eot", fieldViews.get(0).getLblEndTurn().getEnabled());
|
|
||||||
fp.setShowPhase("phase.ai.cleanup", fieldViews.get(0).getLblCleanup().getEnabled());
|
|
||||||
|
|
||||||
// Human field is at index [1]
|
|
||||||
fp.setShowPhase("phase.human.upkeep", fieldViews.get(1).getLblUpkeep().getEnabled());
|
|
||||||
fp.setShowPhase("phase.human.draw", fieldViews.get(1).getLblDraw().getEnabled());
|
|
||||||
fp.setShowPhase("phase.human.main1", fieldViews.get(1).getLblMain1().getEnabled());
|
|
||||||
fp.setShowPhase("phase.human.beginCombat", fieldViews.get(1).getLblBeginCombat().getEnabled());
|
|
||||||
fp.setShowPhase("phase.human.declareAttackers", fieldViews.get(1).getLblDeclareAttackers().getEnabled());
|
|
||||||
fp.setShowPhase("phase.human.declareBlockers", fieldViews.get(1).getLblDeclareBlockers().getEnabled());
|
|
||||||
fp.setShowPhase("phase.human.firstStrike", fieldViews.get(1).getLblFirstStrike().getEnabled());
|
|
||||||
fp.setShowPhase("phase.human.combatDamage", fieldViews.get(1).getLblCombatDamage().getEnabled());
|
|
||||||
fp.setShowPhase("phase.human.endCombat", fieldViews.get(1).getLblEndCombat().getEnabled());
|
|
||||||
fp.setShowPhase("phase.human.main2", fieldViews.get(1).getLblMain2().getEnabled());
|
|
||||||
fp.setShowPhase("phase.human.eot", fieldViews.get(1).getLblEndTurn().getEnabled());
|
|
||||||
fp.setShowPhase("phase.human.cleanup", fieldViews.get(1).getLblCleanup().getEnabled());
|
|
||||||
|
|
||||||
ViewTabber v = this.control.getMatchController().getView().getTabberController().getView();
|
|
||||||
Constant.Runtime.MILL[0] = v.getLblMilling().getEnabled();
|
|
||||||
|
|
||||||
fp.setMillingLossCondition(Constant.Runtime.MILL[0]);
|
|
||||||
fp.setUILayout(control.getMatchController().getView().getLayoutParams());
|
|
||||||
fp.setUnlimitedLand(v.getLblUnlimitedLands().getEnabled());
|
|
||||||
|
|
||||||
try {
|
|
||||||
fp.save();
|
|
||||||
} catch (final Exception ex) {
|
|
||||||
final int result = JOptionPane.showConfirmDialog(this,
|
|
||||||
"Preferences could not be saved. Continue to close without saving ?", "Confirm Exit",
|
|
||||||
JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
|
|
||||||
if (result != JOptionPane.OK_OPTION) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import forge.Singletons;
|
|||||||
import forge.error.ErrorViewer;
|
import forge.error.ErrorViewer;
|
||||||
import forge.error.ExceptionHandler;
|
import forge.error.ExceptionHandler;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.view.toolbox.FSkin;
|
import forge.view.toolbox.FSkin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,7 +46,7 @@ public final class Main {
|
|||||||
ExceptionHandler.registerErrorHandling();
|
ExceptionHandler.registerErrorHandling();
|
||||||
try {
|
try {
|
||||||
final FModel model = new FModel();
|
final FModel model = new FModel();
|
||||||
final FSkin skin = new FSkin(model.getPreferences().getSkin());
|
final FSkin skin = new FSkin(model.getPreferences().getPref(FPref.UI_SKIN));
|
||||||
final FView view = new FView(skin);
|
final FView view = new FView(skin);
|
||||||
|
|
||||||
Singletons.setModel(model);
|
Singletons.setModel(model);
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import forge.Singletons;
|
|||||||
import forge.control.KeyboardShortcuts;
|
import forge.control.KeyboardShortcuts;
|
||||||
import forge.control.KeyboardShortcuts.Shortcut;
|
import forge.control.KeyboardShortcuts.Shortcut;
|
||||||
import forge.control.home.ControlSettings;
|
import forge.control.home.ControlSettings;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
import forge.properties.NewConstants.Lang.OldGuiNewGame.NewGameText;
|
import forge.properties.NewConstants.Lang.OldGuiNewGame.NewGameText;
|
||||||
import forge.view.GuiTopLevel;
|
import forge.view.GuiTopLevel;
|
||||||
@@ -88,19 +89,19 @@ public class ViewSettings extends JScrollPane {
|
|||||||
|
|
||||||
final JLabel lblRemoveSmall = new NoteLabel("Disables 1/1 and 0/X creatures in generated decks.");
|
final JLabel lblRemoveSmall = new NoteLabel("Disables 1/1 and 0/X creatures in generated decks.");
|
||||||
cbRemoveSmall = new OptionsCheckBox("Remove Small Creatures");
|
cbRemoveSmall = new OptionsCheckBox("Remove Small Creatures");
|
||||||
cbRemoveSmall.setSelected(Singletons.getModel().getPreferences().isDeckGenRmvSmall());
|
cbRemoveSmall.setSelected(Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_NOSMALL));
|
||||||
viewport.add(cbRemoveSmall, regularConstraints);
|
viewport.add(cbRemoveSmall, regularConstraints);
|
||||||
viewport.add(lblRemoveSmall, regularConstraints);
|
viewport.add(lblRemoveSmall, regularConstraints);
|
||||||
|
|
||||||
final JLabel lblSingletons = new NoteLabel("Disables non-land duplicates in generated decks.");
|
final JLabel lblSingletons = new NoteLabel("Disables non-land duplicates in generated decks.");
|
||||||
cbSingletons = new OptionsCheckBox("Singleton Mode");
|
cbSingletons = new OptionsCheckBox("Singleton Mode");
|
||||||
cbSingletons.setSelected(Singletons.getModel().getPreferences().isDeckGenSingletons());
|
cbSingletons.setSelected(Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_SINGLETONS));
|
||||||
viewport.add(cbSingletons, regularConstraints);
|
viewport.add(cbSingletons, regularConstraints);
|
||||||
viewport.add(lblSingletons, regularConstraints);
|
viewport.add(lblSingletons, regularConstraints);
|
||||||
|
|
||||||
final JLabel lblRemoveArtifacts = new NoteLabel("Disables artifact cards in generated decks.");
|
final JLabel lblRemoveArtifacts = new NoteLabel("Disables artifact cards in generated decks.");
|
||||||
cbRemoveArtifacts = new OptionsCheckBox("Remove Artifacts");
|
cbRemoveArtifacts = new OptionsCheckBox("Remove Artifacts");
|
||||||
cbRemoveArtifacts.setSelected(Singletons.getModel().getPreferences().isDeckGenRmvArtifacts());
|
cbRemoveArtifacts.setSelected(Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_ARTIFACTS));
|
||||||
viewport.add(cbRemoveArtifacts, regularConstraints);
|
viewport.add(cbRemoveArtifacts, regularConstraints);
|
||||||
viewport.add(lblRemoveArtifacts, regularConstraints);
|
viewport.add(lblRemoveArtifacts, regularConstraints);
|
||||||
|
|
||||||
@@ -109,25 +110,25 @@ public class ViewSettings extends JScrollPane {
|
|||||||
viewport.add(lblTitleUI, sectionConstraints);
|
viewport.add(lblTitleUI, sectionConstraints);
|
||||||
|
|
||||||
cbAnte = new OptionsCheckBox("Play for Ante");
|
cbAnte = new OptionsCheckBox("Play for Ante");
|
||||||
cbAnte.setSelected(Singletons.getModel().getPreferences().isPlayForAnte());
|
cbAnte.setSelected(Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE));
|
||||||
final JLabel lblAnte = new NoteLabel("Determines whether or not the game is played for ante.");
|
final JLabel lblAnte = new NoteLabel("Determines whether or not the game is played for ante.");
|
||||||
viewport.add(cbAnte, regularConstraints);
|
viewport.add(cbAnte, regularConstraints);
|
||||||
viewport.add(lblAnte, regularConstraints);
|
viewport.add(lblAnte, regularConstraints);
|
||||||
|
|
||||||
cbUploadDraft = new OptionsCheckBox("Upload Draft Pics");
|
cbUploadDraft = new OptionsCheckBox("Upload Draft Pics");
|
||||||
cbUploadDraft.setSelected(Singletons.getModel().getPreferences().isUploadDraftAI());
|
cbUploadDraft.setSelected(Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_UPLOAD_DRAFT));
|
||||||
final JLabel lblUploadDraft = new NoteLabel("Sends draft picks to Forge servers for analysis, to improve draft AI.");
|
final JLabel lblUploadDraft = new NoteLabel("Sends draft picks to Forge servers for analysis, to improve draft AI.");
|
||||||
viewport.add(cbUploadDraft, regularConstraints);
|
viewport.add(cbUploadDraft, regularConstraints);
|
||||||
viewport.add(lblUploadDraft, regularConstraints);
|
viewport.add(lblUploadDraft, regularConstraints);
|
||||||
|
|
||||||
cbStackLand = new OptionsCheckBox("Stack AI Land");
|
cbStackLand = new OptionsCheckBox("Stack AI Land");
|
||||||
cbStackLand.setSelected(Singletons.getModel().getPreferences().isStackAiLand());
|
cbStackLand.setSelected(Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_SMOOTH_LAND));
|
||||||
final JLabel lblStackLand = new NoteLabel("Minimizes mana lock in AI hands, giving a slight advantage to computer.");
|
final JLabel lblStackLand = new NoteLabel("Minimizes mana lock in AI hands, giving a slight advantage to computer.");
|
||||||
viewport.add(cbStackLand, regularConstraints);
|
viewport.add(cbStackLand, regularConstraints);
|
||||||
viewport.add(lblStackLand, regularConstraints);
|
viewport.add(lblStackLand, regularConstraints);
|
||||||
|
|
||||||
cbDevMode = new OptionsCheckBox(ForgeProps.getLocalized(NewGameText.DEV_MODE));
|
cbDevMode = new OptionsCheckBox(ForgeProps.getLocalized(NewGameText.DEV_MODE));
|
||||||
cbDevMode.setSelected(Singletons.getModel().getPreferences().isDeveloperMode());
|
cbDevMode.setSelected(Singletons.getModel().getPreferences().getPrefBoolean(FPref.DEV_MODE_ENABLED));
|
||||||
final JLabel lblDevMode = new NoteLabel("Enables menu with functions for testing during development.");
|
final JLabel lblDevMode = new NoteLabel("Enables menu with functions for testing during development.");
|
||||||
viewport.add(cbDevMode, regularConstraints);
|
viewport.add(cbDevMode, regularConstraints);
|
||||||
viewport.add(lblDevMode, regularConstraints);
|
viewport.add(lblDevMode, regularConstraints);
|
||||||
@@ -143,7 +144,7 @@ public class ViewSettings extends JScrollPane {
|
|||||||
|
|
||||||
lstChooseSkin = new FList();
|
lstChooseSkin = new FList();
|
||||||
lstChooseSkin.setListData(FSkin.getSkins().toArray(new String[0]));
|
lstChooseSkin.setListData(FSkin.getSkins().toArray(new String[0]));
|
||||||
lstChooseSkin.setSelectedValue(Singletons.getModel().getPreferences().getSkin(), true);
|
lstChooseSkin.setSelectedValue(Singletons.getModel().getPreferences().getPref(FPref.UI_SKIN), true);
|
||||||
lstChooseSkin.ensureIndexIsVisible(lstChooseSkin.getSelectedIndex());
|
lstChooseSkin.ensureIndexIsVisible(lstChooseSkin.getSelectedIndex());
|
||||||
viewport.add(new FScrollPane(lstChooseSkin), "h 60px!, w 150px!, gap 10% 0 0 2%, wrap");
|
viewport.add(new FScrollPane(lstChooseSkin), "h 60px!, w 150px!, gap 10% 0 0 2%, wrap");
|
||||||
|
|
||||||
@@ -156,19 +157,19 @@ public class ViewSettings extends JScrollPane {
|
|||||||
|
|
||||||
final JLabel lblRandomFoil = new NoteLabel("Adds foiled effects to random cards.");
|
final JLabel lblRandomFoil = new NoteLabel("Adds foiled effects to random cards.");
|
||||||
cbRandomFoil = new OptionsCheckBox("Random Foil");
|
cbRandomFoil = new OptionsCheckBox("Random Foil");
|
||||||
cbRandomFoil.setSelected(Singletons.getModel().getPreferences().isRandCFoil());
|
cbRandomFoil.setSelected(Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_RANDOM_FOIL));
|
||||||
viewport.add(cbRandomFoil, regularConstraints);
|
viewport.add(cbRandomFoil, regularConstraints);
|
||||||
viewport.add(lblRandomFoil, regularConstraints);
|
viewport.add(lblRandomFoil, regularConstraints);
|
||||||
|
|
||||||
final JLabel lblScaleLarger = new NoteLabel("Allows card pictures to be expanded larger than their original size.");
|
final JLabel lblScaleLarger = new NoteLabel("Allows card pictures to be expanded larger than their original size.");
|
||||||
cbScaleLarger = new OptionsCheckBox("Scale Image Larger");
|
cbScaleLarger = new OptionsCheckBox("Scale Image Larger");
|
||||||
cbScaleLarger.setSelected(Singletons.getModel().getPreferences().isScaleLargerThanOriginal());
|
cbScaleLarger.setSelected(Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_SCALE_LARGER));
|
||||||
viewport.add(cbScaleLarger, regularConstraints);
|
viewport.add(cbScaleLarger, regularConstraints);
|
||||||
viewport.add(lblScaleLarger, regularConstraints);
|
viewport.add(lblScaleLarger, regularConstraints);
|
||||||
|
|
||||||
final JLabel lblTextMana = new NoteLabel("Overlays each card with basic card-specific information.");
|
final JLabel lblTextMana = new NoteLabel("Overlays each card with basic card-specific information.");
|
||||||
cbTextMana = new OptionsCheckBox("Text / Mana Overlay");
|
cbTextMana = new OptionsCheckBox("Text / Mana Overlay");
|
||||||
cbTextMana.setSelected(Singletons.getModel().getPreferences().isCardOverlay());
|
cbTextMana.setSelected(Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_CARD_OVERLAY));
|
||||||
viewport.add(cbTextMana, regularConstraints);
|
viewport.add(cbTextMana, regularConstraints);
|
||||||
viewport.add(lblTextMana, regularConstraints);
|
viewport.add(lblTextMana, regularConstraints);
|
||||||
|
|
||||||
@@ -264,8 +265,8 @@ public class ViewSettings extends JScrollPane {
|
|||||||
private class CardSizeRadio extends OptionsRadio {
|
private class CardSizeRadio extends OptionsRadio {
|
||||||
public CardSizeRadio(String txt0) {
|
public CardSizeRadio(String txt0) {
|
||||||
super(txt0);
|
super(txt0);
|
||||||
if (Singletons.getModel().getPreferences().getCardSize()
|
if (Singletons.getModel().getPreferences().getPref(FPref.UI_CARD_SIZE)
|
||||||
.toString().equalsIgnoreCase(txt0)) {
|
.equalsIgnoreCase(txt0)) {
|
||||||
setSelected(true);
|
setSelected(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +337,7 @@ public class ViewSettings extends JScrollPane {
|
|||||||
super();
|
super();
|
||||||
this.setEditable(false);
|
this.setEditable(false);
|
||||||
this.setFont(skin.getFont(14));
|
this.setFont(skin.getFont(14));
|
||||||
this.setCodeString(Singletons.getModel().getPreferences().getKeyboardShortcut(s0.getPrefKey()));
|
this.setCodeString(Singletons.getModel().getPreferences().getPref(s0.getPrefKey()));
|
||||||
|
|
||||||
this.addKeyListener(new KeyAdapter() {
|
this.addKeyListener(new KeyAdapter() {
|
||||||
@Override
|
@Override
|
||||||
@@ -353,7 +354,7 @@ public class ViewSettings extends JScrollPane {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void focusLost(final FocusEvent e) {
|
public void focusLost(final FocusEvent e) {
|
||||||
Singletons.getModel().getPreferences().setKeyboardShortcut(
|
Singletons.getModel().getPreferences().setPref(
|
||||||
s0.getPrefKey(), getCodeString());
|
s0.getPrefKey(), getCodeString());
|
||||||
Singletons.getModel().getPreferences().save();
|
Singletons.getModel().getPreferences().save();
|
||||||
s0.attach();
|
s0.attach();
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ import forge.card.spellability.SpellAbilityStackInstance;
|
|||||||
import forge.control.match.ControlTabber;
|
import forge.control.match.ControlTabber;
|
||||||
import forge.gui.ForgeAction;
|
import forge.gui.ForgeAction;
|
||||||
import forge.gui.MultiLineLabelUI;
|
import forge.gui.MultiLineLabelUI;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.properties.NewConstants;
|
import forge.properties.NewConstants;
|
||||||
import forge.view.GuiTopLevel;
|
import forge.view.GuiTopLevel;
|
||||||
import forge.view.toolbox.FPanel;
|
import forge.view.toolbox.FPanel;
|
||||||
@@ -428,7 +429,7 @@ public class ViewTabber extends FRoundedPanel {
|
|||||||
} else {
|
} else {
|
||||||
temp[5].setText("");
|
temp[5].setText("");
|
||||||
}
|
}
|
||||||
if (Singletons.getModel().getPreferences().isPlayForAnte()) {
|
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE)) {
|
||||||
CardList list = p0.getCardsIn(Zone.Ante);
|
CardList list = p0.getCardsIn(Zone.Ante);
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Ante'd: ");
|
sb.append("Ante'd: ");
|
||||||
|
|||||||
Reference in New Issue
Block a user