feat: Add tests for Wolf3dGuiApp and refactor game data picker management
- Introduced unit tests for the Wolf3dGuiApp to ensure proper directory configuration and audio management. - Refactored the GameDataPickerManager to streamline directory and file selection processes. - Removed obsolete GameDataPickerManager and Wolf3dAppManager classes to simplify the architecture. - Enhanced the Wolf3dFlutterEngine to improve game version handling during save loading. - Updated existing tests to reflect changes in the game data management structure. - Removed unnecessary dependencies and cleaned up the codebase for better maintainability. Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -330,17 +330,21 @@ class WolfEngine {
|
||||
final SaveGameFile file = saveGameCodec.decode(bytes);
|
||||
GameSessionSnapshot snapshot = file.snapshot;
|
||||
|
||||
int gameIndex = snapshot.currentGameIndex;
|
||||
if (gameIndex < 0 || gameIndex >= _availableGames.length) {
|
||||
int gameIndex = _availableGames.indexWhere(
|
||||
(game) =>
|
||||
game.version == file.gameVersion &&
|
||||
game.dataVersion.name == file.dataVersionName,
|
||||
);
|
||||
if (gameIndex < 0) {
|
||||
gameIndex = _availableGames.indexWhere(
|
||||
(game) =>
|
||||
game.version == file.gameVersion &&
|
||||
game.dataVersion.name == file.dataVersionName,
|
||||
(game) => game.version == file.gameVersion,
|
||||
);
|
||||
if (gameIndex < 0) {
|
||||
gameIndex = _availableGames.indexWhere(
|
||||
(game) => game.version == file.gameVersion,
|
||||
);
|
||||
}
|
||||
if (gameIndex < 0) {
|
||||
final int snapshotGameIndex = snapshot.currentGameIndex;
|
||||
if (snapshotGameIndex >= 0 &&
|
||||
snapshotGameIndex < _availableGames.length) {
|
||||
gameIndex = snapshotGameIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user