Cache more on song data
Remove unnecessary using
This commit is contained in:
parent
9ab12ba0cb
commit
7e43b44e24
@ -5,6 +5,12 @@ namespace SharedProject.Models;
|
||||
public class SongBestData
|
||||
{
|
||||
public uint SongId { get; set; }
|
||||
|
||||
public SongGenre Genre { get; set; }
|
||||
|
||||
public string MusicName { get; set; } = string.Empty;
|
||||
|
||||
public string MusicArtist { get; set; } = string.Empty;
|
||||
|
||||
public Difficulty Difficulty { get; set; }
|
||||
|
||||
|
@ -37,8 +37,8 @@
|
||||
<MudGrid Justify="Justify.Center">
|
||||
<MudItem xs="10">
|
||||
<MudStack Spacing="0">
|
||||
<MudText Typo="Typo.body2" Style="font-weight:bold">@GameDataService.GetMusicNameBySongId(context.Item.SongId)</MudText>
|
||||
<MudText Typo="Typo.caption">@GameDataService.GetMusicArtistBySongId(context.Item.SongId)</MudText>
|
||||
<MudText Typo="Typo.body2" Style="font-weight:bold">@context.Item.MusicName</MudText>
|
||||
<MudText Typo="Typo.caption">@context.Item.MusicArtist</MudText>
|
||||
</MudStack>
|
||||
</MudItem>
|
||||
<MudItem xs="2">
|
||||
@ -56,12 +56,12 @@
|
||||
</MudGrid>
|
||||
</CellTemplate>
|
||||
</Column>
|
||||
<Column T="SongBestData" Field="@nameof(SongBestData.SongId)" Title="Genre"
|
||||
<Column T="SongBestData" Field="@nameof(SongBestData.Genre)" Title="Genre"
|
||||
Sortable="false" Filterable="true">
|
||||
<CellTemplate>
|
||||
<MudChip Style="@GetGenreStyle(GameDataService.GetMusicGenreBySongId(context.Item.SongId))"
|
||||
<MudChip Style="@GetGenreStyle(context.Item.Genre)"
|
||||
Size="Size.Small">
|
||||
@GetGenreTitle(GameDataService.GetMusicGenreBySongId(context.Item.SongId))
|
||||
@GetGenreTitle(context.Item.Genre)
|
||||
</MudChip>
|
||||
</CellTemplate>
|
||||
</Column>
|
||||
|
@ -21,6 +21,15 @@ public partial class TaikoMode
|
||||
await base.OnInitializedAsync();
|
||||
response = await Client.GetFromJsonAsync<SongBestResponse>($"api/PlayData/{Baid}");
|
||||
response.ThrowIfNull();
|
||||
|
||||
response.SongBestData.ForEach(data =>
|
||||
{
|
||||
var songId = data.SongId;
|
||||
data.Genre = GameDataService.GetMusicGenreBySongId(songId);
|
||||
data.MusicName = GameDataService.GetMusicNameBySongId(songId);
|
||||
data.MusicArtist = GameDataService.GetMusicArtistBySongId(songId);
|
||||
});
|
||||
|
||||
songBestDataMap = response.SongBestData.GroupBy(data => data.Difficulty)
|
||||
.ToDictionary(data => data.Key,
|
||||
data => data.ToList());
|
||||
|
@ -1,8 +1,5 @@
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
using TaikoWebUI;
|
||||
using MudBlazor.Services;
|
||||
using TaikoWebUI.Services;
|
||||
|
||||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
|
@ -1,9 +1,5 @@
|
||||
using System.Collections.Immutable;
|
||||
using System.Net.Http.Json;
|
||||
using SharedProject.Enums;
|
||||
using SharedProject.Models;
|
||||
using TaikoWebUI.Shared.Models;
|
||||
using Throw;
|
||||
|
||||
namespace TaikoWebUI.Services;
|
||||
|
||||
|
@ -1,8 +1,4 @@
|
||||
using SharedProject.Enums;
|
||||
using SharedProject.Models;
|
||||
using TaikoWebUI.Shared.Models;
|
||||
|
||||
namespace TaikoWebUI.Services;
|
||||
namespace TaikoWebUI.Services;
|
||||
|
||||
public interface IGameDataService
|
||||
{
|
||||
|
@ -1,6 +1,4 @@
|
||||
using SharedProject.Enums;
|
||||
|
||||
namespace TaikoWebUI.Shared.Models;
|
||||
namespace TaikoWebUI.Shared.Models;
|
||||
|
||||
public class MusicDetail
|
||||
{
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using SharedProject.Enums;
|
||||
|
||||
namespace TaikoWebUI.Shared.Models;
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using SharedProject.Enums;
|
||||
|
||||
namespace TaikoWebUI.Shared.Models;
|
||||
|
||||
|
@ -26,6 +26,9 @@
|
||||
<Content Update="wwwroot\data\wordlist.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="wwwroot\data\music_order.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user