Leaderboard card in progress
This commit is contained in:
parent
e806ae6588
commit
e653e40e21
@ -83,6 +83,7 @@ try
|
|||||||
builder.Services.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(typeof(Program).Assembly));
|
builder.Services.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(typeof(Program).Assembly));
|
||||||
builder.Services.AddOptions();
|
builder.Services.AddOptions();
|
||||||
builder.Services.AddSingleton<IGameDataService, GameDataService>();
|
builder.Services.AddSingleton<IGameDataService, GameDataService>();
|
||||||
|
builder.Services.AddScoped<ISongLeaderboardService, SongLeaderboardService>();
|
||||||
builder.Services.Configure<ServerSettings>(builder.Configuration.GetSection(nameof(ServerSettings)));
|
builder.Services.Configure<ServerSettings>(builder.Configuration.GetSection(nameof(ServerSettings)));
|
||||||
builder.Services.Configure<DataSettings>(builder.Configuration.GetSection(nameof(DataSettings)));
|
builder.Services.Configure<DataSettings>(builder.Configuration.GetSection(nameof(DataSettings)));
|
||||||
builder.Services.Configure<AuthSettings>(builder.Configuration.GetSection(nameof(AuthSettings)));
|
builder.Services.Configure<AuthSettings>(builder.Configuration.GetSection(nameof(AuthSettings)));
|
||||||
|
@ -27,7 +27,6 @@ public class SongLeaderboardService : ISongLeaderboardService
|
|||||||
.ThenByDescending(x => x.BestRate)
|
.ThenByDescending(x => x.BestRate)
|
||||||
.Take(limit)
|
.Take(limit)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
// get the user data for each score
|
// get the user data for each score
|
||||||
var leaderboard = new List<SongLeaderboard>();
|
var leaderboard = new List<SongLeaderboard>();
|
||||||
|
@ -3,12 +3,9 @@
|
|||||||
<MudCard Outlined="true" Elevation="0">
|
<MudCard Outlined="true" Elevation="0">
|
||||||
<MudCardHeader>
|
<MudCardHeader>
|
||||||
<MudGrid Spacing="2">
|
<MudGrid Spacing="2">
|
||||||
<MudItem xs="12" md="4">
|
<MudItem xs="12">
|
||||||
<MudText Typo="Typo.h6">@Localizer["Play History"]</MudText>
|
<MudText Typo="Typo.h6">@Localizer["Play History"]</MudText>
|
||||||
</MudItem>
|
</MudItem>
|
||||||
<MudItem xs="12" md="8">
|
|
||||||
<MudText Typo="Typo.h6">@Localizer["Total Credits Played"]:@Items.Count</MudText>
|
|
||||||
</MudItem>
|
|
||||||
</MudGrid>
|
</MudGrid>
|
||||||
</MudCardHeader>
|
</MudCardHeader>
|
||||||
@if (Items.Count > 0)
|
@if (Items.Count > 0)
|
||||||
|
@ -1,2 +1,12 @@
|
|||||||
@using TaikoWebUI.Utilities;
|
@inject HttpClient Client;
|
||||||
|
@using TaikoWebUI.Utilities;
|
||||||
|
|
||||||
|
<MudCard Outlined="true" Elevation="0">
|
||||||
|
<MudCardHeader>
|
||||||
|
<MudGrid Spacing="2">
|
||||||
|
<MudItem xs="12">
|
||||||
|
<MudText Typo="Typo.h6">@Localizer["Leaderboard"]</MudText>
|
||||||
|
</MudItem>
|
||||||
|
</MudGrid>
|
||||||
|
</MudCardHeader>
|
||||||
|
</MudCard>
|
28
TaikoWebUI/Components/Song/SongLeaderboardCard.razor.cs
Normal file
28
TaikoWebUI/Components/Song/SongLeaderboardCard.razor.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
|
||||||
|
namespace TaikoWebUI.Components.Song;
|
||||||
|
|
||||||
|
public partial class SongLeaderboardCard
|
||||||
|
{
|
||||||
|
private SongLeaderboardResponse? response;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public int SongId { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public int Baid { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public Difficulty Difficulty { get; set; } = Difficulty.Easy;
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
await base.OnInitializedAsync();
|
||||||
|
|
||||||
|
response = await Client.GetFromJsonAsync<SongLeaderboardResponse>($"api/SongLeaderboardData/{(uint)Baid}/{(uint)SongId}/{(uint)Difficulty}");
|
||||||
|
response.ThrowIfNull();
|
||||||
|
|
||||||
|
// log the leaderboard
|
||||||
|
Console.WriteLine(response.Leaderboard);
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,10 @@ else
|
|||||||
<MudItem xs="12">
|
<MudItem xs="12">
|
||||||
<PlayHistoryCard Items="@songHistoryData" />
|
<PlayHistoryCard Items="@songHistoryData" />
|
||||||
</MudItem>
|
</MudItem>
|
||||||
|
|
||||||
|
<MudItem xs="12">
|
||||||
|
<SongLeaderboardCard SongId="@SongId" Baid="@Baid" />
|
||||||
|
</MudItem>
|
||||||
</MudGrid>
|
</MudGrid>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user