Ajusts messages to clients in waiing-room

This commit is contained in:
Fred Z 2018-03-11 21:47:44 +01:00
parent 7708781e29
commit 44514971ef
2 changed files with 13 additions and 4 deletions

View File

@ -69,7 +69,7 @@ MSG_QUIT_GAME = "Vous quittez la partie"
# Recapitulatif des commandes
MSG_HELP = "Voici les commandes disponibles:\n"
MSG_SELECTED_MAP = "Vous avez fait le choix #{}, la carte «{}»."
MSG_CONNECTED_CLIENT = "Nb client connecté: {}"
MSG_CONNECTED_CLIENT = "Nb client connecté: {}: {}"
MSG_MINIMUM_CLIENT = "Nb client minimum: {}"
MAPS_NAME_LIST = list() # liste des maps proposees a l'utilisateur

View File

@ -63,16 +63,25 @@ while 1:
if old_count_clients != count_clients:
if count_clients > MIN_CLIENT_NB:
broadcast_msg = [MSG_REQUEST_START]
broadcast_msg = [
MSG_CONNECTED_CLIENT.format(
count_clients,
GAME_NETWORK.list_sockets()
),
MSG_REQUEST_START,
]
enough_clients = True
else:
# envoie le nbre de client aux clients
broadcast_msg = [
MSG_MINIMUM_CLIENT.format(MIN_CLIENT_NB),
MSG_CONNECTED_CLIENT.format(count_clients),
GAME_NETWORK.list_sockets()
MSG_CONNECTED_CLIENT.format(
count_clients,
GAME_NETWORK.list_sockets()
)
]
enough_clients = False
# envoi les messages
for msg in broadcast_msg: