habit game choose next puzzle pack
This commit is contained in:
@@ -148,7 +148,8 @@
|
||||
(set shortcutHandler (new FlxKeyShortcutHandler))
|
||||
|
||||
(let [p (m.totalPoints)
|
||||
&mut i 0 ]
|
||||
&mut i 0
|
||||
&mut puzzleUnlocked -1]
|
||||
// Find, load, and add the current reward image as big as possible:
|
||||
(unless currentRewardFile
|
||||
(set currentRewardFile (nth m.rewardFiles 0))
|
||||
@@ -159,14 +160,9 @@
|
||||
(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))))))
|
||||
(when (> p nextStartingPoints)
|
||||
(set puzzleUnlocked nextStartingPoints))
|
||||
(break)))))
|
||||
|
||||
(set save (new FlxSave))
|
||||
(save.bind currentRewardFile.path)
|
||||
@@ -321,7 +317,10 @@
|
||||
(map (m.activeTodoEntries) makeText)
|
||||
(set _color FlxColor.GRAY)
|
||||
(_makeText "[SPACE] Cycle background color" 0)
|
||||
(add entryTexts))
|
||||
(add entryTexts)
|
||||
|
||||
(when !(= puzzleUnlocked -1)
|
||||
(startPuzzlePackChoice puzzleUnlocked)))
|
||||
|
||||
(doFor e (m.allEntries)
|
||||
(when (HabitModel.isActive e)
|
||||
@@ -473,4 +472,30 @@
|
||||
(unless (contains collected piece)
|
||||
(collected.push piece)
|
||||
(recursivelyConnectedPieces piece collected))))
|
||||
collected)
|
||||
collected)
|
||||
|
||||
(prop &mut :FlxGroup nextPuzzleChoiceGroup null)
|
||||
|
||||
(method startPuzzlePackChoice [nextStartingPoints]
|
||||
(unless nextPuzzleChoiceGroup
|
||||
(set nextPuzzleChoiceGroup (new FlxGroup))
|
||||
(set nextPuzzleChoiceGroup.cameras [uiCamera])
|
||||
|
||||
// TODO position these aesthetically with a partly transparent background behind them
|
||||
// like the habit ui window should also have
|
||||
(let [x 0 &mut y 0]
|
||||
(doFor pack (availablePacks model)
|
||||
(let [text (new FlxText x y 0 "$(haxe.io.Path.withoutDirectory pack.path): ${pack.puzzlesDone}/${pack.puzzlesTotal}" textSize)]
|
||||
// TODO not that color though
|
||||
(set text.color FlxColor.LIME)
|
||||
(nextPuzzleChoiceGroup.add text)
|
||||
(whenLet [(Some np) pack.nextPuzzle]
|
||||
(nextPuzzleChoiceGroup.add (new FlxButton (+ x text.width) y "CHOOSE" ->:Void {
|
||||
(remove nextPuzzleChoiceGroup)
|
||||
(set nextPuzzleChoiceGroup null)
|
||||
(model.addRewardFile np.path nextStartingPoints)
|
||||
(setModel model)
|
||||
|
||||
}))))
|
||||
(+= y textSize)))
|
||||
(add nextPuzzleChoiceGroup)))
|
||||
|
Reference in New Issue
Block a user