Close #98: 30s refresh for habit puzzles
This commit is contained in:
@@ -84,6 +84,8 @@
|
||||
(prop &mut :FlxExtendedSprite draggingSprite null)
|
||||
(prop &mut :FlxPoint draggingLastPos null)
|
||||
|
||||
// Main.hx sets off 99% of the app's logic by parsing the model file and calling setModel on startup and on a 30s loop:
|
||||
|
||||
(method setModel [m &opt :RewardFile currentRewardFile]
|
||||
(set model m)
|
||||
(set shortcutHandler (new FlxKeyShortcutHandler))
|
||||
|
@@ -3,6 +3,7 @@ package;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxGame;
|
||||
import openfl.display.Sprite;
|
||||
import flixel.util.FlxTimer;
|
||||
|
||||
class Main extends Sprite
|
||||
{
|
||||
@@ -16,7 +17,13 @@ class Main extends Sprite
|
||||
} else {
|
||||
"habits/default.txt";
|
||||
};
|
||||
t.setModel(new HabitModel(habitFile));
|
||||
t.model.save();
|
||||
function reloadModel(_) {
|
||||
t.setModel(new HabitModel(habitFile));
|
||||
t.model.save();
|
||||
}
|
||||
reloadModel(null);
|
||||
new FlxTimer().start(30, reloadModel, 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user