コード例 #1
0
ファイル: ScoreService.cs プロジェクト: mtickle/BlazorYahtzee
        public async Task AddScoreAsync(Game game)
        {
            var data = await _localStorageService.GetScoresAsync(game.Mode.Type);

            var scores = data.ToList();

            scores.Add(new Score(game.Player.TotalScore()));

            var scoresToSave = scores.OrderByDescending(x => x.Points).Take(50);

            await _localStorageService.AddScoresAsync(game.Mode.Type, scoresToSave);
        }