Skip to content

Commit

Permalink
all game model related things updated
Browse files Browse the repository at this point in the history
  • Loading branch information
smelihportakal committed Dec 24, 2023
1 parent 6b45a48 commit 34e1880
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 72 deletions.
16 changes: 8 additions & 8 deletions app/mobile/lib/data/models/dto/game/game_create_dto_request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import 'package:mobile/utils/service_validation_util.dart';
class GameCreateDTORequest extends BaseDTOObject<GameCreateDTORequest> {
String title;
String description;
String? genre;
String? platform;
List<String?>? genres;
List<String?>? platforms;
String? numberOfPlayer;
int year;
String? universe;
Expand All @@ -16,8 +16,8 @@ class GameCreateDTORequest extends BaseDTOObject<GameCreateDTORequest> {
GameCreateDTORequest({
required this.title,
required this.description,
required this.genre,
required this.platform,
required this.genres,
required this.platforms,
required this.numberOfPlayer,
required this.year,
required this.universe,
Expand All @@ -36,8 +36,8 @@ class GameCreateDTORequest extends BaseDTOObject<GameCreateDTORequest> {
GameCreateDTORequest(
title: json["title"],
description: json["description"],
genre: json["genre"],
platform: json["platform"],
genres: json["genres"] != null ? List<String>.from(json["genres"].map((x) => x)) : [],
platforms: json["platforms"] != null ? List<String>.from(json["platforms"].map((x) => x)) : [],
numberOfPlayer: json["playerNumber"],
year: json["releaseYear"],
universe: json["universe"],
Expand All @@ -49,8 +49,8 @@ class GameCreateDTORequest extends BaseDTOObject<GameCreateDTORequest> {
Map<String, dynamic> toJson() => {
"title": title,
"description": description,
"genre": genre,
"platform": platform,
"genres": genres,
"platforms": platforms,
"playerNumber": numberOfPlayer,
"releaseYear": year,
"mechanics": mechanics,
Expand Down
16 changes: 8 additions & 8 deletions app/mobile/lib/data/models/game_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class Game {
final String title;
final String description;
String? developers;
String? genre;
String? platform;
List<String>? genres;
List<String>? platforms;
List<Character>? characters;
String? playerNumber;
int? releaseYear;
Expand All @@ -27,8 +27,8 @@ class Game {
required this.gameId,
required this.title,
required this.description,
this.genre,
this.platform,
this.genres,
this.platforms,
this.playerNumber,
this.releaseYear,
this.universe,
Expand All @@ -49,8 +49,8 @@ class Game {
gameId: json['gameId'],
title: json['title'],
description: json['description'],
genre: json['genre'],
platform: json['platform'],
genres: json["genres"] != null ? List<String>.from(json["genres"].map((x) => x)) : [],
platforms: json["platforms"] != null ? List<String>.from(json["platforms"].map((x) => x)) : [],
playerNumber: json['playerNumber'],
releaseYear: json['releaseYear'],
universe: json['universe'],
Expand All @@ -69,8 +69,8 @@ class Game {
'gameId': gameId,
'title': title,
'description': description,
'genre': genre,
'platform': platform,
'genres': genres,
'platforms': platforms,
'playerNumber': playerNumber,
'universe': universe,
'mechanics': mechanics,
Expand Down
10 changes: 5 additions & 5 deletions app/mobile/lib/data/services/admin_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class AdminService {
title: "Witcher 3",
gamePicture:
"https://image.api.playstation.com/vulcan/ap/rnd/202211/0711/kh4MUIuMmHlktOHar3lVl6rY.png",
genre: "Adventure, Role-playing(RPG)",
genres: ["Adventure, Role-playing(RPG)"],
developers: "CD Projekt RED",
releaseYear: 2015,
platform:
" Xbox One, PlayStation 4, PlayStation 5, PC (Microsoft Windows), Nintendo Switch, Xbox Series X|S",
platforms:
[" Xbox One, PlayStation 4, PlayStation 5, PC (Microsoft Windows), Nintendo Switch, Xbox Series X|S"],
playerNumber: "Single Player",
universe: "Fantasy",
mechanics: "Third-person",
Expand All @@ -34,7 +34,7 @@ class AdminService {
title: "League of Legends",
gamePicture:
"https://cdn.ntvspor.net/047bed7cbad44a3dae8bdd7b643ab253.jpg?crop=158,0,782,624&w=800&h=800&mode=crop",
genre: "MOBA, Role-playing(RPG), Strategy",
genres: ["MOBA", "Role-playing(RPG)", "Strategy"],
developers: "Riot Games",
releaseYear: 2009,
),
Expand All @@ -45,7 +45,7 @@ class AdminService {
title: "Call of Duty: WWII",
gamePicture:
"https://upload.wikimedia.org/wikipedia/tr/8/85/Call_of_Duty_WIII_Kapak_Resmi.jpg",
genre: "Shooter",
genres: ["Shooter"],
developers: "Sledgehammer Games",
releaseYear: 2017,
),
Expand Down
34 changes: 17 additions & 17 deletions app/mobile/lib/data/services/game_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ class GameService {
title: "Witcher 3",
gamePicture:
"https://image.api.playstation.com/vulcan/ap/rnd/202211/0711/kh4MUIuMmHlktOHar3lVl6rY.png",
genre: "Adventure, Role-playing(RPG)",
genres: ["Adventure, Role-playing(RPG)"],
developers: "CD Projekt RED",
releaseYear: 2015,
platform:
" Xbox One, PlayStation 4, PlayStation 5, PC (Microsoft Windows), Nintendo Switch, Xbox Series X|S",
platforms:
[" Xbox One, PlayStation 4, PlayStation 5, PC (Microsoft Windows), Nintendo Switch, Xbox Series X|S"],
playerNumber: "Single Player",
universe: "Fantasy",
mechanics: "Third-person",
Expand All @@ -45,7 +45,7 @@ class GameService {
title: "League of Legends",
gamePicture:
"https://cdn.ntvspor.net/047bed7cbad44a3dae8bdd7b643ab253.jpg?crop=158,0,782,624&w=800&h=800&mode=crop",
genre: "MOBA, Role-playing(RPG), Strategy",
genres: ["MOBA", "Role-playing(RPG)", "Strategy"],
developers: "Riot Games",
releaseYear: 2009,
),
Expand All @@ -56,7 +56,7 @@ class GameService {
title: "Call of Duty: WWII",
gamePicture:
"https://upload.wikimedia.org/wikipedia/tr/8/85/Call_of_Duty_WIII_Kapak_Resmi.jpg",
genre: "Shooter",
genres: ["Shooter"],
developers: "Sledgehammer Games",
releaseYear: 2017,
),
Expand Down Expand Up @@ -110,7 +110,7 @@ Celeste has left a lasting impact on the indie gaming scene, inspiring other dev
title: "Celeste",
gamePicture:
"https://upload.wikimedia.org/wikipedia/commons/0/0f/Celeste_box_art_full.png",
genre: "Adventure, Indie, Platform",
genres: ["Adventure, Indie, Platform"],
developers: "Maddy Makes Games",
releaseYear: 2018,
),
Expand All @@ -121,8 +121,8 @@ Celeste has left a lasting impact on the indie gaming scene, inspiring other dev
title: "Baldur's Gate 3",
gamePicture:
"https://image.api.playstation.com/vulcan/ap/rnd/202302/2321/ba706e54d68d10a0eb6ab7c36cdad9178c58b7fb7bb03d28.png",
genre:
"Adventure, Role-playing (RPG), Strategy, Tactical, Turn-based strategy (TBS)",
genres:
["Adventure, Role-playing (RPG), Strategy, Tactical, Turn-based strategy (TBS)"],
developers: "Larian Studios",
releaseYear: 2020,
),
Expand All @@ -133,7 +133,7 @@ Celeste has left a lasting impact on the indie gaming scene, inspiring other dev
title: "Ori and The Will of The Wisps",
gamePicture:
"https://upload.wikimedia.org/wikipedia/en/9/94/Ori_and_the_Will_of_the_Wisps.jpg",
genre: "Adventure, Platform",
genres: ["Adventure, Platform"],
developers: "Moon Studios",
releaseYear: 2020,
),
Expand Down Expand Up @@ -191,8 +191,8 @@ Celeste has left a lasting impact on the indie gaming scene, inspiring other dev
Future<void> createGame(
String title,
String description,
String? genre,
String? platform,
List<String?>? genres,
List<String?>? platforms,
String? numberOfPlayer,
String? mechanics,
int year,
Expand All @@ -209,8 +209,8 @@ Celeste has left a lasting impact on the indie gaming scene, inspiring other dev
GameCreateDTORequest gameCreateDTORequest = GameCreateDTORequest(
title: title,
description: description,
genre: genre,
platform: platform,
genres: genres,
platforms: platforms,
numberOfPlayer: numberOfPlayer,
year: year,
universe: universe,
Expand Down Expand Up @@ -267,8 +267,8 @@ Celeste has left a lasting impact on the indie gaming scene, inspiring other dev
Future<bool> updateGame(
String title,
String description,
String? genre,
String? platform,
List<String?>? genres,
List<String?>? platforms,
String? numberOfPlayer,
String? mechanics,
int year,
Expand All @@ -285,8 +285,8 @@ Celeste has left a lasting impact on the indie gaming scene, inspiring other dev
GameCreateDTORequest gameCreateDTORequest = GameCreateDTORequest(
title: title,
description: description,
genre: genre,
platform: platform,
genres: genres,
platforms: platforms,
numberOfPlayer: numberOfPlayer,
year: year,
universe: universe,
Expand Down
6 changes: 3 additions & 3 deletions app/mobile/lib/presentation/pages/admin_game_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class _AdminGamePageState extends State<AdminGamePage> {
fontWeight: FontWeight.w600))),
Align(
alignment: Alignment.centerLeft,
child: Text(widget.game.genre ?? "-",
child: Text(widget.game.genres![0] ?? "-",
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w400))),
Expand Down Expand Up @@ -126,7 +126,7 @@ class _AdminGamePageState extends State<AdminGamePage> {
style: TextStyle(
fontSize: 18, fontWeight: FontWeight.w700),
),
if (widget.game.platform != null)
if (widget.game.platforms != null)
Align(
alignment: Alignment.centerLeft,
child: Padding(
Expand All @@ -141,7 +141,7 @@ class _AdminGamePageState extends State<AdminGamePage> {
TextStyle(fontWeight: FontWeight.w500),
),
TextSpan(
text: widget.game.platform!,
text: widget.game.platforms![0],
)
],
)),
Expand Down
67 changes: 39 additions & 28 deletions app/mobile/lib/presentation/pages/game_page_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,27 @@ class _GameCreatePageState extends State<GamePageCreate> {
final _titleController = TextEditingController();
final _descriptionController = TextEditingController();
final List<String> _genreList = [
"MOBA", "FIGHTING", "STRATEGY", "SPORTS_AND_RACING", "RPG", "SHOOTER", "EMPTY"
"RGP",
"Strategy",
"Shooter",
"Sports",
"Fighting",
"MOBA",
"Action",
"Adventure",
"Simulation",
"Horror",
"Empty"
];
String? _selectedGenre;

final List<String> _platformList = [
"XBOX",
"COMPUTER",
"XBOX",
"Computer",
"PS", // PlayStation
"ONBOARD",
"EMPTY"
"Onboard",
"Mobile",
"Empty"
];
String? _selectedPlatform;

Expand All @@ -51,32 +62,32 @@ class _GameCreatePageState extends State<GamePageCreate> {


final List<String> _playerNumberList = [
"SINGLE",
"TEAMS",
"MULTIPLE",
"Single",
"Teams",
"Multiplayer",
"MMO", // Massively Multiplayer Online
"EMPTY"
"Empty"
];
String? _selectedPlayerNumber;

final List<String> _universeList = [
"MEDIEVAL",
"FANTASY",
"SCIFI",
"CYBERPUNK",
"HISTORICAL",
"CONTEMPORARY",
"POST_APOCALYPTIC",
"ALTERNATE_REALITY",
"EMPTY"
];
"Medieval",
"Fantasy",
"SciFi",
"Cyberpunk",
"Historical",
"Contemporary",
"PostApocalyptic",
"AlternateReality",
"Empty" ];

String? _selectedUniverse;

final List<String> _gameMechanicsist = [
"TURN_BASED",
"CHANCE_BASED",
"EMPTY"
"TurnBased",
"ChangeBased",
"RealTime",
"Empty"
];

String? _selectedGameMechanics;
Expand All @@ -92,8 +103,8 @@ class _GameCreatePageState extends State<GamePageCreate> {
buttonLabel = "Update";
_titleController.text = widget.selectedGame!.title;
_descriptionController.text = widget.selectedGame!.description;
_selectedGenre = widget.selectedGame!.genre;
_selectedPlatform = widget.selectedGame!.platform;
_selectedGenre = widget.selectedGame!.genres![0];
_selectedPlatform = widget.selectedGame!.platforms![0];
_selectedPlayerNumber = widget.selectedGame!.playerNumber;
//_playerNumberController.text =
// widget.selectedGame!.playerNumber.toString();
Expand Down Expand Up @@ -340,8 +351,8 @@ class _GameCreatePageState extends State<GamePageCreate> {
GameService().updateGame(
_titleController.text,
_descriptionController.text,
_selectedGenre,
_selectedPlatform,
[_selectedGenre],
[_selectedPlatform],
_selectedPlayerNumber,
_selectedGameMechanics,
int.parse(_releaseYearController.text),
Expand All @@ -354,8 +365,8 @@ class _GameCreatePageState extends State<GamePageCreate> {
GameService().createGame(
_titleController.text,
_descriptionController.text,
_selectedGenre,
_selectedPlatform,
[_selectedGenre],
[_selectedPlatform],
_selectedPlayerNumber,
_selectedGameMechanics,
//_mechanicsController.text,
Expand Down
6 changes: 3 additions & 3 deletions app/mobile/lib/presentation/pages/game_wiki_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class _GameWikiPageState extends State<GameWikiPage>
fontWeight: FontWeight.w600))),
Align(
alignment: Alignment.centerLeft,
child: Text(game.genre ?? "-",
child: Text(game.genres![0] ?? "-",
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w400))),
Expand Down Expand Up @@ -287,7 +287,7 @@ class _GameWikiPageState extends State<GameWikiPage>
style: TextStyle(
fontSize: 18, fontWeight: FontWeight.w700),
),
if (game.platform != null)
if (game.platforms != null)
Align(
alignment: Alignment.centerLeft,
child: Padding(
Expand All @@ -302,7 +302,7 @@ class _GameWikiPageState extends State<GameWikiPage>
TextStyle(fontWeight: FontWeight.w500),
),
TextSpan(
text: game.platform!,
text: game.platforms![0],
)
],
)),
Expand Down

0 comments on commit 34e1880

Please sign in to comment.