Ejemplo n.º 1
0
        private async Task AfterWhoIsDialog(IDialogContext context, IAwaitable <double> result)
        {
            var score      = await result;
            var playerName = context.ConversationData.GetValue <string>(Constants.PLAYER_NAME_KEY);

            await LeaderboardService.SaveScoreAsync(playerName, score);

            await context.PostAsync($"💯 You are done! Your final score is: **{score}**.");

            await Utils.SendEventAsync(context, Constants.END_GAME_EVENT, score);

            // cleanup
            context.ConversationData.RemoveValue(Constants.LAST_PERSON_KEY);
            context.ConversationData.RemoveValue(Constants.RECENT_PEOPLE_KEY);
            context.ConversationData.RemoveValue(Constants.PLAYER_NAME_KEY);
            context.ConversationData.RemoveValue(Constants.SCORE_KEY);

            context.Done(true);
        }