212 lines
15 KiB
Plaintext
212 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" Style="margin-bottom: 0px !important;">
|
|
@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" MinimumTabWidth="100px" Rounded="true" ApplyEffectsToContainer="true" Outlined="true" 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="false" Outlined="true" RowsPerPage="25" Breakpoint=Breakpoint.None Filter="@FilterSongs">
|
|
<ToolBarContent>
|
|
<MudGrid Spacing="2">
|
|
<MudItem xs="12" md="8">
|
|
<MudTextField @bind-Value="Search"
|
|
Placeholder="@Localizer["Search by Title or Artist"]"
|
|
Variant="Variant.Outlined"
|
|
Clearable="true"
|
|
Immediate="true"
|
|
Margin="Margin.Dense"
|
|
Adornment="Adornment.Start"
|
|
AdornmentIcon="@Icons.Material.Filled.Search"
|
|
IconSize="Size.Medium" />
|
|
</MudItem>
|
|
<MudItem xs="12" md="4">
|
|
<MudSelect @bind-Value="GenreFilter" T="string" Label="@Localizer["Filter by Genre"]" Variant="Variant.Outlined" Margin="Margin.Dense" Clearable="true">
|
|
@foreach (var genre in Enum.GetValues(typeof(SongGenre)))
|
|
{
|
|
var genreValue = (SongGenre)genre;
|
|
<MudSelectItem Value="@genreValue.ToString()" Label="@Localizer[$"Key_{genreValue}"]">
|
|
@ScoreUtils.GetGenreTitle(genreValue)
|
|
</MudSelectItem>
|
|
}
|
|
</MudSelect>
|
|
</MudItem>
|
|
</MudGrid>
|
|
</ToolBarContent>
|
|
<HeaderContent>
|
|
<MudTh Style="width: 400px">
|
|
<MudTableSortLabel T="SongBestData" SortBy="x => GameDataService.GetMusicNameBySongId(musicDetailDictionary, x.SongId, CultureInfo.CurrentCulture.ToString())">
|
|
<MudText Typo="Typo.body2">@Localizer["Song Title / Artist"]</MudText>
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel T="SongBestData" SortBy="x => (int)x.Genre * 1000000 + x.BestScore">
|
|
<MudText Typo="Typo.body2">@Localizer["Genre"]</MudText>
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel T="SongBestData" SortBy="x => GameDataService.GetMusicStarLevel(musicDetailDictionary, x.SongId, difficulty) * 1000000 + x.BestScore">
|
|
<MudText Typo="Typo.body2">@Localizer["Level"]</MudText>
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel T="SongBestData" SortBy="x => x.BestScore">
|
|
<MudText Typo="Typo.body2">@Localizer["Best Score"]</MudText>
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel T="SongBestData" SortBy="x => (int)x.BestCrown * 1000000 + x.BestScore">
|
|
<MudText Typo="Typo.body2">@Localizer["Best Crown"]</MudText>
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel T="SongBestData" SortBy="x => (int)x.BestScoreRank * 1000000 + x.BestScore">
|
|
<MudText Typo="Typo.body2">@Localizer["Best Rank"]</MudText>
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
@* <MudTh>
|
|
<MudTableSortLabel T="SongBestData" SortBy="x => x.GoodCount">
|
|
<MudText Typo="Typo.body2">@Localizer["Good"]</MudText>
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel T="SongBestData" SortBy="x => x.OkCount">
|
|
<MudText Typo="Typo.body2">@Localizer["OK"]</MudText>
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel T="SongBestData" SortBy="x => x.MissCount">
|
|
<MudText Typo="Typo.body2">@Localizer["Bad"]</MudText>
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel T="SongBestData" SortBy="x => x.DrumrollCount">
|
|
<MudText Typo="Typo.body2">@Localizer["Drumroll"]</MudText>
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel T="SongBestData" SortBy="x => x.ComboCount">
|
|
<MudText Typo="Typo.body2">@Localizer["MAX Combo"]</MudText>
|
|
</MudTableSortLabel>
|
|
</MudTh> *@
|
|
<MudTh>
|
|
<MudTableSortLabel T="SongBestData" InitialDirection="SortDirection.Descending" SortBy="x => x.PlayTime">
|
|
<MudText Typo="Typo.body2">@Localizer["Played"]</MudText>
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
</HeaderContent>
|
|
<RowTemplate>
|
|
<MudTd Style="text-align: initial !important;">
|
|
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
|
<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>
|
|
<div style="width:400px">
|
|
<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>
|
|
</MudStack>
|
|
</MudTd>
|
|
<MudTd Style="width: 150px;">
|
|
<MudChip Style="@ScoreUtils.GetGenreStyle(context.Genre)"
|
|
Size="Size.Small">
|
|
@ScoreUtils.GetGenreTitle(context.Genre)
|
|
</MudChip>
|
|
</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>
|
|
<MudText Typo="Typo.body2">@context.BestScore</MudText>
|
|
</MudTd>
|
|
<MudTd>
|
|
<img src="@($"/images/crown_{context.BestCrown}.webp")" 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}.webp")" alt="@(ScoreUtils.GetRankText(context.BestScoreRank))" title="@(ScoreUtils.GetRankText(context.BestScoreRank))" style="@Constants.ICON_STYLE" />
|
|
}
|
|
</MudTd>
|
|
@* <MudTd>
|
|
<MudText Typo="Typo.body2">@context.GoodCount</MudText>
|
|
</MudTd>
|
|
<MudTd>
|
|
<MudText Typo="Typo.body2">@context.OkCount</MudText>
|
|
</MudTd>
|
|
<MudTd>
|
|
<MudText Typo="Typo.body2">@context.MissCount</MudText>
|
|
</MudTd>
|
|
<MudTd>
|
|
<MudText Typo="Typo.body2">@context.DrumrollCount</MudText>
|
|
</MudTd>
|
|
<MudTd>
|
|
<MudText Typo="Typo.body2">@context.ComboCount</MudText>
|
|
</MudTd> *@
|
|
<MudTd>
|
|
<MudText Typo="Typo.body2">@context.PlayTime</MudText>
|
|
</MudTd>
|
|
</RowTemplate>
|
|
<PagerContent>
|
|
<MudTablePager RowsPerPageString=@Localizer["Rows Per Page:"] />
|
|
</PagerContent>
|
|
</MudTable>
|
|
}
|
|
else
|
|
{
|
|
<MudGrid>
|
|
<MudItem xs="12">
|
|
<MudText Align="Align.Center" Class="my-8">
|
|
@Localizer["No Data"]
|
|
</MudText>
|
|
</MudItem>
|
|
</MudGrid>
|
|
}
|
|
</MudTabPanel>
|
|
}
|
|
}
|
|
</MudTabs>
|
|
</MudItem>
|
|
}
|
|
}
|
|
</MudGrid> |