1
0
mirror of synced 2024-11-23 22:41:01 +01:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
asesidaa 2022-10-20 02:30:44 +08:00
commit e30d362e63
3 changed files with 190 additions and 78 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>
@ -39,78 +39,148 @@
</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>
@ -227,8 +297,11 @@
resultText = "Gold"; resultText = "Gold";
} }
<MudProgressLinear Class="@barClass" Rounded="true" Size="Size.Large" Max="@redRequirement" Value="@(redRequirement - bestData)"> var resultValue = redRequirement - bestData;
<MudText Typo="Typo.caption">@(redRequirement - bestData)</MudText> if (resultValue < 0) resultValue = 0;
<MudProgressLinear Class="@barClass" Rounded="true" Size="Size.Large" Max="@redRequirement" Value="@resultValue">
<MudText Typo="Typo.caption">@resultValue</MudText>
</MudProgressLinear> </MudProgressLinear>
<MudText Typo="Typo.caption" Style="text-align: right">@resultText</MudText> <MudText Typo="Typo.caption" Style="text-align: right">@resultText</MudText>
} }
@ -316,9 +389,11 @@
barClass = "bar-pass-gold"; barClass = "bar-pass-gold";
resultText = "Gold"; resultText = "Gold";
} }
var resultValue = redRequirement - bestData;
if (resultValue < 0) resultValue = 0;
<MudProgressLinear Class="@barClass" Rounded="true" Size="Size.Large" Max="@redRequirement" Value="@(redRequirement - bestData)"> <MudProgressLinear Class="@barClass" Rounded="true" Size="Size.Large" Max="@redRequirement" Value="@resultValue">
<MudText Typo="Typo.caption">@(redRequirement - bestData)</MudText> <MudText Typo="Typo.caption">@resultValue</MudText>
</MudProgressLinear> </MudProgressLinear>
<MudText Typo="Typo.caption" Style="text-align: right">@resultText</MudText> <MudText Typo="Typo.caption" Style="text-align: right">@resultText</MudText>
} }

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()
{ {
@ -64,7 +64,7 @@ public partial class DaniDojo
return GetDanRequirementString(danConditionType); return GetDanRequirementString(danConditionType);
} }
private static long GetAllBestFromData(DanConditionType type, DanBestData data) private static long GetAllBestFromData(DanConditionType type, DanBestData data)
{ {
return type switch return type switch
@ -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,11 +155,11 @@ 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;
icon = state is DanClearState.NotClear ? notClearIcon : $"<image href='/images/dani_{state}.png' width='24' height='24' />"; icon = state is DanClearState.NotClear ? notClearIcon : $"<image href='/images/dani_{state}.png' width='24' height='24' />";
return icon; return icon;
@ -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;
}
} }