Exemple #1
0
        public async Task SendRoundComplete(string group)
        {
            try
            {
                // this method is callable by any connection
                GroupDetails.TryGetInRound(group, out bool inround, out bool atendofround, out RoundDetails round);

                // stop round
                GroupDetails.SetInRound(group, inround: false);

                // send a round done notification
                await Clients.Group(group).SendAsync("ReceiveRoundComplete", round != null ? round.Word : "");

                // refresh the user list (with scores)
                await Clients.Group(group).SendAsync("ReceiveJoin", GetSortedUsers(GroupDetails.GetUsers(group)));
            }
            catch (Exception e)
            {
                await Clients.Group(group).SendAsync("ReceiveMessage", $"failed to complete round: {e.Message}");
            }
        }