1
0
mirror of synced 2024-12-01 01:27:21 +01:00
TaikoLocalServer/TaikoWebUI/Pages/HighScores.razor

216 lines
15 KiB
Plaintext

@using TaikoWebUI.Utilities;
@inject IGameDataService GameDataService
@inject HttpClient Client
@inject AuthService AuthService
@inject NavigationManager NavigationManager
@inject BreadcrumbsStateContainer BreadcrumbsStateContainer
@inject Blazored.LocalStorage.ILocalStorageService LocalStorage
@page "/Users/{baid:int}/HighScores"
<MudGrid Class="my-8">
@if (response is null)
{
<MudContainer Style="display:flex;margin:50px 0;align-items:center;justify-content:center;">
<MudProgressCircular Indeterminate="true" Size="Size.Large" Color="Color.Primary" />
</MudContainer>
}
else
{
@if (AuthService.LoginRequired && (!AuthService.IsLoggedIn || (AuthService.GetLoggedInBaid() != Baid && !AuthService.IsAdmin)))
{
NavigationManager.NavigateTo(AuthService.IsLoggedIn ? "/" : "/Login");
}
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">
@foreach (var difficulty in Enum.GetValues<Difficulty>())
{
@if (difficulty is not Difficulty.None)
{
<MudTabPanel Text="@Localizer[ScoreUtils.GetDifficultyTitle(difficulty)]"
Icon="@ScoreUtils.GetDifficultyIconSvg(difficulty)">
@if (songBestDataMap.TryGetValue(difficulty, out var value))
{
// Rows per page 25
<MudTable Items="@value" Elevation="0" Striped="true" RowsPerPage="25" Breakpoint=Breakpoint.None>
<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>
<PagerContent>
<MudTablePager RowsPerPageString=@Localizer["Rows Per Page:"] />
</PagerContent>
</MudTable>
}
else
{
<MudGrid>
<MudItem xs="12">
<MudText Align="Align.Center" Class="my-16">
@Localizer["NoData"]
</MudText>
</MudItem>
</MudGrid>
}
</MudTabPanel>
}
}
</MudTabs>
</MudItem>
}
}
</MudGrid>