Project 'android/wordguessing' was moved to 'android/org.benoitharrault.wordguessing'. Please update any links and bookmarks that may still have the old path.
Select Git revision
game.dart 5.41 KiB
import 'package:wordguessing/config/default_game_settings.dart';
import 'package:wordguessing/data/fetch_data_helper.dart';
import 'package:wordguessing/models/data/word.dart';
import 'package:wordguessing/models/settings/settings_game.dart';
import 'package:wordguessing/models/settings/settings_global.dart';
import 'package:wordguessing/utils/tools.dart';
class Game {
Game({
// Settings
required this.gameSettings,
required this.globalSettings,
// State
this.isRunning = false,
this.isStarted = false,
this.isFinished = false,
this.animationInProgress = false,
// Base data
required this.word,
required this.otherWords,
required this.images,
// Game data
this.recentWordsKeys = const [],
this.questionsCount = 0,
this.goodAnswers = 0,
this.wrongAnswers = 0,
});
// Settings
final GameSettings gameSettings;
final GlobalSettings globalSettings;
// State
bool isRunning;
bool isStarted;
bool isFinished;
bool animationInProgress;
// Base data
Word word;
List<Word> otherWords;
List<Word> images;
// Game data
List<String> recentWordsKeys;
int questionsCount;
int goodAnswers;
int wrongAnswers;
factory Game.createEmpty() {
return Game(
// Settings
gameSettings: GameSettings.createDefault(),
globalSettings: GlobalSettings.createDefault(),
// Base data
word: Word.createEmpty(),
otherWords: [],
images: [],
// Game data
recentWordsKeys: [],
);
}
factory Game.createNew({
GameSettings? gameSettings,
GlobalSettings? globalSettings,
}) {