Make puzzleWidth and puzzleHeight variable
This commit is contained in:
@@ -29,7 +29,9 @@ typedef Entry = {
|
|||||||
|
|
||||||
typedef RewardFile = {
|
typedef RewardFile = {
|
||||||
path: String,
|
path: String,
|
||||||
startingPoints: Int
|
startingPoints: Int,
|
||||||
|
puzzleWidth: Int,
|
||||||
|
puzzleHeight: Int
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Puzzle = {
|
typedef Puzzle = {
|
||||||
|
@@ -30,9 +30,11 @@
|
|||||||
((when (= lastHeader "FILES") (Some line))
|
((when (= lastHeader "FILES") (Some line))
|
||||||
(rewardFiles.push
|
(rewardFiles.push
|
||||||
(let [parts (line.split " ")
|
(let [parts (line.split " ")
|
||||||
|
puzzleHeight (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))))
|
(objectWith path startingPoints puzzleWidth puzzleHeight))))
|
||||||
((Some line)
|
((Some line)
|
||||||
(.push
|
(.push
|
||||||
(case lastHeader
|
(case lastHeader
|
||||||
@@ -138,7 +140,7 @@
|
|||||||
"${label.label} $(* "|" label.points)") "/")")
|
"${label.label} $(* "|" label.points)") "/")")
|
||||||
|
|
||||||
(function :String stringifyRewardFile [:RewardFile rewardFile]
|
(function :String stringifyRewardFile [:RewardFile rewardFile]
|
||||||
"${rewardFile.path} ${rewardFile.startingPoints}")
|
"${rewardFile.path} ${rewardFile.startingPoints} ${rewardFile.puzzleWidth} ${rewardFile.puzzleHeight}")
|
||||||
|
|
||||||
(method :Void save []
|
(method :Void save []
|
||||||
(localVar &mut content "DAILY\n-----\n")
|
(localVar &mut content "DAILY\n-----\n")
|
||||||
@@ -217,6 +219,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]
|
(method addRewardFile [path startingPoints puzzleWidth puzzleHeight]
|
||||||
(rewardFiles.push (objectWith path startingPoints))
|
(rewardFiles.push (objectWith path startingPoints puzzleWidth puzzleHeight))
|
||||||
(save))
|
(save))
|
@@ -111,9 +111,9 @@
|
|||||||
(defAlias &ident EDGE_LEEWAY 25)
|
(defAlias &ident EDGE_LEEWAY 25)
|
||||||
(defAlias &ident BUBBLE_SIZE 15)
|
(defAlias &ident BUBBLE_SIZE 15)
|
||||||
|
|
||||||
(var PUZZLE_WIDTH 6)
|
(defAlias &ident PUZZLE_WIDTH .puzzleWidth (nth model.rewardFiles rewardFileIndex))
|
||||||
(var PUZZLE_HEIGHT 5)
|
(defAlias &ident PUZZLE_HEIGHT .puzzleHeight (nth model.rewardFiles rewardFileIndex))
|
||||||
(var TOTAL_PIECES (* PUZZLE_WIDTH PUZZLE_HEIGHT))
|
(defAlias &ident TOTAL_PIECES (* PUZZLE_WIDTH PUZZLE_HEIGHT))
|
||||||
(prop &mut :FlxSprite rewardSprite null)
|
(prop &mut :FlxSprite rewardSprite null)
|
||||||
(prop &mut :FlxTypedGroup<KissExtendedSprite> rewardSprites null)
|
(prop &mut :FlxTypedGroup<KissExtendedSprite> rewardSprites null)
|
||||||
(prop &mut :Map<Int,KissExtendedSprite> matchingPiecesLeft (new Map))
|
(prop &mut :Map<Int,KissExtendedSprite> matchingPiecesLeft (new Map))
|
||||||
@@ -467,7 +467,8 @@
|
|||||||
(nextPuzzleChoiceGroup.add (new FlxButton (+ x text.width) y "CHOOSE" ->:Void {
|
(nextPuzzleChoiceGroup.add (new FlxButton (+ x text.width) y "CHOOSE" ->:Void {
|
||||||
(remove nextPuzzleChoiceGroup)
|
(remove nextPuzzleChoiceGroup)
|
||||||
(set nextPuzzleChoiceGroup null)
|
(set nextPuzzleChoiceGroup null)
|
||||||
(model.addRewardFile np.path nextStartingPoints)
|
// TODO generate a good width and height while respecting user settings
|
||||||
|
(model.addRewardFile np.path nextStartingPoints 6 5)
|
||||||
(setModel model)
|
(setModel model)
|
||||||
|
|
||||||
}))))
|
}))))
|
||||||
|
Reference in New Issue
Block a user