addition of new class, in the model including the manager interfaces (with the abstract methods that go with it) and correction of errors
continuous-integration/drone/push Build is passing Details

pull/15/head
Emre KARTAL 2 years ago
parent cac321d92a
commit 83bbb3d6f7

@ -1,13 +1,13 @@
class Achievement { class Achievement {
String _name; String _name;
// Constructor
Achievement(this._name); Achievement(this._name);
// Getters and setters
String get name => _name; String get name => _name;
set name(String value) { set name(String value) {
_name = value; _name = value;
} }
} }

@ -1,22 +1,19 @@
import 'dart:ffi';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
import 'package:uuid/uuid_util.dart';
class Game { class Game {
Uuid _id; Uuid _id;
DateTime _time; DateTime _time;
int _pointsCurrentUser; int _pointsCurrentUser;
bool _isFinished; bool _isFinished;
List<String> _playerImages = <String>[]; List<String> _playerImages = [];
// Constructor
Game(this._id, this._time, this._pointsCurrentUser, this._isFinished, this._playerImages);
Game(this._id, this._time, this._players, this._winner); // Getters and setters
Uuid get id => _id;
get id => _id; set id(Uuid value) {
set id(value) {
_id = value; _id = value;
} }
@ -43,5 +40,4 @@ class Game {
set playerImages(List<String> value) { set playerImages(List<String> value) {
_playerImages = value; _playerImages = value;
} }
} }

@ -0,0 +1,82 @@
import 'package:uuid/uuid.dart';
import 'Player.dart';
import 'Round.dart';
class GameDetail {
Uuid _id;
DateTime _time;
Uuid _winner;
int _nbPoints;
bool _isFinished;
Round _currentRound;
Player _host;
List<Round> _rounds = [];
List<Player> _players = [];
// Constructor
GameDetail(
this._id,
this._time,
this._winner,
this._nbPoints,
this._isFinished,
this._currentRound,
this._host,
this._rounds,
this._players);
// Getters and setters
Uuid get id => _id;
set id(Uuid value) {
_id = value;
}
DateTime get time => _time;
set time(DateTime value) {
_time = value;
}
Uuid get winner => _winner;
set winner(Uuid value) {
_winner = value;
}
int get nbPoints => _nbPoints;
set nbPoints(int value) {
_nbPoints = value;
}
bool get isFinished => _isFinished;
set isFinished(bool value) {
_isFinished = value;
}
Round get currentRound => _currentRound;
set currentRound(Round value) {
_currentRound = value;
}
Player get host => _host;
set host(Player value) {
_host = value;
}
List<Round> get rounds => _rounds;
set rounds(List<Round> value) {
_rounds = value;
}
List<Player> get players => _players;
set players(List<Player> value) {
_players = value;
}
}

@ -1,9 +1,7 @@
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
import 'package:uuid/uuid_util.dart'; import 'package:uuid/uuid_util.dart';
import 'Achievement.dart';
class User {
User(Uuid id, String image, String name): super(id, image, name);
class Guest extends Player {
// Constructor
Guest(Uuid id, String image, String name) : super(id, image, name);
} }

@ -0,0 +1,5 @@
abstract class IAuthManager {
// Methods
bool verifiedUser();
}

@ -0,0 +1,12 @@
import 'package:uuid/uuid.dart';
import 'package:uuid/uuid_util.dart';
import 'GameDetail.dart';
import 'Player.dart';
abstract class IGameManager {
// Methods
GameDetail getGameById(Uuid id);
List<GameDetail> getGamesByPlayerId(Uuid id);
List<GameDetail> getGamesByPlayer(Player user);
List<GameDetail> getGamesByPlayers(List<Player> users);
}

@ -1,30 +1,18 @@
import 'package:bowl_in/model/Game.dart';
import 'User.dart'; import 'User.dart';
import 'Game.dart';
abstract class IManager { abstract class IManager {
User _userCurrent; late User _userCurrent;
User get userCurrent => _userCurrent;
set userCurrent(User value) {
_userCurrent = value;
}
late Game _gameCurrent; late Game _gameCurrent;
List<Game> _games; IUserManager _userMgr;
IGameManager _gameMgr;
Game get gameCurrent => _gameCurrent;
set gameCurrent(Game value) {
_gameCurrent = value;
}
List<Game> get games => _games; // Constructor
IManager(this._userCurrent, this._gameCurrent);
set games(List<Game> value) { // Getters and setters
_games = value; User get userCurrent => _userCurrent;
} Game get gameCurrent => _gameCurrent;
IUserManager get userMgr => _userMgr;
IManager(this._userCurrent, this._gameCurrent, this._games); IGameManager get gameMgr => _gameMgr;
} }

@ -0,0 +1,12 @@
import 'package:uuid/uuid.dart';
import 'package:uuid/uuid_util.dart';
import 'User.dart';
abstract class IUserManager {
IAuthManager _authMgr;
// Methods
IAuthManager get authMgr => _authMgr;
List<User> getUsersByName(String name);
User getUserById(Uuid id);
}

@ -1,16 +1,16 @@
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
import 'package:uuid/uuid_util.dart'; import 'package:uuid/uuid_util.dart';
import 'Achievement.dart';
class Player { class Player {
final Uuid _id; final Uuid _id;
String _image; String _image;
String _name; String _name;
User(this._id, this._image, this._name); // Constructor
Player(this._id, this._image, this._name);
get id => _id; // Getters and setters
Uuid get id => _id;
String get name => _name; String get name => _name;
@ -23,5 +23,4 @@ class Player {
set image(String value) { set image(String value) {
_image = value; _image = value;
} }
} }

@ -1,11 +1,36 @@
import 'Player.dart';
class Round { class Round {
int _nbPoints; int _firstThrow;
int _secondThrow;
int _points;
Player _player;
// Constructor
Round(this._firstThrow, this._secondThrow, this._points, this._player);
// Getters and setters
int get firstThrow => _firstThrow;
set firstThrow(int value) {
_firstThrow = value;
}
int get nbPoints => _nbPoints; int get secondThrow => _secondThrow;
set nbPoints(int value) { set secondThrow(int value) {
_nbPoints = value; _secondThrow = value;
} }
Round(this._nbPoints); int get points => _points;
set points(int value) {
_points = value;
}
Player get player => _player;
set player(Player value) {
_player = value;
}
} }

@ -1,5 +1,4 @@
class Stat { class Stat {
int _nbVictory; int _nbVictory;
int _nbDefeat; int _nbDefeat;
int _nbGames; int _nbGames;
@ -10,9 +9,20 @@ class Stat {
int _avgScore; int _avgScore;
double _avgPinsPerRound; double _avgPinsPerRound;
Round(this._nbVictory,this._nbDefeat,this._nbGames,this._highscore,this._nbStrikes,this._nbSpares,this._avgScore,this._avgPinsPerRound); // Constructor
Stat(
this._nbVictory,
this._nbDefeat,
this._nbGames,
this._highscore,
this._nbStrikes,
this._nbSpares,
this._nbScore,
this._avgScore,
this._avgPinsPerRound,
);
// Getters and setters
int get nbVictory => _nbVictory; int get nbVictory => _nbVictory;
set nbVictory(int value) { set nbVictory(int value) {
@ -66,5 +76,4 @@ class Stat {
set avgPinsPerRound(double value) { set avgPinsPerRound(double value) {
_avgPinsPerRound = value; _avgPinsPerRound = value;
} }
} }

@ -1,15 +1,20 @@
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
import 'package:uuid/uuid_util.dart'; import 'package:uuid/uuid_util.dart';
import 'Achievement.dart'; import 'Achievement.dart';
import 'Animal.dart';
import 'Stat.dart';
class User { class User extends Animal {
String _mail; String _mail;
List<Stat> _stats = <Stat>[]; List<Stat> _stats = <Stat>[];
List<User> _friends = <User>[];
List<Achievement> _achievements = <Achievement>[]; List<Achievement> _achievements = <Achievement>[];
User(Uuid id, String image, String name, this._achievements, this._stats ): super(id, image, name); // Constructor
User(Uuid id, String image, String name, this._achievements, this._friends, this._stats)
: super(id, image, name);
// Getters and setters
String get mail => _mail; String get mail => _mail;
set mail(String value) { set mail(String value) {
@ -22,10 +27,15 @@ class User {
_achievements = value; _achievements = value;
} }
List<User> get friends => _friends;
set friends(List<User> value) {
_friends = value;
}
List<Stat> get stats => _stats; List<Stat> get stats => _stats;
set stats(List<Stat> value) { set stats(List<Stat> value) {
_stats = value; _stats = value;
} }
} }

Loading…
Cancel
Save