Add Tutorial mode

This commit is contained in:
friarsol
2020-07-01 23:13:38 -04:00
parent 718e745579
commit bd820bea5d
9 changed files with 292 additions and 11 deletions

View File

@@ -69,6 +69,7 @@ public final class ForgeConstants {
public static final String LANG_DIR = RES_DIR + "languages" + PATH_SEPARATOR;
public static final String EFFECTS_DIR = RES_DIR + "effects" + PATH_SEPARATOR;
public static final String PUZZLE_DIR = RES_DIR + "puzzle" + PATH_SEPARATOR;
public static final String TUTORIAL_DIR = RES_DIR + "tutorial" + PATH_SEPARATOR;
public static final String DECK_GEN_DIR = RES_DIR + "deckgendecks" + PATH_SEPARATOR;

View File

@@ -16,10 +16,10 @@ public class PuzzleIO {
public static final String SUFFIX_DATA = ".pzl";
public static final String SUFFIX_COMPLETE = ".complete";
public static ArrayList<Puzzle> loadPuzzles() {
public static ArrayList<Puzzle> loadPuzzles(String directory) {
String[] pList;
// get list of puzzles
final File pFolder = new File(ForgeConstants.PUZZLE_DIR);
final File pFolder = new File(directory);
if (!pFolder.exists()) {
throw new RuntimeException("Puzzles : folder not found -- folder is " + pFolder.getAbsolutePath());
}
@@ -33,7 +33,7 @@ public class PuzzleIO {
ArrayList<Puzzle> puzzles = Lists.newArrayList();
for (final String element : pList) {
if (element.endsWith(SUFFIX_DATA)) {
final List<String> pfData = FileUtil.readFile(ForgeConstants.PUZZLE_DIR + element);
final List<String> pfData = FileUtil.readFile(directory + element);
String filename = element.replace(SUFFIX_DATA, "");
boolean completed = FileUtil.doesFileExist(ForgeConstants.USER_PUZZLE_DIR + element.replace(SUFFIX_DATA, SUFFIX_COMPLETE));
@@ -48,9 +48,4 @@ public class PuzzleIO {
public static Map<String, List<String>> parsePuzzleSections(List<String> pfData) {
return FileSection.parseSections(pfData);
}
public static File getPuzzleFile(final String name) {
return new File(ForgeConstants.PUZZLE_DIR, name + SUFFIX_DATA);
}
}