From 30df91771e93402bee823e99a2cf62dc85157d08 Mon Sep 17 00:00:00 2001 From: shiibe Date: Sat, 15 Oct 2022 17:45:01 -0400 Subject: [PATCH 1/2] Add total score and hits to dan dojo page --- SharedProject/Models/DanBestStageData.cs | 2 + TaikoWebUI/Pages/DaniDojo.razor | 191 +++++++++++++++-------- TaikoWebUI/Pages/DaniDojo.razor.cs | 63 ++++++-- 3 files changed, 181 insertions(+), 75 deletions(-) diff --git a/SharedProject/Models/DanBestStageData.cs b/SharedProject/Models/DanBestStageData.cs index 58980ae..c4255e9 100644 --- a/SharedProject/Models/DanBestStageData.cs +++ b/SharedProject/Models/DanBestStageData.cs @@ -17,4 +17,6 @@ public class DanBestStageData public uint TotalHitCount { get; set; } public uint ComboCount { get; set; } + + public uint HighScore { get; set; } } \ No newline at end of file diff --git a/TaikoWebUI/Pages/DaniDojo.razor b/TaikoWebUI/Pages/DaniDojo.razor index a20a489..c69c20d 100644 --- a/TaikoWebUI/Pages/DaniDojo.razor +++ b/TaikoWebUI/Pages/DaniDojo.razor @@ -20,7 +20,7 @@ Details - + @@ -34,83 +34,152 @@ var danClearStateString = GetDanClearStateString(danResultState); } danResultState.ToString() - @danClearStateString - + + + + + + + High Score + + + + @{ + var totalScore = GetTotalScore(danId); + } + + + @totalScore + + + + + + + Totals + + + + @{ + var totalGoods = GetTotalGoodHits(danId); + var totalOks = GetTotalOkHits(danId); + var totalBads = GetTotalBadHits(danId); + var totalDrumroll = GetTotalDrumrollHits(danId); + var totalMaxCombo = GetTotalMaxCombo(danId); + var totalHits = GetTotalHits(danId); + } + + + + Good + @totalGoods + + + OK + @totalOks + + + Bad + @totalBads + + + Drumroll + @totalDrumroll + + + MAX Combo + @totalMaxCombo + + + Total Hits + @totalHits + + + + + + + + + Songs + + - @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; + @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; - - - - -

@stageNumber

-
+ + + + +

@stageNumber

+
- - - @difficulty - - - - @GameDataService.GetMusicStarLevel(danDataOdaiSong.SongNo, difficulty) - - + + + @difficulty + + + + @GameDataService.GetMusicStarLevel(danDataOdaiSong.SongNo, difficulty) + + - - @GameDataService.GetMusicNameBySongId(danDataOdaiSong.SongNo) - @GameDataService.GetMusicArtistBySongId(danDataOdaiSong.SongNo) - + + @GameDataService.GetMusicNameBySongId(danDataOdaiSong.SongNo) + @GameDataService.GetMusicArtistBySongId(danDataOdaiSong.SongNo) + - @if (bestDataMap.ContainsKey(danId)) + @if (bestDataMap.ContainsKey(danId)) { var danBestData = bestDataMap[danId]; if (danBestData.DanBestStageDataList.Count > index) { var bestStage = danBestData.DanBestStageDataList[index]; - - - - Good - @bestStage.GoodCount - - - OK - @bestStage.OkCount - - - Bad - @bestStage.BadCount - - - Drumroll - @bestStage.DrumrollCount - - - MAX Combo - @bestStage.ComboCount - - - Total Hits - @bestStage.TotalHitCount - - - + + + + + Good + @bestStage.GoodCount + + + OK + @bestStage.OkCount + + + Bad + @bestStage.BadCount + + + Drumroll + @bestStage.DrumrollCount + + + MAX Combo + @bestStage.ComboCount + + + Total Hits + @bestStage.TotalHitCount + + + } } -
-
-
- } +
+
+
+ }
diff --git a/TaikoWebUI/Pages/DaniDojo.razor.cs b/TaikoWebUI/Pages/DaniDojo.razor.cs index 2937697..12a1ee2 100644 --- a/TaikoWebUI/Pages/DaniDojo.razor.cs +++ b/TaikoWebUI/Pages/DaniDojo.razor.cs @@ -7,7 +7,7 @@ public partial class DaniDojo private DanBestDataResponse? response; - private Dictionary bestDataMap = new(); + private static Dictionary bestDataMap = new(); private readonly List breadcrumbs = new() { @@ -64,7 +64,7 @@ public partial class DaniDojo return GetDanRequirementString(danConditionType); } - + private static long GetAllBestFromData(DanConditionType type, DanBestData data) { return type switch @@ -129,15 +129,15 @@ public partial class DaniDojo "3kyuu" => "Third Kyuu", "2kyuu" => "Second Kyuu", "1kyuu" => "First Kyuu", - "1dan" => "First Dan", - "2dan" => "Second Dan", - "3dan" => "Third Dan", - "4dan" => "Fourth Dan", - "5dan" => "Fifth Dan", - "6dan" => "Sixth Dan", - "7dan" => "Seventh Dan", - "8dan" => "Eighth Dan", - "9dan" => "Ninth Dan", + "1dan" => "First Dan", + "2dan" => "Second Dan", + "3dan" => "Third Dan", + "4dan" => "Fourth Dan", + "5dan" => "Fifth Dan", + "6dan" => "Sixth Dan", + "7dan" => "Seventh Dan", + "8dan" => "Eighth Dan", + "9dan" => "Ninth Dan", "10dan" => "Tenth Dan", "11dan" => "Kuroto", "12dan" => "Meijin", @@ -155,11 +155,11 @@ public partial class DaniDojo if (!bestDataMap.ContainsKey(danId)) { - return notClearIcon; + return notClearIcon; } - + var state = bestDataMap[danId].ClearState; - + icon = state is DanClearState.NotClear ? notClearIcon : $""; return icon; @@ -191,4 +191,39 @@ public partial class DaniDojo 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; + } } \ No newline at end of file From 91b6a6262d708f76704d3181a33dff2a3c98ae2d Mon Sep 17 00:00:00 2001 From: shiibe Date: Sat, 15 Oct 2022 17:57:33 -0400 Subject: [PATCH 2/2] Limit displayed negative result values to 0 --- TaikoWebUI/Pages/DaniDojo.razor | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/TaikoWebUI/Pages/DaniDojo.razor b/TaikoWebUI/Pages/DaniDojo.razor index c69c20d..4c7d71c 100644 --- a/TaikoWebUI/Pages/DaniDojo.razor +++ b/TaikoWebUI/Pages/DaniDojo.razor @@ -34,6 +34,7 @@ var danClearStateString = GetDanClearStateString(danResultState); } danResultState.ToString() + @danClearStateString @@ -296,8 +297,11 @@ resultText = "Gold"; } - - @(redRequirement - bestData) + var resultValue = redRequirement - bestData; + if (resultValue < 0) resultValue = 0; + + + @resultValue @resultText } @@ -385,9 +389,11 @@ barClass = "bar-pass-gold"; resultText = "Gold"; } + var resultValue = redRequirement - bestData; + if (resultValue < 0) resultValue = 0; - - @(redRequirement - bestData) + + @resultValue @resultText }