groundwork for puzzle pack detection & choosing next puzzle
This commit is contained in:
@@ -6,6 +6,7 @@ import kiss.Stream;
|
|||||||
import sys.io.File;
|
import sys.io.File;
|
||||||
import datetime.DateTime;
|
import datetime.DateTime;
|
||||||
import datetime.DateTimeInterval;
|
import datetime.DateTimeInterval;
|
||||||
|
import haxe.ds.Option;
|
||||||
|
|
||||||
enum EntryType {
|
enum EntryType {
|
||||||
Daily(daysOfWeek:Array<Int>, lastDayDone:String);
|
Daily(daysOfWeek:Array<Int>, lastDayDone:String);
|
||||||
@@ -31,5 +32,18 @@ typedef RewardFile = {
|
|||||||
startingPoints: Int
|
startingPoints: Int
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef Puzzle = {
|
||||||
|
path:Null<String>,
|
||||||
|
index:Int,
|
||||||
|
outOf:Int
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef PuzzlePack = {
|
||||||
|
path:String,
|
||||||
|
nextPuzzle:Option<Puzzle>,
|
||||||
|
puzzlesDone:Int,
|
||||||
|
puzzlesTotal:Int
|
||||||
|
};
|
||||||
|
|
||||||
@:build(kiss.Kiss.build())
|
@:build(kiss.Kiss.build())
|
||||||
class HabitModel {}
|
class HabitModel {}
|
||||||
|
@@ -215,4 +215,8 @@
|
|||||||
((Monthly _ _) monthlyEntries)
|
((Monthly _ _) monthlyEntries)
|
||||||
(otherwise (throw "")))
|
(otherwise (throw "")))
|
||||||
(objectWith [labels (for label labels (objectWith [points 0] label))] type))
|
(objectWith [labels (for label labels (objectWith [points 0] label))] type))
|
||||||
|
(save))
|
||||||
|
|
||||||
|
(method addRewardFile [path startingPoints]
|
||||||
|
(rewardFiles.push (objectWith path startingPoints))
|
||||||
(save))
|
(save))
|
@@ -26,11 +26,12 @@ import kiss.Prelude;
|
|||||||
import kiss.List;
|
import kiss.List;
|
||||||
import kiss_tools.FlxKeyShortcutHandler;
|
import kiss_tools.FlxKeyShortcutHandler;
|
||||||
import HabitModel;
|
import HabitModel;
|
||||||
|
import sys.FileSystem;
|
||||||
import hx.strings.Strings;
|
import hx.strings.Strings;
|
||||||
import datetime.DateTime;
|
import datetime.DateTime;
|
||||||
using kiss_flixel.CameraTools;
|
using kiss_flixel.CameraTools;
|
||||||
using kiss_flixel.GroupTools;
|
using kiss_flixel.GroupTools;
|
||||||
|
import haxe.ds.Option;
|
||||||
import jigsawx.JigsawPiece;
|
import jigsawx.JigsawPiece;
|
||||||
import jigsawx.Jigsawx;
|
import jigsawx.Jigsawx;
|
||||||
import jigsawx.math.Vec2;
|
import jigsawx.math.Vec2;
|
||||||
|
@@ -4,6 +4,8 @@
|
|||||||
(prop &mut :FlxCamera pieceCamera)
|
(prop &mut :FlxCamera pieceCamera)
|
||||||
(prop &mut :FlxCamera uiCamera)
|
(prop &mut :FlxCamera uiCamera)
|
||||||
|
|
||||||
|
(load "PuzzlePacks.kiss")
|
||||||
|
|
||||||
(method &override :Void create []
|
(method &override :Void create []
|
||||||
(#when debug
|
(#when debug
|
||||||
(add cameraBounds))
|
(add cameraBounds))
|
||||||
@@ -154,8 +156,17 @@
|
|||||||
(set rewardFileIndex i)
|
(set rewardFileIndex i)
|
||||||
(set currentRewardFile (nth m.rewardFiles i))
|
(set currentRewardFile (nth m.rewardFiles i))
|
||||||
(set maxRewardFile i)
|
(set maxRewardFile i)
|
||||||
(if (>= ++i m.rewardFiles.length)
|
(when (>= ++i m.rewardFiles.length)
|
||||||
(break))))
|
(let [lastStartingPoints .startingPoints (nth m.rewardFiles --i)
|
||||||
|
nextStartingPoints (+ lastStartingPoints TOTAL_PIECES)]
|
||||||
|
(if (> p nextStartingPoints)
|
||||||
|
{
|
||||||
|
// TODO give the player a puzzle pack choice using (availablePacks)
|
||||||
|
(m.addRewardFile .path (firstUnsolvedPuzzle m "puzzles/trentnelson") nextStartingPoints)
|
||||||
|
(setModel m)
|
||||||
|
(return)
|
||||||
|
}
|
||||||
|
(break))))))
|
||||||
|
|
||||||
(set save (new FlxSave))
|
(set save (new FlxSave))
|
||||||
(save.bind currentRewardFile.path)
|
(save.bind currentRewardFile.path)
|
||||||
|
Reference in New Issue
Block a user