Пример #1
0
        private async Task ProcessConnectedClientAsync(WebSocket socket, string tableId, Guid userId)
        {
            await _messageExchanger.BroadcastMessageAsync(tableId, "userConnected",
                                                          new { Users = _tables.Tables[tableId].Select(x => new { UserId = x.Key, Name = x.Value.Name }), UserId = userId, TableId = tableId });

            if (_selections.Selections.ContainsKey(tableId))
            {
                foreach (var item in _selections.Selections[tableId])
                {
                    await _messageExchanger.SendMessageAsync(socket, "cardSelection", item);
                }
            }
        }
Пример #2
0
        public async Task Execute(string tableId, dynamic message)
        {
            var userId = new Guid(message.UserId);

            _tables.Tables[tableId][userId].Name = message.Value;
            await _messageExchanger.BroadcastMessageAsync(tableId, "userName", new { UserId = message.UserId, Name = message.Value });
        }
Пример #3
0
 public async Task Execute(string tableId, dynamic message)
 {
     if (!bool.TryParse(message.Value, out bool showCards))
     {
         showCards = false;
     }
     await _messageExchanger.BroadcastMessageAsync(tableId, "revealCards", new { ShowCards = showCards });
 }
Пример #4
0
        public async Task Execute(string tableId, dynamic message)
        {
            await _messageExchanger.BroadcastMessageAsync(tableId, "cardSelection", new { Effort = message.Value, UserId = message.UserId });

            _selections.StoreCardSelection(tableId, new CardSelection {
                Effort = message.Value, UserId = message.UserId,
            });
        }
Пример #5
0
        public async Task Execute(string tableId, dynamic message)
        {
            await _messageExchanger.BroadcastMessageAsync(tableId, "reset", new { ResetTable = message.Value });

            _selections.ClearCardSelections(tableId);
        }