1
0
mirror of synced 2024-11-24 06:50:15 +01:00
TaikoLocalServer/TaikoWebUI/Pages/TaikoMode.razor

122 lines
8.5 KiB
Plaintext

@inject IGameDataService GameDataService
@inject HttpClient Client
@page "/Cards/{baid:int}/TaikoMode"
<MudBreadcrumbs Items="breadcrumbs" Class="px-0"></MudBreadcrumbs>
<h1>Taiko Mode</h1>
<MudText Typo="Typo.caption">Card: @Baid</MudText>
<MudGrid Class="my-8">
@if (response is null)
{
<MudItem xs="12">
<MudText Align="Align.Center">
No data.
</MudText>
</MudItem>
}
else
{
<MudItem xs="12">
<MudTabs Elevation="0" Border="true" Rounded="true" ApplyEffectsToContainer="true" Outlined="true" Class="mb-10">
@foreach (var difficulty in Enum.GetValues<Difficulty>())
{
@if (difficulty is not Difficulty.None)
{
<MudTabPanel Text="@GetDifficultyTitle(difficulty)"
Icon="@GetDifficultyIcon(difficulty)">
@if (songBestDataMap.ContainsKey(difficulty))
{
<MudDataGrid Items="@songBestDataMap[difficulty]"
ColumnResizeMode="ResizeMode.Container" RowsPerPage="25" Elevation="0">
<Columns>
<Column T="SongBestData" Field="@nameof(SongBestData.SongId)" Title="Song" StickyLeft="true" Class="clm-row-large">
<CellTemplate>
<MudGrid Justify="Justify.Center">
<MudItem xs="10">
<MudStack Spacing="0">
<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">
<MudStack Justify="Justify.Center" AlignItems="AlignItems.End" Style="height:100%">
<MudTooltip Text="@(context.Item.IsFavorite ? "Remove from favorites" : "Add to favorites")" Arrow="true" Placement="Placement.Top">
<MudToggleIconButton Toggled="@context.Item.IsFavorite"
ToggledChanged="@(async () => await OnFavoriteToggled(context.Item))"
Icon="@Icons.Material.Filled.FavoriteBorder" Color="@Color.Secondary"
ToggledIcon="@Icons.Material.Filled.Favorite" ToggledColor="@Color.Secondary"
Size="Size.Small"
ToggledSize="Size.Small"/>
</MudTooltip>
</MudStack>
</MudItem>
</MudGrid>
</CellTemplate>
</Column>
<Column T="SongBestData" Field="@nameof(SongBestData.SongId)" Title="Level" Sortable="false">
<CellTemplate>
<MudStack Row="true" Spacing="1" AlignItems="AlignItems.Center">
<MudIcon Icon="@Icons.Filled.Star" Size="Size.Small" />
<MudText Typo="Typo.caption" Style="line-height:1;margin-top:2px;margin-right:2px;">@GameDataService.GetMusicStarLevel(@context.Item.SongId, difficulty)</MudText>
</MudStack>
</CellTemplate>
</Column>
<Column T="SongBestData" Field="@nameof(SongBestData.Genre)" Title="Genre"
Sortable="false" Filterable="true">
<CellTemplate>
<MudChip Style="@GetGenreStyle(context.Item.Genre)"
Size="Size.Small">
@GetGenreTitle(context.Item.Genre)
</MudChip>
</CellTemplate>
</Column>
<Column T="SongBestData" Field="@nameof(SongBestData.BestScore)" Title="Best Score"/>
<Column T="SongBestData" Field="@nameof(SongBestData.BestCrown)" Title="Best Crown">
<CellTemplate>
<MudTooltip Text="@(GetCrownText(context.Item.BestCrown))" Arrow="true" Placement="Placement.Top">
<img src="@($"/images/crown_{context.Item.BestCrown}.png")" alt="@(context.Item.BestCrown)" style="@IconStyle"/>
</MudTooltip>
</CellTemplate>
</Column>
<Column T="SongBestData" Field="@nameof(SongBestData.BestScoreRank)" Title="Best Rank" Sortable="false">
<CellTemplate>
@if (context.Item.BestScoreRank is not ScoreRank.None)
{
<MudTooltip Text="@(GetRankText(context.Item.BestScoreRank))" Arrow="true" Placement="Placement.Top">
<img src="@($"/images/rank_{context.Item.BestScoreRank}.png")" alt="@(context.Item.BestScoreRank)" style="@IconStyle"/>
</MudTooltip>
}
</CellTemplate>
</Column>
<Column T="SongBestData" Field="@nameof(SongBestData.GoodCount)" Title="Good" Sortable="false"/>
<Column T="SongBestData" Field="@nameof(SongBestData.OkCount)" Title="OK" Sortable="false"/>
<Column T="SongBestData" Field="@nameof(SongBestData.MissCount)" Title="Bad" Sortable="false"/>
<Column T="SongBestData" Field="@nameof(SongBestData.DrumrollCount)" Title="Drumroll" Sortable="false"/>
<Column T="SongBestData" Field="@nameof(SongBestData.ComboCount)" Title="MAX Combo" Sortable="false"/>
<Column T="SongBestData" Field="@nameof(SongBestData.LastPlayTime)" Title="Last Played"/>
</Columns>
<PagerContent>
<MudDataGridPager T="SongBestData"/>
</PagerContent>
</MudDataGrid>
}
else
{
<MudGrid>
<MudItem xs="12">
<MudText Align="Align.Center" Class="my-16">
No data for selected difficulty.
</MudText>
</MudItem>
</MudGrid>
}
</MudTabPanel>
}
}
</MudTabs>
</MudItem>
}
</MudGrid>