private Task OnPlayerLeftGameDomainEventAsync(PlayerLeftGameDomainEvent evt) { var playerDto = DomainGameService.MapToPlayerDto(evt.Player); return(PublishIfEnabledAsync(PlayerLeftGameEvent.FromPlayerInGame( evt.GameId, playerDto ))); }
public async Task OnPlayerLeftGameAsync(PlayerLeftGameEvent evt) { // Lookup all clients that are already in the game and notify them var connectionIds = await GetPlayerConnectionsForGameAsync(evt.GameId); foreach (var connectionId in connectionIds) { var client = _hubContext.Clients.Client(connectionId); await client?.SendAsync("PlayerLeftGame", evt); } }
private void UnsubscribeAll() { _eventBus.Unsubscribe <ChatMessageSentEvent>(ChatMessageSentEvent.GetId(), OnChatMessageSentEventAsync); _eventBus.Unsubscribe <GameStateChangedEvent>(GameStateChangedEvent.GetId(), OnGameStateChangedEventAsync); _eventBus.Unsubscribe <PlayerAddedToVesselRoleEvent>(PlayerAddedToVesselRoleEvent.GetId(), OnPlayerAddedToVesselRoleEventAsync); _eventBus.Unsubscribe <PlayerJoinedGameEvent>(PlayerJoinedGameEvent.GetId(), OnPlayerJoinedGameEventAsync); _eventBus.Unsubscribe <PlayerLeftGameEvent>(PlayerLeftGameEvent.GetId(), OnPlayerLeftGameEventAsync); _eventBus.Unsubscribe <PlayerRemovedFromVesselRoleEvent>(PlayerRemovedFromVesselRoleEvent.GetId(), OnPlayerRemovedFromVesselRoleEventAsync); _eventBus.Unsubscribe <PlayerSignedInEvent>(PlayerSignedInEvent.GetId(), OnPlayerSignedInEventAsync); _eventBus.Unsubscribe <PlayerSignedOutEvent>(PlayerSignedOutEvent.GetId(), OnPlayerSignedOutEventAsync); _eventBus.Unsubscribe <VesselMovedInDirectionEvent>(VesselMovedInDirectionEvent.GetId(), OnVesselMovedInDirectionEventAsync); _eventBus.Unsubscribe <VesselStateChangedEvent>(VesselStateChangedEvent.GetId(), OnVesselStateChangedEventAsync); }
protected async Task OnPlayerLeftGameEventAsync(PlayerLeftGameEvent evt) => await OnEventAsync(evt);