1
0
mirror of synced 2024-12-05 03:17:58 +01:00
TaikoLocalServer/TaikoWebUI/Pages/HighScores.razor

218 lines
15 KiB
Plaintext
Raw Normal View History

@using TaikoWebUI.Utilities;
@inject IGameDataService GameDataService
2024-03-17 20:46:47 +01:00
@inject HttpClient Client
2024-05-17 00:32:46 +02:00
@inject AuthService AuthService
2024-03-17 20:46:47 +01:00
@inject NavigationManager NavigationManager
@inject Blazored.LocalStorage.ILocalStorageService LocalStorage
2024-03-17 20:46:47 +01:00
@page "/Users/{baid:int}/HighScores"
<MudBreadcrumbs Items="breadcrumbs" Class="p-0 mb-2"></MudBreadcrumbs>
<MudText Typo="Typo.h4">@Localizer["High Scores"]</MudText>
2024-03-27 04:13:24 +01:00
<MudGrid Class="my-8">
@if (response is null)
2024-03-17 20:46:47 +01:00
{
2024-03-27 04:13:24 +01:00
<MudContainer Style="display:flex;margin:50px 0;align-items:center;justify-content:center;">
<MudProgressCircular Indeterminate="true" Size="Size.Large" Color="Color.Primary" />
</MudContainer>
2024-03-17 20:46:47 +01:00
}
else
{
2024-05-17 00:32:46 +02:00
@if (AuthService.LoginRequired && (!AuthService.IsLoggedIn || (AuthService.GetLoggedInBaid() != Baid && !AuthService.IsAdmin)))
2024-03-17 20:46:47 +01:00
{
NavigationManager.NavigateTo(AuthService.IsLoggedIn ? "/" : "/Login");
2024-03-17 20:46:47 +01:00
}
else
{
<MudItem xs="12">
<MudTabs Elevation="0" Border="true" Rounded="true" ApplyEffectsToContainer="true" Outlined="true" Class="mb-10" ActivePanelIndexChanged="@(async (index) => await OnTabChanged(index))" ActivePanelIndex="@selectedDifficultyTab">
2024-03-17 20:46:47 +01:00
@foreach (var difficulty in Enum.GetValues<Difficulty>())
{
@if (difficulty is not Difficulty.None)
{
<MudTabPanel Text="@Localizer[ScoreUtils.GetDifficultyTitle(difficulty)]"
2024-03-17 20:46:47 +01:00
Icon="@ScoreUtils.GetDifficultyIconSvg(difficulty)">
@if (songBestDataMap.TryGetValue(difficulty, out var value))
{
// Rows per page 25
<MudTable Items="@value" Elevation="0" Striped="true" RowsPerPage="25">
<HeaderContent>
<MudTh>
<MudText Typo="Typo.body2" Style="font-weight:bold">@Localizer["Song Name"]</MudText>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongBestData" SortBy="x => GameDataService.GetMusicStarLevel(musicDetailDictionary, x.SongId, difficulty)">
<MudText>@Localizer["Level"]</MudText>
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongBestData" SortBy="x => x.Genre">
<MudText>@Localizer["Genre"]</MudText>
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongBestData" SortBy="x => x.BestScore">
<MudText>@Localizer["Best Score"]</MudText>
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongBestData" SortBy="x => x.BestCrown">
<MudText>@Localizer["Best Crown"]</MudText>
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongBestData" SortBy="x => x.BestScoreRank">
<MudText>@Localizer["Best Rank"]</MudText>
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongBestData" SortBy="x => x.GoodCount">
<MudText>@Localizer["Good"]</MudText>
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongBestData" SortBy="x => x.OkCount">
<MudText>@Localizer["OK"]</MudText>
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongBestData" SortBy="x => x.MissCount">
<MudText>@Localizer["Bad"]</MudText>
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongBestData" SortBy="x => x.DrumrollCount">
<MudText>@Localizer["Drumroll"]</MudText>
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongBestData" SortBy="x => x.ComboCount">
<MudText>@Localizer["MAX Combo"]</MudText>
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongBestData" SortBy="x => x.LastPlayTime">
<MudText>@Localizer["Last Played"]</MudText>
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongBestData" SortBy="x => x.PlayCount">
<MudText>@Localizer["Total Credits Played"]</MudText>
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongBestData" SortBy="x => x.ClearCount">
<MudText>@Localizer["Total Clears"]</MudText>
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongBestData" SortBy="x => x.FullComboCount">
<MudText>@Localizer["Total Full Combos"]</MudText>
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongBestData" SortBy="x => x.PerfectCount">
<MudText>@Localizer["Total Donderful Combos"]</MudText>
</MudTableSortLabel>
</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd>
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
<div style="width:300px">
<a href="@($"/Users/{Baid}/Songs/{context.SongId}")">
<MudText Typo="Typo.body2" Style="font-weight:bold">@context.MusicName</MudText>
<MudText Typo="Typo.caption">@context.MusicArtist</MudText>
</a>
</div>
<div>
<MudToggleIconButton Toggled="@context.IsFavorite"
ToggledChanged="@(async () => await OnFavoriteToggled(context))"
Icon="@Icons.Material.Filled.FavoriteBorder" Color="@Color.Secondary"
ToggledIcon="@Icons.Material.Filled.Favorite" ToggledColor="@Color.Secondary"
Size="Size.Small"
ToggledSize="Size.Small"
Title="Add to favorites" ToggledTitle="Remove from favorites" />
</div>
</MudStack>
</MudTd>
<MudTd>
<MudStack Row="true" Spacing="1" AlignItems="AlignItems.Center">
<MudIcon Icon="@Icons.Material.Filled.Star" Size="Size.Small" />
<MudText Typo="Typo.caption" Style="line-height:1;margin-top:2px;margin-right:2px;">@GameDataService.GetMusicStarLevel(musicDetailDictionary, context.SongId, difficulty)</MudText>
</MudStack>
</MudTd>
<MudTd>
<MudChip Style="@ScoreUtils.GetGenreStyle(context.Genre)"
Size="Size.Small">
@ScoreUtils.GetGenreTitle(context.Genre)
</MudChip>
</MudTd>
<MudTd>
<MudText>@context.BestScore</MudText>
</MudTd>
<MudTd>
<img src="@($"/images/crown_{context.BestCrown}.png")" alt="@(ScoreUtils.GetCrownText(context.BestCrown))" title="@(ScoreUtils.GetCrownText(context.BestCrown))" style="@Constants.ICON_STYLE" />
</MudTd>
<MudTd>
@if (context.BestScoreRank is not ScoreRank.None)
{
<img src="@($"/images/rank_{context.BestScoreRank}.png")" alt="@(ScoreUtils.GetRankText(context.BestScoreRank))" title="@(ScoreUtils.GetRankText(context.BestScoreRank))" style="@Constants.ICON_STYLE" />
}
</MudTd>
<MudTd>
<MudText>@context.GoodCount</MudText>
</MudTd>
<MudTd>
<MudText>@context.OkCount</MudText>
</MudTd>
<MudTd>
<MudText>@context.MissCount</MudText>
</MudTd>
<MudTd>
<MudText>@context.DrumrollCount</MudText>
</MudTd>
<MudTd>
<MudText>@context.ComboCount</MudText>
</MudTd>
<MudTd>
<MudText>@context.LastPlayTime</MudText>
</MudTd>
<MudTd>
<MudText>@context.PlayCount</MudText>
</MudTd>
<MudTd>
<MudText>@context.ClearCount</MudText>
</MudTd>
<MudTd>
<MudText>@context.FullComboCount</MudText>
</MudTd>
<MudTd>
<MudText>@context.PerfectCount</MudText>
</MudTd>
</RowTemplate>
2024-03-17 20:46:47 +01:00
<PagerContent>
<MudTablePager RowsPerPageString=@Localizer["Rows Per Page:"] />
2024-03-17 20:46:47 +01:00
</PagerContent>
</MudTable>
2024-03-17 20:46:47 +01:00
}
else
{
<MudGrid>
<MudItem xs="12">
<MudText Align="Align.Center" Class="my-16">
2024-06-03 17:03:09 +02:00
@Localizer["NoData"]
2024-03-17 20:46:47 +01:00
</MudText>
</MudItem>
</MudGrid>
}
</MudTabPanel>
}
}
</MudTabs>
</MudItem>
}
}
</MudGrid>