From 110bd6b8a63a6aa19b8fa644d5ac244501042875 Mon Sep 17 00:00:00 2001 From: Phawit Pornwattanakul Date: Thu, 25 Jul 2024 02:06:32 +0700 Subject: [PATCH] Add combo to statistics --- .../Graphics/Containers/PlayfieldContainer.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Renako.Game/Graphics/Containers/PlayfieldContainer.cs b/Renako.Game/Graphics/Containers/PlayfieldContainer.cs index fb6175f..b832b80 100644 --- a/Renako.Game/Graphics/Containers/PlayfieldContainer.cs +++ b/Renako.Game/Graphics/Containers/PlayfieldContainer.cs @@ -29,6 +29,7 @@ public partial class PlayfieldContainer : Container private RenakoSpriteText breakText; private RenakoSpriteText hitText; private RenakoSpriteText missText; + private RenakoSpriteText comboText; private RenakoSpriteText clockText; private const int fade_in_time = move_time / 2; @@ -147,6 +148,12 @@ private void load(TextureStore textureStore, WorkingBeatmap workingBeatmap) Origin = Anchor.TopRight, Text = "Miss: 0" }, + comboText = new RenakoSpriteText() + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Text = "Combo: 0" + }, clockText = new RenakoSpriteText() { Anchor = Anchor.TopRight, @@ -171,6 +178,7 @@ protected override void Update() Logger.Log($"Missed note at {note.EndTime}", LoggingTarget.Runtime, LogLevel.Debug); note.IsHit = true; stats.Miss++; + stats.Combo = 0; addHitResultAnimation(HitResult.Miss); updateScoreText(); } @@ -354,21 +362,25 @@ private void processHit(NoteLane lane) if (diff < 50) { stats.Critical++; + stats.Combo++; addHitResultAnimation(HitResult.Critical); } else if (diff < 100) { stats.Break++; + stats.Combo++; addHitResultAnimation(HitResult.Break); } else if (diff < 200) { stats.Hit++; + stats.Combo++; addHitResultAnimation(HitResult.Hit); } else { stats.Miss++; + stats.Combo = 0; addHitResultAnimation(HitResult.Miss); playHitAnimation = false; } @@ -391,6 +403,7 @@ private void updateScoreText() breakText.Text = $"Break: {stats.Break}"; hitText.Text = $"Hit: {stats.Hit}"; missText.Text = $"Miss: {stats.Miss}"; + comboText.Text = $"Combo: {stats.Combo}"; } private enum HitResult @@ -421,6 +434,7 @@ private class Statistics public int Break { get; set; } // More than 50ms but less than 100ms public int Hit { get; set; } // More than 100ms but less than 200ms public int Miss { get; set; } // More than 200ms + public int Combo { get; set; } // Count of critical, break, and hit } private class PlayfieldNote