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

Add total score and hits to dan dojo page

This commit is contained in:
shiibe 2022-10-15 17:45:01 -04:00
parent 059d053ea7
commit 30df91771e
3 changed files with 181 additions and 75 deletions

View File

@ -17,4 +17,6 @@ public class DanBestStageData
public uint TotalHitCount { get; set; } public uint TotalHitCount { get; set; }
public uint ComboCount { get; set; } public uint ComboCount { get; set; }
public uint HighScore { get; set; }
} }

View File

@ -20,7 +20,7 @@
<MudTabPanel Text="@GetDanTitle(danData.Title)" Icon="@GetDanResultIcon(danId)"> <MudTabPanel Text="@GetDanTitle(danData.Title)" Icon="@GetDanResultIcon(danId)">
<MudText Typo="Typo.h5" Class="mb-4">Details</MudText> <MudText Typo="Typo.h5" Class="mb-4">Details</MudText>
<MudGrid Class="d-flex"> <MudGrid Class="d-flex">
<MudItem xs="12" sm="12" md="3" Class="pb-1"> <MudItem xs="12" sm="12" md="4" Class="pb-1">
<MudCard Outlined="true" Style="height:100%;"> <MudCard Outlined="true" Style="height:100%;">
<MudCardHeader Class="pb-0"> <MudCardHeader Class="pb-0">
<CardHeaderContent> <CardHeaderContent>
@ -34,83 +34,152 @@
var danClearStateString = GetDanClearStateString(danResultState); var danClearStateString = GetDanClearStateString(danResultState);
} }
<img src=@($"/images/dani_{danResultState.ToString()}.png") style="max-width:150px; width:100%;" alt="danResultState.ToString()"/> <img src=@($"/images/dani_{danResultState.ToString()}.png") style="max-width:150px; width:100%;" alt="danResultState.ToString()"/>
<MudText Typo="Typo.body1">@danClearStateString</MudText>
</MudStack> </MudStack>
</MudCardContent> </MudCardContent>
</MudCard> </MudCard>
</MudItem> </MudItem>
<MudItem xs="12" sm="12" md="9">
<MudItem xs="12" sm="12" md="8" Class="pb-1">
<MudStack>
<MudCard Outlined="true">
<MudCardHeader Class="pb-0">
<CardHeaderContent>
<MudText Typo="Typo.h6">High Score</MudText>
</CardHeaderContent>
</MudCardHeader>
<MudCardContent Class="d-flex py-10" Style="justify-content:center">
@{
var totalScore = GetTotalScore(danId);
}
<MudStack Row="true" Spacing="4" Justify="Justify.SpaceEvenly" Style="width:100%">
<MudText Typo="Typo.h4">@totalScore</MudText>
</MudStack>
</MudCardContent>
</MudCard>
<MudCard Outlined="true">
<MudCardHeader Class="pb-0">
<CardHeaderContent>
<MudText Typo="Typo.h6">Totals</MudText>
</CardHeaderContent>
</MudCardHeader>
<MudCardContent Class="d-flex py-10" Style="justify-content:center">
@{
var totalGoods = GetTotalGoodHits(danId);
var totalOks = GetTotalOkHits(danId);
var totalBads = GetTotalBadHits(danId);
var totalDrumroll = GetTotalDrumrollHits(danId);
var totalMaxCombo = GetTotalMaxCombo(danId);
var totalHits = GetTotalHits(danId);
}
<MudStack Row="true" Spacing="4" Justify="Justify.SpaceEvenly" Style="width:100%">
<MudCard Elevation="0">
<MudText Typo="Typo.caption">Good</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold;">@totalGoods</MudText>
</MudCard>
<MudCard Elevation="0">
<MudText Typo="Typo.caption">OK</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold;">@totalOks</MudText>
</MudCard>
<MudCard Elevation="0">
<MudText Typo="Typo.caption">Bad</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold;">@totalBads</MudText>
</MudCard>
<MudCard Elevation="0">
<MudText Typo="Typo.caption">Drumroll</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold;">@totalDrumroll</MudText>
</MudCard>
<MudCard Elevation="0">
<MudText Typo="Typo.caption">MAX Combo</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold;">@totalMaxCombo</MudText>
</MudCard>
<MudCard Elevation="0">
<MudText Typo="Typo.caption">Total Hits</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold;">@totalHits</MudText>
</MudCard>
</MudStack>
</MudCardContent>
</MudCard>
</MudStack>
</MudItem>
</MudGrid>
<MudText Typo="Typo.h5" Class="mt-10 mb-4">Songs</MudText>
<MudGrid>
<MudItem xs="12">
<MudGrid Class="d-block"> <MudGrid Class="d-block">
@for (uint j = 0; j <= 2; j++) @for (uint j = 0; j <= 2; j++)
{ {
var index = (int)j; var index = (int)j;
var danDataOdaiSong = danData.OdaiSongList[index]; var danDataOdaiSong = danData.OdaiSongList[index];
var stageNumber = j + 1; var stageNumber = j + 1;
var difficulty = (Difficulty)danDataOdaiSong.Level; var difficulty = (Difficulty)danDataOdaiSong.Level;
<MudItem xs="12" Class="pb-1"> <MudItem xs="12" Class="pb-1">
<MudCard Outlined="true" Class="pa-4"> <MudCard Outlined="true" Class="pa-4">
<MudGrid Style="display:flex; align-items: center; justify-content: flex-start;"> <MudGrid Style="display:flex; align-items: center; justify-content: flex-start;">
<MudItem xs="1" md="1" Style="display:flex;flex-direction:column;align-items:center;"> <MudItem xs="1" md="1" Style="display:flex;flex-direction:column;align-items:center;">
<h3>@stageNumber</h3> <h3>@stageNumber</h3>
</MudItem> </MudItem>
<MudItem xs="2" md="1" Style="display:flex;flex-direction:column;align-items:center;"> <MudItem xs="2" md="1" Style="display:flex;flex-direction:column;align-items:center;">
<MudTooltip Text="@difficulty.ToString()" Placement="Placement.Top" Arrow="true"> <MudTooltip Text="@difficulty.ToString()" Placement="Placement.Top" Arrow="true">
<img src=@($"/images/difficulty_{difficulty}.png") style="width:40px;height:40px;margin-bottom:2px;" alt="@difficulty" /> <img src=@($"/images/difficulty_{difficulty}.png") style="width:40px;height:40px;margin-bottom:2px;" alt="@difficulty" />
</MudTooltip> </MudTooltip>
<MudStack Row="true" Spacing="1" Justify="Justify.Center" AlignItems="AlignItems.Center"> <MudStack Row="true" Spacing="1" Justify="Justify.Center" AlignItems="AlignItems.Center">
<MudIcon Icon="@Icons.Filled.Star" Size="Size.Small" /> <MudIcon Icon="@Icons.Filled.Star" Size="Size.Small" />
<MudText Typo="Typo.caption" Style="line-height:1;margin-top:2px;margin-right:2px;">@GameDataService.GetMusicStarLevel(danDataOdaiSong.SongNo, difficulty)</MudText> <MudText Typo="Typo.caption" Style="line-height:1;margin-top:2px;margin-right:2px;">@GameDataService.GetMusicStarLevel(danDataOdaiSong.SongNo, difficulty)</MudText>
</MudStack> </MudStack>
</MudItem> </MudItem>
<MudItem xs="9" md="4" Style="display:flex;flex-direction:column;" Class="pl-4"> <MudItem xs="9" md="4" Style="display:flex;flex-direction:column;" Class="pl-4">
<MudText Typo="Typo.body1" Style="font-weight: bold;">@GameDataService.GetMusicNameBySongId(danDataOdaiSong.SongNo)</MudText> <MudText Typo="Typo.body1" Style="font-weight: bold;">@GameDataService.GetMusicNameBySongId(danDataOdaiSong.SongNo)</MudText>
<MudText Typo="Typo.caption">@GameDataService.GetMusicArtistBySongId(danDataOdaiSong.SongNo)</MudText> <MudText Typo="Typo.caption">@GameDataService.GetMusicArtistBySongId(danDataOdaiSong.SongNo)</MudText>
</MudItem> </MudItem>
@if (bestDataMap.ContainsKey(danId)) @if (bestDataMap.ContainsKey(danId))
{ {
var danBestData = bestDataMap[danId]; var danBestData = bestDataMap[danId];
if (danBestData.DanBestStageDataList.Count > index) if (danBestData.DanBestStageDataList.Count > index)
{ {
var bestStage = danBestData.DanBestStageDataList[index]; var bestStage = danBestData.DanBestStageDataList[index];
<MudItem xs="12" md="6" Style="display:flex;flex-direction:column;">
<MudStack Row="true" Spacing="4" Justify="Justify.SpaceEvenly"> <MudItem xs="12" md="6" Style="display:flex;flex-direction:column;">
<MudCard Elevation="0"> <MudStack Row="true" Spacing="4" Justify="Justify.SpaceEvenly">
<MudText Typo="Typo.caption">Good</MudText> <MudCard Elevation="0">
<MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.GoodCount</MudText> <MudText Typo="Typo.caption">Good</MudText>
</MudCard> <MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.GoodCount</MudText>
<MudCard Elevation="0"> </MudCard>
<MudText Typo="Typo.caption">OK</MudText> <MudCard Elevation="0">
<MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.OkCount</MudText> <MudText Typo="Typo.caption">OK</MudText>
</MudCard> <MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.OkCount</MudText>
<MudCard Elevation="0"> </MudCard>
<MudText Typo="Typo.caption">Bad</MudText> <MudCard Elevation="0">
<MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.BadCount</MudText> <MudText Typo="Typo.caption">Bad</MudText>
</MudCard> <MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.BadCount</MudText>
<MudCard Elevation="0"> </MudCard>
<MudText Typo="Typo.caption">Drumroll</MudText> <MudCard Elevation="0">
<MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.DrumrollCount</MudText> <MudText Typo="Typo.caption">Drumroll</MudText>
</MudCard> <MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.DrumrollCount</MudText>
<MudCard Elevation="0"> </MudCard>
<MudText Typo="Typo.caption">MAX Combo</MudText> <MudCard Elevation="0">
<MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.ComboCount</MudText> <MudText Typo="Typo.caption">MAX Combo</MudText>
</MudCard> <MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.ComboCount</MudText>
<MudCard Elevation="0"> </MudCard>
<MudText Typo="Typo.caption">Total Hits</MudText> <MudCard Elevation="0">
<MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.TotalHitCount</MudText> <MudText Typo="Typo.caption">Total Hits</MudText>
</MudCard> <MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.TotalHitCount</MudText>
</MudStack> </MudCard>
</MudItem> </MudStack>
</MudItem>
} }
} }
</MudGrid> </MudGrid>
</MudCard> </MudCard>
</MudItem> </MudItem>
} }
</MudGrid> </MudGrid>
</MudItem> </MudItem>
</MudGrid> </MudGrid>

