1
0
mirror of synced 2024-11-27 16:10:53 +01:00

Soul gauge result UI

This commit is contained in:
shiibe 2022-09-12 11:49:28 -04:00
parent c55848a5f5
commit a527628f74
2 changed files with 75 additions and 24 deletions

View File

@ -90,26 +90,57 @@
<MudItem xs="12">
<MudGrid>
<MudItem xs="12" md="3">
<MudCard Outlined="true" Class="pa-4">
<MudCardHeader>
<MudCard Outlined="true" Class="pa-2">
<MudCardHeader Class="pb-0">
<CardHeaderContent>
<MudText Typo="Typo.h6">Soul Gauge</MudText>
</CardHeaderContent>
</MudCardHeader>
<MudCardContent>
<MudText>
Soul gauge needed to pass: @GetSoulGauge(danData, false)
</MudText>
<MudText>
Soul gauge needed to gold clear: @GetSoulGauge(danData, true)
</MudText>
@if (bestDataMap.ContainsKey(danId))
{
var danBestData = bestDataMap[danId];
<MudText>
Best Soul gauge: @(danBestData.SoulGaugeTotal)%
</MudText>
}
<MudStack>
@{
var redRequirement = GetSoulGauge(danData, false);
var goldRequirement = GetSoulGauge(danData, true);
var barColor = Color.Default;
}
<MudStack Spacing="1">
<MudText Typo="Typo.caption" Style="font-weight:bold;">Result:</MudText>
@if (bestDataMap.ContainsKey(danId))
{
var danBestData = bestDataMap[danId];
if (danBestData.SoulGaugeTotal >= redRequirement) {
barColor = Color.Error;
}
if (danBestData.SoulGaugeTotal >= goldRequirement) {
barColor = Color.Warning;
}
<MudProgressLinear Color="@barColor" Rounded="true" Size="Size.Large" Style="height: 20px" Max="100" Value="@danBestData.SoulGaugeTotal">
<MudText Typo="Typo.caption" Style="color: white;">@(danBestData.SoulGaugeTotal)%</MudText>
</MudProgressLinear>
} else {
<MudProgressLinear Color="@barColor" Rounded="true" Size="Size.Large" Style="height: 20px" Max="100" Value="0">
<MudText Typo="Typo.caption">0%</MudText>
</MudProgressLinear>
}
</MudStack>
<MudStack Spacing="1">
<MudCard Outlined="true" Class="pa-1">
<MudStack Row="true">
<MudText Typo="Typo.caption" Style="font-weight:bold;">Red Requirement:</MudText>
<MudText Typo="Typo.caption">@redRequirement%</MudText>
</MudStack>
</MudCard>
<MudCard Outlined="true" Class="pa-1">
<MudStack Row="true">
<MudText Typo="Typo.caption" Style="font-weight:bold;">Gold Requirement:</MudText>
<MudText Typo="Typo.caption">@goldRequirement%</MudText>
</MudStack>
</MudCard>
</MudStack>
</MudStack>
</MudCardContent>
</MudCard>
</MudItem>
@ -119,16 +150,15 @@
{
var border = danData.OdaiBorderList[j];
<MudStack>
<MudCard Outlined="true" Class="pa-4">
<MudCard Outlined="true" Class="pa-2">
<MudCardHeader>
<CardHeaderContent>
<MudText Typo="Typo.h4">
<MudText Typo="Typo.h6">
@GetDanRequirementTitle(border)
</MudText>
</CardHeaderContent>
</MudCardHeader>
<MudCardContent>
@{
var borderType = (DanBorderType)border.BorderType;
}

View File

@ -1,4 +1,6 @@
namespace TaikoWebUI.Pages;
using System.Net.NetworkInformation;
namespace TaikoWebUI.Pages;
public partial class DaniDojo
{
@ -27,13 +29,32 @@ public partial class DaniDojo
breadcrumbs.Add(new BreadcrumbItem("Dani Dojo", href: $"/Cards/{Baid}/DaniDojo", disabled: false));
}
private static string GetDanRequirementString(DanConditionType danConditionType)
{
return danConditionType switch
{
DanConditionType.TotalHitCount => "Total Hits",
DanConditionType.GoodCount => "Good Notes",
DanConditionType.OkCount => "OK Notes",
DanConditionType.BadCount => "Bad Notes",
DanConditionType.SoulGauge => "Soul Gauge",
DanConditionType.DrumrollCount => "Drumroll Hits",
DanConditionType.Score => "Score",
DanConditionType.ComboCount => "MAX Combo",
_ => ""
};
}
private static string GetDanRequirementTitle(DanData.OdaiBorder data)
{
var danConditionType = (DanConditionType)data.OdaiType;
string danConditionTitle = GetDanRequirementString(danConditionType);
return (DanBorderType)data.BorderType switch
{
DanBorderType.All => $"{danConditionType}, All song",
DanBorderType.PerSong => $"{danConditionType}, Per song",
DanBorderType.All => $"{danConditionTitle} (All stages)",
DanBorderType.PerSong => $"{danConditionTitle} (Per stage)",
_ => throw new ArgumentOutOfRangeException(nameof(data))
};
}
@ -161,7 +182,7 @@ public partial class DaniDojo
return icon;
}
private static string GetSoulGauge(DanData data, bool isGold)
private static uint GetSoulGauge(DanData data, bool isGold)
{
var borders = data.OdaiBorderList;
var soulBorder =
@ -170,9 +191,9 @@ public partial class DaniDojo
if (isGold)
{
return $"{soulBorder.GoldBorderTotal}%";
return soulBorder.GoldBorderTotal;
}
return $"{soulBorder.RedBorderTotal}%";
return soulBorder.RedBorderTotal;
}
}