request_bet and request_card are now broadcast for everyone to receive and display an arrow to represent active client's turn
This commit is contained in:
+17
-21
@@ -177,25 +177,21 @@ class LobbyManager:
|
||||
#region gameplay
|
||||
|
||||
async def spread_cards(self, lobby_id, round, cards, playing_order) -> None:
|
||||
client_ids = self.get_lobby_client_ids(lobby_id)
|
||||
|
||||
trump = None
|
||||
trump = -1
|
||||
if cards["trump"]:
|
||||
trump = cards["trump"]
|
||||
cards.pop("trump")
|
||||
|
||||
for client_id in client_ids:
|
||||
await self.send_message(
|
||||
lobby_id,
|
||||
client_id,
|
||||
json.dumps({
|
||||
"response": "round_started",
|
||||
"current_round": round,
|
||||
"cards": cards,
|
||||
"trump": trump,
|
||||
"playing_order": playing_order,
|
||||
})
|
||||
)
|
||||
await self.broadcast_message(
|
||||
lobby_id,
|
||||
json.dumps({
|
||||
"response": "round_started",
|
||||
"current_round": round,
|
||||
"cards": cards,
|
||||
"trump": trump,
|
||||
"playing_order": playing_order,
|
||||
})
|
||||
)
|
||||
|
||||
async def request_bet(self, lobby_id, client_id, disallowed_bet) -> None:
|
||||
await self.broadcast_message(
|
||||
@@ -455,11 +451,11 @@ async def process_input(message: str, websocket) -> None:
|
||||
"playing_order": lobby_manager.get_lobby(lobby_id).current_playing_order,
|
||||
}),
|
||||
)
|
||||
await lobby_manager.send_message(
|
||||
await lobby_manager.broadcast_message(
|
||||
lobby_id,
|
||||
lobby_manager.get_lobby(lobby_id).current_playing_order[0],
|
||||
json.dumps({
|
||||
"response": "request_card",
|
||||
"client_id": lobby_manager.get_lobby(lobby_id).current_playing_order[0],
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -517,11 +513,11 @@ async def process_input(message: str, websocket) -> None:
|
||||
|
||||
playing_client_id = lobby_manager.get_lobby(lobby_id).current_playing_order[0]
|
||||
|
||||
await lobby_manager.send_message(
|
||||
await lobby_manager.broadcast_message(
|
||||
lobby_id,
|
||||
playing_client_id,
|
||||
json.dumps({
|
||||
"response": "request_card",
|
||||
"client_id": playing_client_id,
|
||||
"round": lobby_manager.get_lobby(lobby_id).current_round,
|
||||
}),
|
||||
)
|
||||
@@ -569,11 +565,11 @@ async def process_input(message: str, websocket) -> None:
|
||||
# not all clients have played a card yet; continue
|
||||
playing_client_id = playing_order[client_index + 1]
|
||||
|
||||
await lobby_manager.send_message(
|
||||
await lobby_manager.broadcast_message(
|
||||
lobby_id,
|
||||
playing_client_id,
|
||||
json.dumps({
|
||||
"response": "request_card",
|
||||
"client_id": playing_client_id,
|
||||
}),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user