1
0
mirror of synced 2024-11-28 00:20:53 +01:00

Add AI battle sub-table (wip)

This commit is contained in:
shiibe 2022-09-22 22:53:35 -04:00
parent 5d904c1ed7
commit bc16918d49
3 changed files with 43 additions and 17 deletions

View File

@ -44,4 +44,6 @@ public class SongBestData
public uint DrumrollCount { get; set; } public uint DrumrollCount { get; set; }
public List<AiSectionBestData> AiSectionBestData { get; set; } public List<AiSectionBestData> AiSectionBestData { get; set; }
public bool ShowAiData { get; set; } = false;
} }

View File

@ -30,7 +30,7 @@
@if (songBestDataMap.ContainsKey(difficulty)) @if (songBestDataMap.ContainsKey(difficulty))
{ {
<MudDataGrid Items="@songBestDataMap[difficulty]" <MudDataGrid Items="@songBestDataMap[difficulty]"
ColumnResizeMode="ResizeMode.None" RowsPerPage="25" Elevation="0" ShowMenuIcon="true"> ColumnResizeMode="ResizeMode.None" RowsPerPage="25" Elevation="0">
<Columns> <Columns>
<Column T="SongBestData" Field="@nameof(SongBestData.SongId)" Title="Song" StickyLeft="true"> <Column T="SongBestData" Field="@nameof(SongBestData.SongId)" Title="Song" StickyLeft="true">
<CellTemplate> <CellTemplate>
@ -51,7 +51,7 @@
</MudStack> </MudStack>
</CellTemplate> </CellTemplate>
</Column> </Column>
<Column T="SongBestData" Field="@nameof(SongBestData.SongId)" Title="Level" Sortable="false" Hideable="true"> <Column T="SongBestData" Field="@nameof(SongBestData.SongId)" Title="Level" Sortable="false">
<CellTemplate> <CellTemplate>
<MudStack Row="true" Spacing="1" AlignItems="AlignItems.Center"> <MudStack Row="true" Spacing="1" AlignItems="AlignItems.Center">
<MudIcon Icon="@Icons.Filled.Star" Size="Size.Small" /> <MudIcon Icon="@Icons.Filled.Star" Size="Size.Small" />
@ -60,7 +60,7 @@
</CellTemplate> </CellTemplate>
</Column> </Column>
<Column T="SongBestData" Field="@nameof(SongBestData.Genre)" Title="Genre" <Column T="SongBestData" Field="@nameof(SongBestData.Genre)" Title="Genre"
Sortable="false" Filterable="true" Hideable="true"> Sortable="false" Filterable="true">
<CellTemplate> <CellTemplate>
<MudChip Style="@GetGenreStyle(context.Item.Genre)" <MudChip Style="@GetGenreStyle(context.Item.Genre)"
Size="Size.Small"> Size="Size.Small">
@ -68,13 +68,13 @@
</MudChip> </MudChip>
</CellTemplate> </CellTemplate>
</Column> </Column>
<Column T="SongBestData" Field="@nameof(SongBestData.BestScore)" Title="Best Score" Hideable="true" /> <Column T="SongBestData" Field="@nameof(SongBestData.BestScore)" Title="Best Score" />
<Column T="SongBestData" Field="@nameof(SongBestData.BestCrown)" Title="Best Crown" Hideable="true"> <Column T="SongBestData" Field="@nameof(SongBestData.BestCrown)" Title="Best Crown">
<CellTemplate> <CellTemplate>
<img src="@($"/images/crown_{context.Item.BestCrown}.png")" alt="@(GetCrownText(context.Item.BestCrown))" title="@(GetCrownText(context.Item.BestCrown))" style="@IconStyle" /> <img src="@($"/images/crown_{context.Item.BestCrown}.png")" alt="@(GetCrownText(context.Item.BestCrown))" title="@(GetCrownText(context.Item.BestCrown))" style="@IconStyle" />
</CellTemplate> </CellTemplate>
</Column> </Column>
<Column T="SongBestData" Field="@nameof(SongBestData.BestScoreRank)" Title="Best Rank" Sortable="false" Hideable="true"> <Column T="SongBestData" Field="@nameof(SongBestData.BestScoreRank)" Title="Best Rank" Sortable="false">
<CellTemplate> <CellTemplate>
@if (context.Item.BestScoreRank is not ScoreRank.None) @if (context.Item.BestScoreRank is not ScoreRank.None)
{ {
@ -82,17 +82,33 @@
} }
</CellTemplate> </CellTemplate>
</Column> </Column>
<Column T="SongBestData" Field="@nameof(SongBestData.GoodCount)" Title="Good" Sortable="false" Hideable="true" /> <Column T="SongBestData" Field="@nameof(SongBestData.GoodCount)" Title="Good" Sortable="false" />
<Column T="SongBestData" Field="@nameof(SongBestData.OkCount)" Title="OK" Sortable="false" Hideable="true" /> <Column T="SongBestData" Field="@nameof(SongBestData.OkCount)" Title="OK" Sortable="false" />
<Column T="SongBestData" Field="@nameof(SongBestData.MissCount)" Title="Bad" Sortable="false" Hideable="true" /> <Column T="SongBestData" Field="@nameof(SongBestData.MissCount)" Title="Bad" Sortable="false" />
<Column T="SongBestData" Field="@nameof(SongBestData.DrumrollCount)" Title="Drumroll" Sortable="false"Hideable="true"/> <Column T="SongBestData" Field="@nameof(SongBestData.DrumrollCount)" Title="Drumroll" Sortable="false"/>
<Column T="SongBestData" Field="@nameof(SongBestData.ComboCount)" Title="MAX Combo" Sortable="false" Hideable="true" /> <Column T="SongBestData" Field="@nameof(SongBestData.ComboCount)" Title="MAX Combo" Sortable="false" />
<Column T="SongBestData" Field="@nameof(SongBestData.ShowAiData)" Title="AI Battle Data">
<CellTemplate>
<MudButton Variant="Variant.Outlined" Size="Size.Small" OnClick="@(()=> ToggleShowAiData(context.Item))">@((context.Item.ShowAiData == true) ? "Hide" : "Show")</MudButton>
</CellTemplate>
</Column>
<Column T="SongBestData" Field="@nameof(SongBestData.LastPlayTime)" Title="Last Played" Hideable="true" /> <Column T="SongBestData" Field="@nameof(SongBestData.LastPlayTime)" Title="Last Played" Hideable="true" />
<Column T="SongBestData" Field="@nameof(SongBestData.PlayCount)" Title="Total Plays" Hideable="true" /> <Column T="SongBestData" Field="@nameof(SongBestData.PlayCount)" Title="Total Plays" Hideable="true" />
<Column T="SongBestData" Field="@nameof(SongBestData.ClearCount)" Title="Total Clears" Hideable="true" /> <Column T="SongBestData" Field="@nameof(SongBestData.ClearCount)" Title="Total Clears" Hideable="true" />
<Column T="SongBestData" Field="@nameof(SongBestData.FullComboCount)" Title="Total Full Combos" Hideable="true" /> <Column T="SongBestData" Field="@nameof(SongBestData.FullComboCount)" Title="Total Full Combos" Hideable="true" />
<Column T="SongBestData" Field="@nameof(SongBestData.PerfectCount)" Title="Total Donderful Combos" Hideable="true" /> <Column T="SongBestData" Field="@nameof(SongBestData.PerfectCount)" Title="Total Donderful Combos" Hideable="true" />
</Columns> </Columns>
<ChildRowContent>
@if (context.Item.ShowAiData)
{
<MudTr>
<td colspan="1" />
<td colspan="16">
<MudTable Elevation="0" ReadOnly="true" Items="@context.Item.AiSectionBestData" Context="AiSectionBestData" />
</td>
</MudTr>
}
</ChildRowContent>
<PagerContent> <PagerContent>
<MudDataGridPager T="SongBestData"/> <MudDataGridPager T="SongBestData"/>
</PagerContent> </PagerContent>

View File

@ -1,4 +1,7 @@
namespace TaikoWebUI.Pages; using static MudBlazor.Colors;
using System;
namespace TaikoWebUI.Pages;
public partial class TaikoMode public partial class TaikoMode
{ {
@ -135,5 +138,10 @@ public partial class TaikoMode
_ => "" _ => ""
}; };
} }
private static void ToggleShowAiData(SongBestData data)
{
data.ShowAiData = !data.ShowAiData;
}
} }