piecesPerPoint
This commit is contained in:
@@ -31,7 +31,8 @@ typedef RewardFile = {
|
|||||||
path: String,
|
path: String,
|
||||||
startingPoints: Int,
|
startingPoints: Int,
|
||||||
puzzleWidth: Int,
|
puzzleWidth: Int,
|
||||||
puzzleHeight: Int
|
puzzleHeight: Int,
|
||||||
|
piecesPerPoint: Int
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Puzzle = {
|
typedef Puzzle = {
|
||||||
|
@@ -30,11 +30,12 @@
|
|||||||
((when (= lastHeader "FILES") (Some line))
|
((when (= lastHeader "FILES") (Some line))
|
||||||
(rewardFiles.push
|
(rewardFiles.push
|
||||||
(let [parts (line.split " ")
|
(let [parts (line.split " ")
|
||||||
|
piecesPerPoint (Std.parseInt (parts.pop))
|
||||||
puzzleHeight (Std.parseInt (parts.pop))
|
puzzleHeight (Std.parseInt (parts.pop))
|
||||||
puzzleWidth (Std.parseInt (parts.pop))
|
puzzleWidth (Std.parseInt (parts.pop))
|
||||||
startingPoints (Std.parseInt (parts.pop))
|
startingPoints (Std.parseInt (parts.pop))
|
||||||
path (parts.join " ")]
|
path (parts.join " ")]
|
||||||
(objectWith path startingPoints puzzleWidth puzzleHeight))))
|
(objectWith path startingPoints puzzleWidth puzzleHeight piecesPerPoint))))
|
||||||
((Some line)
|
((Some line)
|
||||||
(.push
|
(.push
|
||||||
(case lastHeader
|
(case lastHeader
|
||||||
@@ -140,7 +141,7 @@
|
|||||||
"${label.label} $(* "|" label.points)") "/")")
|
"${label.label} $(* "|" label.points)") "/")")
|
||||||
|
|
||||||
(function :String stringifyRewardFile [:RewardFile rewardFile]
|
(function :String stringifyRewardFile [:RewardFile rewardFile]
|
||||||
"${rewardFile.path} ${rewardFile.startingPoints} ${rewardFile.puzzleWidth} ${rewardFile.puzzleHeight}")
|
"${rewardFile.path} ${rewardFile.startingPoints} ${rewardFile.puzzleWidth} ${rewardFile.puzzleHeight} ${rewardFile.piecesPerPoint}")
|
||||||
|
|
||||||
(method :Void save []
|
(method :Void save []
|
||||||
(localVar &mut content "DAILY\n-----\n")
|
(localVar &mut content "DAILY\n-----\n")
|
||||||
@@ -219,6 +220,6 @@
|
|||||||
(objectWith [labels (for label labels (objectWith [points 0] label))] type))
|
(objectWith [labels (for label labels (objectWith [points 0] label))] type))
|
||||||
(save))
|
(save))
|
||||||
|
|
||||||
(method addRewardFile [path startingPoints puzzleWidth puzzleHeight]
|
(method addRewardFile [path startingPoints puzzleWidth puzzleHeight piecesPerPoint]
|
||||||
(rewardFiles.push (objectWith path startingPoints puzzleWidth puzzleHeight))
|
(rewardFiles.push (objectWith path startingPoints puzzleWidth puzzleHeight piecesPerPoint))
|
||||||
(save))
|
(save))
|
@@ -154,8 +154,10 @@
|
|||||||
(set currentRewardFile (nth m.rewardFiles i))
|
(set currentRewardFile (nth m.rewardFiles i))
|
||||||
(set maxRewardFile i)
|
(set maxRewardFile i)
|
||||||
(when (>= ++i m.rewardFiles.length)
|
(when (>= ++i m.rewardFiles.length)
|
||||||
(let [lastStartingPoints .startingPoints (nth m.rewardFiles --i)
|
--i
|
||||||
nextStartingPoints (+ lastStartingPoints TOTAL_PIECES)]
|
(let [lastStartingPoints .startingPoints (nth m.rewardFiles i)
|
||||||
|
piecesPerPoint .piecesPerPoint (nth m.rewardFiles i)
|
||||||
|
nextStartingPoints (+ lastStartingPoints (Math.ceil (/ TOTAL_PIECES piecesPerPoint)))]
|
||||||
(when (> p nextStartingPoints)
|
(when (> p nextStartingPoints)
|
||||||
(set puzzleUnlocked nextStartingPoints))
|
(set puzzleUnlocked nextStartingPoints))
|
||||||
(break)))))
|
(break)))))
|
||||||
@@ -215,7 +217,7 @@
|
|||||||
(r.shuffle jigsaw.jigs)
|
(r.shuffle jigsaw.jigs)
|
||||||
(localVar spriteGrid (for y (range PUZZLE_HEIGHT) (for x (range PUZZLE_WIDTH) null)))
|
(localVar spriteGrid (for y (range PUZZLE_HEIGHT) (for x (range PUZZLE_WIDTH) null)))
|
||||||
(localVar indexGrid (for y (range PUZZLE_HEIGHT) (for x (range PUZZLE_WIDTH) 0)))
|
(localVar indexGrid (for y (range PUZZLE_HEIGHT) (for x (range PUZZLE_WIDTH) 0)))
|
||||||
(doFor i (range (min TOTAL_PIECES (- p currentRewardFile.startingPoints)))
|
(doFor i (range (min TOTAL_PIECES (* currentRewardFile.piecesPerPoint (- p currentRewardFile.startingPoints))))
|
||||||
(let [jig (nth jigsaw.jigs i)
|
(let [jig (nth jigsaw.jigs i)
|
||||||
pos (ifLet [point (dictGet (the Map<Int,FlxPoint> save.data.storedPositions) i)]
|
pos (ifLet [point (dictGet (the Map<Int,FlxPoint> save.data.storedPositions) i)]
|
||||||
point
|
point
|
||||||
@@ -298,7 +300,7 @@
|
|||||||
(set entryWindow (new SimpleWindow "" (FlxColor.fromRGBFloat 0 0 0 0.5) FlxColor.WHITE 0.9 0.9))
|
(set entryWindow (new SimpleWindow "" (FlxColor.fromRGBFloat 0 0 0 0.5) FlxColor.WHITE 0.9 0.9))
|
||||||
(set entryWindow.cameras [uiCamera])
|
(set entryWindow.cameras [uiCamera])
|
||||||
(set entryWindow.textColor FlxColor.LIME)
|
(set entryWindow.textColor FlxColor.LIME)
|
||||||
(_makeText "Puzzle #$(+ 1 rewardFileIndex) / ${model.rewardFiles.length}" (- TOTAL_PIECES (- p currentRewardFile.startingPoints)))
|
(_makeText "Puzzle #$(+ 1 rewardFileIndex) / ${model.rewardFiles.length}" (max 0 (- TOTAL_PIECES (* currentRewardFile.piecesPerPoint (- p currentRewardFile.startingPoints)))))
|
||||||
(set entryWindow.textColor FlxColor.ORANGE)
|
(set entryWindow.textColor FlxColor.ORANGE)
|
||||||
(map (m.activeDailyEntries) makeText)
|
(map (m.activeDailyEntries) makeText)
|
||||||
(set entryWindow.textColor FlxColor.GREEN)
|
(set entryWindow.textColor FlxColor.GREEN)
|
||||||
|
Reference in New Issue
Block a user