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