diff --git a/tarok/lib/game/game.dart b/tarok/lib/game/game.dart index 2db8cc0..b5880a2 100644 --- a/tarok/lib/game/game.dart +++ b/tarok/lib/game/game.dart @@ -538,17 +538,26 @@ class Game extends StatelessWidget { "talon": controller.talonSelected.value .toString() })), + const SizedBox( + height: 10, + ), ElevatedButton( - style: ElevatedButton.styleFrom( - textStyle: const TextStyle( - fontSize: 18, - ), - ), onPressed: () { controller.validCards(); }, child: Text("reevaluate_cards".tr), ), + const SizedBox( + height: 5, + ), + ElevatedButton( + onPressed: () { + controller.socket.close(); + controller.connect(controller.gameId); + controller.listen(); + }, + child: Text("reset_websocket".tr), + ) ]), if (!controller.bots) ListView(children: [ diff --git a/tarok/lib/game/game_controller.dart b/tarok/lib/game/game_controller.dart index 33172bb..1b23400 100644 --- a/tarok/lib/game/game_controller.dart +++ b/tarok/lib/game/game_controller.dart @@ -121,7 +121,7 @@ class GameController extends GetxController { var tournamentStatistics = Rxn(); - late final WebSocket socket; + late WebSocket socket; /* INIT FUNCTIONS @@ -1159,6 +1159,14 @@ class GameController extends GetxController { } } + if (msg.hasUserList()) { + // rejoin, izbrišemo vse karte za vsak slučaj + cards.value = []; + for (int i = 0; i < userWidgets.length; i++) { + userWidgets[i].points = []; + } + } + resetPremoves(); premovedCard.value = null; cardStih.value = []; diff --git a/tarok/lib/internationalization/languages.dart b/tarok/lib/internationalization/languages.dart index 240378a..76ecd48 100644 --- a/tarok/lib/internationalization/languages.dart +++ b/tarok/lib/internationalization/languages.dart @@ -464,6 +464,7 @@ class Messages extends Translations { "counterclockwise_gameplay": "Counterclockwise game", "counterclockwise_gameplay_desc": "The game will be running counterclockwise. You have to restart the game or leave it to apply this change.", + "reset_websocket": "Reset the WebSocket connection", }, "fr_FR": { "login": "Connexion", @@ -918,6 +919,7 @@ class Messages extends Translations { "counterclockwise_gameplay": "Counterclockwise game", "counterclockwise_gameplay_desc": "The game will be running counterclockwise. You have to restart the game or leave it to apply this change.", + "reset_websocket": "Reset the WebSocket connection", }, "sl_SI": { "login": "Prijava", @@ -1362,6 +1364,7 @@ class Messages extends Translations { "counterclockwise_gameplay": "Igra v nasprotni smeri urinega kazalca", "counterclockwise_gameplay_desc": "Igra bo potekala v nasprotni smeri urinega kazalca. Ko to vključite, morate zapustiti igro.", + "reset_websocket": "Resetiraj WebSocket povezavo", } }; }