Пример #1
0
        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();
        }
Пример #2
0
        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();
            }
        }
Пример #3
0
        protected async Task ResetGame()
        {
            if (string.IsNullOrWhiteSpace(GameId))
            {
                return;
            }

            Logger.LogDebug("Game Reset!");

            await ScrumPokerHub.ResetGameAsync();
        }
Пример #4
0
        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($"/");
        }
Пример #5
0
        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);
        }
Пример #6
0
 public async ValueTask DisposeAsync()
 {
     await ScrumPokerHub.LeaveGameAsync()
     .ContinueWith(t => ScrumPokerHub.StopAsync());
 }
Пример #7
0
 protected async void Reconnected(object sender, string connectionId)
 {
     await ScrumPokerHub.JoinGameAsync();
 }