1
0
mirror of synced 2024-11-25 15:20:26 +01:00
TaikoLocalServer/TaikoWebUI/Pages/DaniDojo.razor

479 lines
40 KiB
Plaintext
Raw Normal View History

2022-09-11 18:28:12 +02:00
@inject IGameDataService GameDataService
2022-09-10 23:56:48 +02:00
@inject HttpClient Client
2023-10-16 11:38:27 +02:00
@inject LoginService LoginService
2022-09-10 23:56:48 +02:00
@page "/Users/{baid:int}/DaniDojo"
2022-09-10 23:56:48 +02:00
<MudBreadcrumbs Items="breadcrumbs" Class="px-0"></MudBreadcrumbs>
<h1>Dani Dojo</h1>
<MudText Typo="Typo.caption">User: @Baid</MudText>
2022-09-10 23:56:48 +02:00
@if (LoginService.LoginRequired && (!LoginService.IsLoggedIn || (LoginService.GetLoggedInUser().Baid != Baid && !LoginService.IsAdmin)))
2023-10-16 11:38:27 +02:00
{
2022-09-11 23:32:24 +02:00
<MudItem xs="12">
2023-10-16 11:38:27 +02:00
<MudText Align="Align.Center" Class="my-8">
Please log in by clicking on "Users" tab first.
2023-10-16 11:38:27 +02:00
</MudText>
</MudItem>
}
else
{
<MudGrid Class="my-4 pb-10">
<MudItem xs="12">
<MudPaper Elevation="0" Outlined="true">
<MudTabs ActivePanelIndex="0" Rounded="true" Border="true" PanelClass="pa-8">
@for (uint i = 1; i <= 19; i++)
{
var danId = i;
var danData = GameDataService.GetDanDataById(danId);
2023-10-16 11:38:27 +02:00
<MudTabPanel Text="@GetDanTitle(danData.Title)" Icon="@GetDanResultIcon(danId)">
<MudText Typo="Typo.h5" Class="mb-4">Details</MudText>
<MudGrid Class="d-flex">
<MudItem xs="12" sm="12" md="4" Class="pb-1">
<MudCard Outlined="true" Style="height:100%;">
<MudCardHeader Class="pb-0">
<CardHeaderContent>
2023-10-16 11:38:27 +02:00
<MudText Typo="Typo.h6">Result</MudText>
</CardHeaderContent>
</MudCardHeader>
2023-10-16 11:38:27 +02:00
<MudCardContent Class="d-flex py-10" Style="justify-content:center;">
<MudStack Justify="Justify.Center" AlignItems="AlignItems.Center" Spacing="6">
@{
var danResultState = GetDanResultState(danId);
var danClearStateString = GetDanClearStateString(danResultState);
}
<img src=@($"/images/dani_{danResultState.ToString()}.png") style="max-width:150px; width:100%;" alt="danResultState.ToString()"/>
<MudText Typo="Typo.body1">@danClearStateString</MudText>
</MudStack>
</MudCardContent>
</MudCard>
2023-10-16 11:38:27 +02:00
</MudItem>
2022-09-12 00:12:11 +02:00
2023-10-16 11:38:27 +02:00
<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>
2022-09-12 00:12:11 +02:00
2023-10-16 11:38:27 +02:00
<MudText Typo="Typo.h5" Class="mt-10 mb-4">Songs</MudText>
<MudGrid>
<MudItem xs="12">
<MudGrid Class="d-block">
@for (uint j = 0; j <= 2; j++)
{
var index = (int)j;
var danDataOdaiSong = danData.OdaiSongList[index];
var stageNumber = j + 1;
var difficulty = (Difficulty)danDataOdaiSong.Level;
2022-09-12 23:15:27 +02:00
2023-10-16 11:38:27 +02:00
<MudItem xs="12" Class="pb-1">
<MudCard Outlined="true" Class="pa-4">
<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;">
<h3>@stageNumber</h3>
</MudItem>
2023-10-16 11:38:27 +02:00
<MudItem xs="2" md="1" Style="display:flex;flex-direction:column;align-items:center;">
<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" />
</MudTooltip>
<MudStack Row="true" Spacing="1" Justify="Justify.Center" 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(danDataOdaiSong.SongNo, difficulty)</MudText>
</MudStack>
</MudItem>
2022-09-12 16:17:15 +02:00
2023-10-16 11:38:27 +02:00
<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.caption">@GameDataService.GetMusicArtistBySongId(danDataOdaiSong.SongNo)</MudText>
</MudItem>
2022-09-12 00:12:11 +02:00
@if (bestDataMap.TryGetValue(danId, out var danBestData))
2022-09-12 17:49:28 +02:00
{
2023-10-16 11:38:27 +02:00
if (danBestData.DanBestStageDataList.Count > index)
{
var bestStage = danBestData.DanBestStageDataList[index];
2022-09-12 17:49:28 +02:00
2023-10-16 11:38:27 +02:00
<MudItem xs="12" md="6" Style="display:flex;flex-direction:column;">
<MudStack Row="true" Spacing="4" Justify="Justify.SpaceEvenly">
<MudCard Elevation="0">
<MudText Typo="Typo.caption">Good</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.GoodCount</MudText>
</MudCard>
<MudCard Elevation="0">
<MudText Typo="Typo.caption">OK</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.OkCount</MudText>
</MudCard>
<MudCard Elevation="0">
<MudText Typo="Typo.caption">Bad</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.BadCount</MudText>
</MudCard>
<MudCard Elevation="0">
<MudText Typo="Typo.caption">Drumroll</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.DrumrollCount</MudText>
</MudCard>
<MudCard Elevation="0">
<MudText Typo="Typo.caption">MAX Combo</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.ComboCount</MudText>
</MudCard>
<MudCard Elevation="0">
<MudText Typo="Typo.caption">Total Hits</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold;">@bestStage.TotalHitCount</MudText>
</MudCard>
</MudStack>
</MudItem>
2022-09-12 17:49:28 +02:00
}
}
2023-10-16 11:38:27 +02:00
</MudGrid>
</MudCard>
</MudItem>
}
</MudGrid>
</MudItem>
</MudGrid>
2022-09-12 00:12:11 +02:00
2023-10-16 11:38:27 +02:00
<MudText Typo="Typo.h5" Class="mt-10 mb-4">Conditions</MudText>
<MudGrid>
<MudItem xs="12" Class="dani-results">
<MudGrid>
<MudItem xs="12" md="3">
<MudCard Outlined="true" Class="pa-2">
<MudCardHeader>
<CardHeaderContent>
2023-10-16 11:38:27 +02:00
<MudText Typo="Typo.h6">Soul Gauge</MudText>
</CardHeaderContent>
</MudCardHeader>
<MudCardContent>
2023-10-16 11:38:27 +02:00
<MudStack Spacing="8">
@{
var redRequirement = GetSoulGauge(danData, false);
var goldRequirement = GetSoulGauge(danData, true);
var barClass = "bar-default";
var resultText = "Failed";
}
<MudStack Spacing="1">
<MudText Typo="Typo.subtitle2" Style="font-weight:bold;">Result</MudText>
@if (bestDataMap.TryGetValue(danId, out var danBestData))
{
if (danBestData.SoulGaugeTotal >= redRequirement) {
barClass = "bar-pass-red";
resultText = "Pass";
}
2023-10-16 11:38:27 +02:00
if (danBestData.SoulGaugeTotal >= goldRequirement) {
barClass = "bar-pass-gold";
resultText = "Gold";
2022-09-12 16:17:15 +02:00
}
2023-10-16 11:38:27 +02:00
<MudProgressLinear Class="@barClass" Rounded="true" Size="Size.Large" Max="100" Value="@danBestData.SoulGaugeTotal">
<MudText Typo="Typo.caption">@danBestData.SoulGaugeTotal%</MudText>
</MudProgressLinear>
<MudText Typo="Typo.caption" Style="text-align: right">@resultText</MudText>
} else {
<MudProgressLinear Class="@barClass" Rounded="true" Size="Size.Large" Max="100" Value="0">
<MudText Typo="Typo.caption">0%</MudText>
</MudProgressLinear>
<MudText Typo="Typo.caption" Style="text-align: right">N/A</MudText>
}
</MudStack>
<MudStack Spacing="1">
<MudText Typo="Typo.subtitle2" Style="font-weight:bold">Conditions</MudText>
<MudStack Row="true" Spacing="16">
<MudStack Spacing="0">
<MudText Typo="Typo.caption">Red</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold">> @redRequirement%</MudText>
</MudStack>
<MudStack Spacing="0">
<MudText Typo="Typo.caption">Gold</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold">> @goldRequirement%</MudText>
</MudStack>
2022-09-12 16:17:15 +02:00
</MudStack>
2023-10-16 11:38:27 +02:00
</MudStack>
</MudStack>
</MudCardContent>
</MudCard>
</MudItem>
2022-09-13 02:50:33 +02:00
2023-10-16 11:38:27 +02:00
<MudItem xs="12" md="9">
<MudStack Spacing="4">
@for (var j = 1; j < danData.OdaiBorderList.Count; j++)
{
var border = danData.OdaiBorderList[j];
<MudCard Outlined="true" Class="pa-2">
<MudCardHeader>
<CardHeaderContent>
<MudText Typo="Typo.h6">
@GetDanRequirementTitle(border)
</MudText>
</CardHeaderContent>
</MudCardHeader>
<MudCardContent>
@{
var borderType = (DanBorderType)border.BorderType;
}
@if (borderType == DanBorderType.All)
{
<MudStack Spacing="8">
@{
var redRequirement = border.RedBorderTotal;
var goldRequirement = border.GoldBorderTotal;
var barClass = "bar-default";
var resultText = "Failed";
}
<MudStack Spacing="1">
<MudText Typo="Typo.subtitle2" Style="font-weight:bold;">Result</MudText>
@if (bestDataMap.TryGetValue(danId, out var danBestData))
2022-09-13 02:50:33 +02:00
{
2023-10-16 11:38:27 +02:00
var bestData = GetAllBestFromData((DanConditionType)border.OdaiType, danBestData);
2022-10-03 01:41:10 +02:00
if ((DanConditionType)border.OdaiType is DanConditionType.BadCount or DanConditionType.OkCount)
2022-09-13 02:50:33 +02:00
{
if (bestData <= redRequirement)
{
barClass = "bar-pass-red";
2022-09-13 03:12:40 +02:00
resultText = "Pass";
2022-09-13 02:50:33 +02:00
}
if (bestData <= goldRequirement)
{
barClass = "bar-pass-gold";
resultText = "Gold";
}
2023-10-16 11:38:27 +02:00
var resultValue = redRequirement - bestData;
if (resultValue < 0) resultValue = 0;
2022-09-13 02:50:33 +02:00
<MudProgressLinear Class="@barClass" Rounded="true" Size="Size.Large" Max="@redRequirement" Value="@resultValue">
<MudText Typo="Typo.caption">@resultValue</MudText>
2022-09-13 02:50:33 +02:00
</MudProgressLinear>
<MudText Typo="Typo.caption" Style="text-align: right">@resultText</MudText>
2023-10-16 11:38:27 +02:00
}
else
2022-09-13 02:50:33 +02:00
{
if (bestData >= redRequirement)
{
barClass = "bar-pass-red";
2022-09-13 03:12:40 +02:00
resultText = "Pass";
2022-09-13 02:50:33 +02:00
}
if (bestData >= goldRequirement)
{
barClass = "bar-pass-gold";
resultText = "Gold";
}
2023-10-16 11:38:27 +02:00
<MudProgressLinear Class="@barClass" Rounded="true" Size="Size.Large" Max="@goldRequirement" Value="@bestData">
2022-09-13 02:50:33 +02:00
<MudText Typo="Typo.caption">@bestData</MudText>
</MudProgressLinear>
2023-10-16 11:38:27 +02:00
<MudText Typo="Typo.caption" Style="text-align: right">@resultText</MudText>
2022-09-13 02:50:33 +02:00
}
}
else
{
<MudProgressLinear Class="@barClass" Rounded="true" Size="Size.Large" Max="100" Value="0">
<MudText Typo="Typo.caption">0</MudText>
</MudProgressLinear>
2023-10-16 11:38:27 +02:00
<MudText Typo="Typo.caption" Style="text-align: right">N/A</MudText>
2022-09-13 02:50:33 +02:00
}
2023-10-16 11:38:27 +02:00
</MudStack>
@{
var conditionOperator = GetDanConditionOperator((DanConditionType)border.OdaiType);
}
<MudStack Spacing="1">
<MudText Typo="Typo.subtitle2" Style="font-weight:bold">Conditions</MudText>
<MudStack Row="true" Spacing="16">
<MudStack Spacing="0">
<MudText Typo="Typo.caption">Red</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold">@conditionOperator @redRequirement</MudText>
</MudStack>
<MudStack Spacing="0">
<MudText Typo="Typo.caption">Gold</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold">@conditionOperator @goldRequirement</MudText>
</MudStack>
</MudStack>
</MudStack>
</MudStack>
}
else
{
<MudGrid>
@for (var k = 0; k < 3; k++)
{
var songNumber = k;
var redRequirement = GetSongBorderCondition(border, songNumber, false);
var goldRequirement = GetSongBorderCondition(border, songNumber, true);
var barClass = "bar-default";
var resultText = "Failed";
<MudItem xs="12" md="4">
<MudCard Outlined="true">
<MudCardHeader>
<CardHeaderContent>
<MudText Typo="Typo.body1" Style="font-weight:bold">Stage @(songNumber + 1)</MudText>
</CardHeaderContent>
</MudCardHeader>
<MudCardContent>
<MudText Typo="Typo.subtitle2" Style="font-weight:bold;">Result</MudText>
@if (bestDataMap.TryGetValue(danId, out var danBestData))
{
var bestData = GetSongBestFromData((DanConditionType)border.OdaiType, danBestData, songNumber);
if ((DanConditionType)border.OdaiType is DanConditionType.BadCount or DanConditionType.OkCount)
{
if (bestData <= redRequirement)
{
barClass = "bar-pass-red";
resultText = "Pass";
}
if (bestData <= goldRequirement)
{
barClass = "bar-pass-gold";
resultText = "Gold";
}
var resultValue = redRequirement - bestData;
if (bestData >= redRequirement) resultValue = 0;
<MudProgressLinear Class="@barClass" Rounded="true" Size="Size.Large" Max="@redRequirement" Value="@resultValue">
<MudText Typo="Typo.caption">@resultValue</MudText>
</MudProgressLinear>
<MudText Typo="Typo.caption" Style="text-align: right">@resultText</MudText>
}
else
{
if (bestData >= redRequirement)
{
barClass = "bar-pass-red";
resultText = "Pass";
}
if (bestData >= goldRequirement)
{
barClass = "bar-pass-gold";
resultText = "Gold";
}
<MudProgressLinear Class="@barClass" Rounded="true" Size="Size.Large" Max="@(goldRequirement > 0 ? goldRequirement : 1)" Value="@(goldRequirement > 0 ? bestData : 1)">
<MudText Typo="Typo.caption">@bestData</MudText>
</MudProgressLinear>
<MudStack Class="mt-1" AlignItems="AlignItems.End">
<MudText Typo="Typo.caption">@resultText</MudText>
</MudStack>
}
2022-09-13 03:12:40 +02:00
}
2023-10-16 11:38:27 +02:00
else
{
<MudProgressLinear Class="@barClass" Rounded="true" Size="Size.Large" Max="100" Value="0">
<MudText Typo="Typo.caption">0</MudText>
</MudProgressLinear>
<MudStack Class="mt-1" AlignItems="AlignItems.End">
<MudText Typo="Typo.caption">N/A</MudText>
2022-09-13 03:12:40 +02:00
</MudStack>
2023-10-16 11:38:27 +02:00
}
@{
var conditionOperator = GetDanConditionOperator((DanConditionType)border.OdaiType);
if (redRequirement == 0) {
conditionOperator = "";
}
}
<MudStack Spacing="1" Class="mt-8">
<MudText Typo="Typo.subtitle2" Style="font-weight:bold">Conditions</MudText>
<MudStack Row="true" Spacing="16">
<MudStack Spacing="0">
<MudText Typo="Typo.caption">Red</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold">@conditionOperator @redRequirement</MudText>
</MudStack>
<MudStack Spacing="0">
<MudText Typo="Typo.caption">Gold</MudText>
<MudText Typo="Typo.body1" Style="font-weight: bold">@conditionOperator @goldRequirement</MudText>
</MudStack>
2022-09-13 03:12:40 +02:00
</MudStack>
</MudStack>
2023-10-16 11:38:27 +02:00
</MudCardContent>
</MudCard>
</MudItem>
}
</MudGrid>
}
</MudCardContent>
</MudCard>
}
</MudStack>
</MudItem>
</MudGrid>
</MudItem>
</MudGrid>
</MudTabPanel>
}
</MudTabs>
</MudPaper>
</MudItem>
</MudGrid>
}