From a527628f74be27bb5407d9bd22aeff4fe38c29a3 Mon Sep 17 00:00:00 2001 From: shiibe Date: Mon, 12 Sep 2022 11:49:28 -0400 Subject: [PATCH] Soul gauge result UI --- TaikoWebUI/Pages/DaniDojo.razor | 66 ++++++++++++++++++++++-------- TaikoWebUI/Pages/DaniDojo.razor.cs | 33 ++++++++++++--- 2 files changed, 75 insertions(+), 24 deletions(-) diff --git a/TaikoWebUI/Pages/DaniDojo.razor b/TaikoWebUI/Pages/DaniDojo.razor index 0d521a4..2117485 100644 --- a/TaikoWebUI/Pages/DaniDojo.razor +++ b/TaikoWebUI/Pages/DaniDojo.razor @@ -90,26 +90,57 @@ - - + + Soul Gauge - - Soul gauge needed to pass: @GetSoulGauge(danData, false) - - - Soul gauge needed to gold clear: @GetSoulGauge(danData, true) - - @if (bestDataMap.ContainsKey(danId)) - { - var danBestData = bestDataMap[danId]; - - Best Soul gauge: @(danBestData.SoulGaugeTotal)% - - } + + @{ + var redRequirement = GetSoulGauge(danData, false); + var goldRequirement = GetSoulGauge(danData, true); + var barColor = Color.Default; + } + + Result: + @if (bestDataMap.ContainsKey(danId)) + { + var danBestData = bestDataMap[danId]; + + if (danBestData.SoulGaugeTotal >= redRequirement) { + barColor = Color.Error; + } + + if (danBestData.SoulGaugeTotal >= goldRequirement) { + barColor = Color.Warning; + } + + @(danBestData.SoulGaugeTotal)% + + } else { + + 0% + + } + + + + + Red Requirement: + @redRequirement% + + + + + + Gold Requirement: + @goldRequirement% + + + + @@ -119,16 +150,15 @@ { var border = danData.OdaiBorderList[j]; - + - + @GetDanRequirementTitle(border) - @{ var borderType = (DanBorderType)border.BorderType; } diff --git a/TaikoWebUI/Pages/DaniDojo.razor.cs b/TaikoWebUI/Pages/DaniDojo.razor.cs index cea7235..a5d1970 100644 --- a/TaikoWebUI/Pages/DaniDojo.razor.cs +++ b/TaikoWebUI/Pages/DaniDojo.razor.cs @@ -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; } } \ No newline at end of file