protected async void GameReset(object sender, PlayerEvent e) { players.ForEach(p => p.Vote = null); voteComplete = false; StateHasChanged(); if (!observing) { var options = new ModalOptions() { HideCloseButton = true, DisableBackgroundCancel = true }; var voteModal = Modal.Show <VotingModal>("Cast your vote!", options); var modalResult = await voteModal.Result; await ScrumPokerHub.VoteAsync((string)modalResult.Data); } else { await ScrumPokerHub.VoteAsync("🕵"); } StateHasChanged(); }
protected override async Task OnInitializedAsync() { userName = ProfileSvc.UserName; userId = ProfileSvc.UserId; if (string.IsNullOrWhiteSpace(userName)) { userName = await EditProfileModal.ShowAsync(); } if (GameId == null) { NavigationManager.NavigateTo($"story-poker/{GameHelper.GenerateGameId()}", true); } if (!string.IsNullOrWhiteSpace(GameId)) { ScrumPokerHub.Init(GameId); ScrumPokerHub.OnReconnected += Reconnected; ScrumPokerHub.OnReceiveVote += ReceivedVote; ScrumPokerHub.OnAddPlayer += NewPlayerAdded; ScrumPokerHub.OnRemovePlayer += RemovePlayer; ScrumPokerHub.OnReceiveInitialGameState += ReceivedInitialGameState; ScrumPokerHub.OnGameEnded += GameEnded; ScrumPokerHub.OnGameReset += GameReset; await ScrumPokerHub.StartAsync(); await ScrumPokerHub.JoinGameAsync(); } }
protected async Task ResetGame() { if (string.IsNullOrWhiteSpace(GameId)) { return; } Logger.LogDebug("Game Reset!"); await ScrumPokerHub.ResetGameAsync(); }
protected async void GameEnded(object sender, PlayerEvent e) { var options = new ModalOptions() { HideCloseButton = true, DisableBackgroundCancel = true }; var gameEndedModal = Modal.Show <GameEndedModal>("Game Complete", options); await gameEndedModal.Result; await ScrumPokerHub.StopAsync(); NavigationManager.NavigateTo($"/"); }
protected Task ExitGame() { if (string.IsNullOrWhiteSpace(GameId)) { return(Task.CompletedTask); } Logger.LogDebug("Game Ended!"); ScrumPokerHub.LeaveGameAsync() .ContinueWith(t => ScrumPokerHub.StopAsync()); NavigationManager.NavigateTo($"/"); return(Task.CompletedTask); }
public async ValueTask DisposeAsync() { await ScrumPokerHub.LeaveGameAsync() .ContinueWith(t => ScrumPokerHub.StopAsync()); }
protected async void Reconnected(object sender, string connectionId) { await ScrumPokerHub.JoinGameAsync(); }