magarena/src/magic/data/DeckType.java

74 lines
1.9 KiB
Java
Raw Normal View History

2014-09-03 22:37:26 -07:00
package magic.data;
import java.nio.file.Path;
2014-09-03 22:37:26 -07:00
import java.util.EnumSet;
import java.util.Set;
2020-01-15 12:02:42 -08:00
2016-10-26 01:46:59 -07:00
import magic.translate.MText;
import magic.utility.DeckUtils;
2014-09-03 22:37:26 -07:00
/**
* Ways to group decks.
* <p>
* Be careful about renaming the enum value since this is used
* in settings files such as those used to store new duel configuration.
*/
public enum DeckType {
// TODO: Bookmarked("Bookmarked"), // decks tagged by player
2017-02-19 13:39:00 -08:00
Random(UIText._S1),
Preconstructed(UIText._S2),
Custom(UIText._S3),
Firemind(UIText._S4),
PopularDecks(UIText._S5),
WinningDecks(UIText._S6),
RecentDecks(UIText._S7)
2014-09-03 22:37:26 -07:00
;
2017-02-19 13:39:00 -08:00
private final String caption;
2014-09-03 22:37:26 -07:00
private DeckType(final String caption) {
2017-02-19 13:39:00 -08:00
this.caption = caption;
2014-09-03 22:37:26 -07:00
}
@Override
public String toString() {
2017-02-19 13:39:00 -08:00
return MText.get(caption);
2014-09-03 22:37:26 -07:00
}
public static Path getDeckFolder(final DeckType deckType) {
switch (deckType) {
case Preconstructed: return DeckUtils.getPrebuiltDecksFolder();
case Firemind: return DeckUtils.getFiremindDecksFolder();
default: return DeckUtils.getDecksFolder();
}
}
public static final Set<DeckType> getPredefinedDecks() {
return GeneralConfig.isGameStatsOn()
? EnumSet.range(Preconstructed, RecentDecks)
: EnumSet.range(Preconstructed, Firemind);
}
public static final DeckType[] getDuelDeckTypes() {
return EnumSet.range(Random, Firemind).toArray(new DeckType[0]);
}
2014-09-03 22:37:26 -07:00
}
2017-02-19 13:39:00 -08:00
/**
* translatable UI text (prefix with _S).
*/
final class UIText {
static final String _S1 = "Random";
static final String _S2 = "Prebuilt decks";
static final String _S3 = "Player decks";
static final String _S4 = "Firemind top decks";
static final String _S5 = "Popular decks";
static final String _S6 = "Winning decks";
static final String _S7 = "Recently played decks";
private UIText() {}
}