Esempio n. 1
0
 public async void PlayCard(string card)
 {
     var user = ConnectedUsers.GetByConnectionId(Context.ConnectionId);
     await Clients.Group(user.GroupId).SendAsync(GameEvents.CardPlayed, new CardDTO
     {
         ConnectionId = user.ConnectionId,
         Card         = card
     });
 }
Esempio n. 2
0
        public override async Task OnDisconnectedAsync(Exception exception)
        {
            var user = ConnectedUsers.GetByConnectionId(Context.ConnectionId);

            ConnectedUsers.GameUsers.Remove(user);
            await Clients.Group(user.GroupId).SendAsync(GameEvents.UserLeft, ConnectedUsers.GetByGroup(user.GroupId));

            await Groups.RemoveFromGroupAsync(Context.ConnectionId, user.GroupId);

            await base.OnDisconnectedAsync(exception);
        }
Esempio n. 3
0
 public async void StartNewGame()
 {
     var user = ConnectedUsers.GetByConnectionId(Context.ConnectionId);
     await Clients.Group(user.GroupId).SendAsync(GameEvents.NewGameStarted);
 }
Esempio n. 4
0
 public async void ShowCards()
 {
     var user = ConnectedUsers.GetByConnectionId(Context.ConnectionId);
     await Clients.Group(user.GroupId).SendAsync(GameEvents.CardsShown);
 }