You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Bowl_in/Sources/bowlin_project/lib/model/StubManager/GameManager.dart

55 lines
1.1 KiB

library StubLib;
import '../Game.dart';
import '../IGameManager.dart';
import '../GameDetail.dart';
import '../Player.dart';
import '../User.dart';
import '../Guest.dart';
import 'StubData.dart';
import 'package:uuid/uuid.dart';
class GameManager extends IGameManager {
List<GameDetail> games = [];
final StubData parent;
// Constructor
GameManager(this.parent);
// Methods
GameDetail getGameById(Uuid id) {
for (var element in parent.gameDetails) {
if (element.id == id) {
return element;
}
}
throw Exception("Game not found.");
}
List<GameDetail> getGamesByPlayerId(Uuid id) {
List<GameDetail> games = [];
for (var element in parent.gameDetails) {
if (element.players.contains(id)) {
games.add(element);
}
}
throw Exception("Game not found.");
}
List<GameDetail> getGamesByPlayer(Player user) {
return [];
}
List<GameDetail> getGamesByPlayers(List<Player> users) {
return [];
}
List<User> getPlayersByIdGame(Uuid id) {
return [];
}
Map<int, Uuid> getRankByIdGame(Uuid id) {
return {};
}
}