View File

@ -7,7 +7,7 @@ public partial class DaniDojo
private DanBestDataResponse? response; private DanBestDataResponse? response;
private Dictionary<uint, DanBestData> bestDataMap = new(); private static Dictionary<uint, DanBestData> bestDataMap = new();
private readonly List<BreadcrumbItem> breadcrumbs = new() private readonly List<BreadcrumbItem> breadcrumbs = new()
{ {
@ -129,15 +129,15 @@ public partial class DaniDojo
"3kyuu" => "Third Kyuu", "3kyuu" => "Third Kyuu",
"2kyuu" => "Second Kyuu", "2kyuu" => "Second Kyuu",
"1kyuu" => "First Kyuu", "1kyuu" => "First Kyuu",
"1dan" => "First Dan", "1dan" => "First Dan",
"2dan" => "Second Dan", "2dan" => "Second Dan",
"3dan" => "Third Dan", "3dan" => "Third Dan",
"4dan" => "Fourth Dan", "4dan" => "Fourth Dan",
"5dan" => "Fifth Dan", "5dan" => "Fifth Dan",
"6dan" => "Sixth Dan", "6dan" => "Sixth Dan",
"7dan" => "Seventh Dan", "7dan" => "Seventh Dan",
"8dan" => "Eighth Dan", "8dan" => "Eighth Dan",
"9dan" => "Ninth Dan", "9dan" => "Ninth Dan",
"10dan" => "Tenth Dan", "10dan" => "Tenth Dan",
"11dan" => "Kuroto", "11dan" => "Kuroto",
"12dan" => "Meijin", "12dan" => "Meijin",
@ -155,7 +155,7 @@ public partial class DaniDojo
if (!bestDataMap.ContainsKey(danId)) if (!bestDataMap.ContainsKey(danId))
{ {
return notClearIcon; return notClearIcon;
} }
var state = bestDataMap[danId].ClearState; var state = bestDataMap[danId].ClearState;
@ -191,4 +191,39 @@ public partial class DaniDojo
return conditionOperator; return conditionOperator;
} }
private static long GetTotalScore(uint danId)
{
return bestDataMap.ContainsKey(danId) ? bestDataMap[danId].DanBestStageDataList.Sum(stageData => stageData.HighScore) : 0;
}
private static long GetTotalGoodHits(uint danId)
{
return bestDataMap.ContainsKey(danId) ? bestDataMap[danId].DanBestStageDataList.Sum(stageData => stageData.GoodCount) : 0;
}
private static long GetTotalOkHits(uint danId)
{
return bestDataMap.ContainsKey(danId) ? bestDataMap[danId].DanBestStageDataList.Sum(stageData => stageData.OkCount) : 0;
}
private static long GetTotalBadHits(uint danId)
{
return bestDataMap.ContainsKey(danId) ? bestDataMap[danId].DanBestStageDataList.Sum(stageData => stageData.BadCount) : 0;
}
private static long GetTotalDrumrollHits(uint danId)
{
return bestDataMap.ContainsKey(danId) ? bestDataMap[danId].DanBestStageDataList.Sum(stageData => stageData.DrumrollCount) : 0;
}
private static long GetTotalMaxCombo(uint danId)
{
return bestDataMap.ContainsKey(danId) ? bestDataMap[danId].DanBestStageDataList.Sum(stageData => stageData.ComboCount) : 0;
}
private static long GetTotalHits(uint danId)
{
return bestDataMap.ContainsKey(danId) ? bestDataMap[danId].DanBestStageDataList.Sum(stageData => stageData.TotalHitCount) : 0;
}
} }