File tree Expand file tree Collapse file tree 3 files changed +5
-4
lines changed
Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,6 @@ class _GameScreenState extends State<GameScreen> {
9292 (this .gameHistory['success' ] * costs['success' ]) +
9393 (this .gameHistory['fail' ] * costs['fail' ]);
9494 this .gameHistory['score' ] = score > 0 ? (score) : 0 ;
95- print (this .gameHistory);
9695 }
9796
9897 void updateScores () {
Original file line number Diff line number Diff line change 11import 'dart:convert' ;
22import 'package:numbers/service/RecentScoreService.dart' ;
3+ import 'package:numbers/utils/Config.dart' ;
34import 'package:shared_preferences/shared_preferences.dart' ;
45
56class RecentScoreStore {
67 SharedPreferences prefs;
78
89 final String scoreKey = 'recentScore' ;
9- final maxStoreLength = 3 ;
10+ final maxStoreLength = maxKeepGameHistoryCount ;
1011
1112 init () async {
1213 if (this .prefs == null ) {
@@ -15,12 +16,12 @@ class RecentScoreStore {
1516 }
1617
1718 updateRecentScore (int score) async {
18-
1919 await this .init ();
2020
2121 List recentScores = await this .getRecentScore ();
2222
23- RecentScore newScore = RecentScore .manualPush (score.toString (), DateTime .now ().millisecondsSinceEpoch.toString ());
23+ RecentScore newScore = RecentScore .manualPush (
24+ score.toString (), DateTime .now ().millisecondsSinceEpoch.toString ());
2425
2526 recentScores.insert (0 , newScore);
2627
Original file line number Diff line number Diff line change 11const int gameDuration = 10 ;
22const Map costs = {'success' : 1000 , 'fail' : - 500 , 'block' : 100 };
3+ const int maxKeepGameHistoryCount = 6 ;
You can’t perform that action at this time.
0 commit comments