From 6e7c57bda81c326d4f766507b358850320cda02a Mon Sep 17 00:00:00 2001 From: 12827629 Date: Wed, 28 Oct 2020 21:55:39 +0200 Subject: [PATCH 1/2] fix(game): make the host to be the only one who can click play again --- lib/module/game/multiplayer_mode/multiplayer_mode_page.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/module/game/multiplayer_mode/multiplayer_mode_page.dart b/lib/module/game/multiplayer_mode/multiplayer_mode_page.dart index c3cf573..e0684f9 100644 --- a/lib/module/game/multiplayer_mode/multiplayer_mode_page.dart +++ b/lib/module/game/multiplayer_mode/multiplayer_mode_page.dart @@ -61,7 +61,7 @@ class _MultiPlayerModePageState extends State { ); }, ), - if (model.isGameOver) + if (model.isGameOver && widget.args.isHost) DecoratedBoxWidget( body: const Center( child: Text( From 263332f225ce212597623e97cd3d0e074c803e86 Mon Sep 17 00:00:00 2001 From: 12827629 Date: Thu, 29 Oct 2020 00:18:19 +0200 Subject: [PATCH 2/2] fix(game): timezone issue in datetime --- lib/core/service/remote_datasource/remote_datasource.dart | 2 +- lib/core/service/utils/consts.dart | 4 ++-- lib/models/room_model.dart | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/core/service/remote_datasource/remote_datasource.dart b/lib/core/service/remote_datasource/remote_datasource.dart index e1b608b..51b324a 100644 --- a/lib/core/service/remote_datasource/remote_datasource.dart +++ b/lib/core/service/remote_datasource/remote_datasource.dart @@ -109,7 +109,7 @@ class RemoteDataSourceProvider implements RemoteDataSourceProviderI { final RoomModel room = await getRoom(joinCode); final newStartTime = - DateTime.now().add(const Duration(seconds: Consts.trafficLightDelay)); + DateTime.now().toUtc().add(const Duration(seconds: Consts.trafficLightDelay)); final newEndTime = newStartTime.add(Duration(seconds: room.duration)); print(newStartTime); diff --git a/lib/core/service/utils/consts.dart b/lib/core/service/utils/consts.dart index 32f244f..d86fee7 100644 --- a/lib/core/service/utils/consts.dart +++ b/lib/core/service/utils/consts.dart @@ -1,6 +1,6 @@ class Consts { - static const int trafficLightDelay = 4; - static const int multiplayerUpdateInterval = 3; + static const int trafficLightDelay = 5; + static const int multiplayerUpdateInterval = 2; static const int joinCodeLength = 4; static const int maxNicknameLength = 12; diff --git a/lib/models/room_model.dart b/lib/models/room_model.dart index 2368140..91b688b 100644 --- a/lib/models/room_model.dart +++ b/lib/models/room_model.dart @@ -25,7 +25,7 @@ class RoomModel { } /// Constructs a new [DateTime] instance based on [startTime] - DateTime get startTimeObj => DateTime.tryParse(startTime); + DateTime get startTimeObj => DateTime.tryParse(startTime).toLocal(); /// Constructs a new [DateTime] instance based on [endTime] DateTime get endTimeObj => DateTime.tryParse(endTime);