diff --git a/TaikoWebUI/Pages/Songs.razor b/TaikoWebUI/Pages/Songs.razor index f406a7b..acf5a4b 100644 --- a/TaikoWebUI/Pages/Songs.razor +++ b/TaikoWebUI/Pages/Songs.razor @@ -13,11 +13,9 @@ @if (response is null) { - - - @Localizer["No data."] - - + + + } else { @@ -35,157 +33,19 @@ else { - - @foreach (var difficulty in Enum.GetValues()) - { - @if (difficulty is not Difficulty.None) - { - - @if (songBestDataMap.TryGetValue(difficulty, out var value)) - { - - - - - -
- - @context.Item.MusicName - - @context.Item.MusicArtist -
-
- -
-
-
-
- - - - - @GameDataService.GetMusicStarLevel(@context.Item.SongId, difficulty) - - - - - - - @ScoreUtils.GetGenreTitle(context.Item.Genre) - - - - - - - @(ScoreUtils.GetCrownText(context.Item.BestCrown)) - - - - - @if (context.Item.BestScoreRank is not ScoreRank.None) - { - @(ScoreUtils.GetRankText(context.Item.BestScoreRank)) - } - - - - - - - - - - - - @(context.Item.ShowAiData ? @Localizer["Hide"] : @Localizer["Show"]) - - - - - - - - -
- - @if (context.Item.ShowAiData) - { - - - - @Localizer["AI Battle Data"] - - - - - - @Localizer["Section No."] - @Localizer["Result"] - @Localizer["Score"] - @Localizer["Crown"] - @Localizer["Good"] - @Localizer["OK"] - @Localizer["Bad"] - @Localizer["Drumroll"] - - - @(aiSectionContext.SectionIndex + 1) - - @if (@aiSectionContext.IsWin) { - Win - } - else - { - Lose - } - - @aiSectionContext.Score - - @(ScoreUtils.GetCrownText(aiSectionContext.Crown)) - - @aiSectionContext.GoodCount - @aiSectionContext.OkCount - @aiSectionContext.MissCount - @aiSectionContext.DrumrollCount - - - - - } - - - - -
- } - else - { - - - - No data for selected difficulty. - - - - } -
- } - } -
+ + + Title + + + + + @context.SongNameEN + @context.ArtistNameEN + + + +
} } diff --git a/TaikoWebUI/Pages/Songs.razor.cs b/TaikoWebUI/Pages/Songs.razor.cs index 0e8140d..f32a359 100644 --- a/TaikoWebUI/Pages/Songs.razor.cs +++ b/TaikoWebUI/Pages/Songs.razor.cs @@ -1,4 +1,5 @@ using Microsoft.JSInterop; +using TaikoWebUI.Shared.Models; namespace TaikoWebUI.Pages; @@ -16,6 +17,8 @@ public partial class Songs private readonly List breadcrumbs = new(); + private List musicMap = new(); + protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); @@ -26,6 +29,8 @@ public partial class Songs var language = await JSRuntime.InvokeAsync("blazorCulture.get"); + musicMap = GameDataService.GetMusicMap(); + response.SongBestData.ForEach(data => { var songId = data.SongId; diff --git a/TaikoWebUI/Services/GameDataService.cs b/TaikoWebUI/Services/GameDataService.cs index 751ad03..d8318dc 100644 --- a/TaikoWebUI/Services/GameDataService.cs +++ b/TaikoWebUI/Services/GameDataService.cs @@ -60,6 +60,11 @@ public class GameDataService : IGameDataService return data; } + public List GetMusicMap() + { + return musicMap.Values.Where(musicDetail => musicDetail.SongId != 0).ToList(); + } + public string GetMusicNameBySongId(uint songId, string? language = "ja") { return musicMap.TryGetValue(songId, out var musicDetail) ? language switch diff --git a/TaikoWebUI/Services/IGameDataService.cs b/TaikoWebUI/Services/IGameDataService.cs index 365afee..8d71beb 100644 --- a/TaikoWebUI/Services/IGameDataService.cs +++ b/TaikoWebUI/Services/IGameDataService.cs @@ -7,6 +7,8 @@ public interface IGameDataService { public Task InitializeAsync(string dataBaseUrl); + public List GetMusicMap(); + public string GetMusicNameBySongId(uint songId, string? language = null); public string GetMusicArtistBySongId(uint songId, string? language = null);