Close #98: 30s refresh for habit puzzles

This commit is contained in:
2022-07-26 17:00:11 +00:00
parent eee25cfdf4
commit db99dbc939
2 changed files with 11 additions and 2 deletions

View File

@@ -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))

View File

@@ -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);
}
}