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 datetime.DateTime;
|
||||
import datetime.DateTimeInterval;
|
||||
import haxe.ds.Option;
|
||||
|
||||
enum EntryType {
|
||||
Daily(daysOfWeek:Array<Int>, lastDayDone:String);
|
||||
@@ -31,5 +32,18 @@ typedef RewardFile = {
|
||||
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())
|
||||
class HabitModel {}
|
||||
|
@@ -215,4 +215,8 @@
|
||||
((Monthly _ _) monthlyEntries)
|
||||
(otherwise (throw "")))
|
||||
(objectWith [labels (for label labels (objectWith [points 0] label))] type))
|
||||
(save))
|
||||
|
||||
(method addRewardFile [path startingPoints]
|
||||
(rewardFiles.push (objectWith path startingPoints))
|
||||
(save))
|
@@ -26,11 +26,12 @@ import kiss.Prelude;
|
||||
import kiss.List;
|
||||
import kiss_tools.FlxKeyShortcutHandler;
|
||||
import HabitModel;
|
||||
import sys.FileSystem;
|
||||
import hx.strings.Strings;
|
||||
import datetime.DateTime;
|
||||
using kiss_flixel.CameraTools;
|
||||
using kiss_flixel.GroupTools;
|
||||
|
||||
import haxe.ds.Option;
|
||||
import jigsawx.JigsawPiece;
|
||||
import jigsawx.Jigsawx;
|
||||
import jigsawx.math.Vec2;
|
||||
|
@@ -4,6 +4,8 @@
|
||||
(prop &mut :FlxCamera pieceCamera)
|
||||
(prop &mut :FlxCamera uiCamera)
|
||||
|
||||
(load "PuzzlePacks.kiss")
|
||||
|
||||
(method &override :Void create []
|
||||
(#when debug
|
||||
(add cameraBounds))
|
||||
@@ -154,8 +156,17 @@
|
||||
(set rewardFileIndex i)
|
||||
(set currentRewardFile (nth m.rewardFiles i))
|
||||
(set maxRewardFile i)
|
||||
(if (>= ++i m.rewardFiles.length)
|
||||
(break))))
|
||||
(when (>= ++i m.rewardFiles.length)
|
||||
(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))
|
||||
(save.bind currentRewardFile.path)
|
||||
|
Reference in New Issue
Block a user