From 9614555014310e9f58c99e4b94dfa3b8db70ff2e Mon Sep 17 00:00:00 2001 From: Renard Date: Wed, 18 Jan 2017 00:52:39 -0300 Subject: [PATCH] Added Fast/Slow indicator. --- Pulsus/Gameplay/BMS/BMSJudge.cs | 9 +++++++++ Pulsus/Gameplay/EventPlayers/Skin.cs | 28 ++++++++++++++++++++++++++++ Pulsus/Shared/Settings.cs | 4 +++- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/Pulsus/Gameplay/BMS/BMSJudge.cs b/Pulsus/Gameplay/BMS/BMSJudge.cs index f91d098..9509e3a 100644 --- a/Pulsus/Gameplay/BMS/BMSJudge.cs +++ b/Pulsus/Gameplay/BMS/BMSJudge.cs @@ -67,6 +67,8 @@ public class BMSJudge : Judge public double totalDifference = 0.0; public int judgedKeyCount = 0; + double lastDelay = 0.0; + public delegate void OnNoteJudgedDelegate(NoteScore noteScore); public OnNoteJudgedDelegate OnNoteJudged; @@ -224,6 +226,8 @@ public override void JudgeNote(double hitTimestamp, NoteScore noteScore) else difference = hitTimestamp - noteScore.timestamp; + lastDelay = difference; + bool fast = difference < 0; bool judged = true; bool release = false; @@ -384,6 +388,11 @@ public double GetAverageDelay() return totalDifference / judgedKeyCount; } + public double GetLastDelay() + { + return lastDelay; + } + public double GetCurrentPercentage() { return (double)GetScoreEx() / scoreExMax; diff --git a/Pulsus/Gameplay/EventPlayers/Skin.cs b/Pulsus/Gameplay/EventPlayers/Skin.cs index 86995d7..f935c52 100644 --- a/Pulsus/Gameplay/EventPlayers/Skin.cs +++ b/Pulsus/Gameplay/EventPlayers/Skin.cs @@ -617,6 +617,7 @@ public void Render(double deltaTime) RenderBGA(deltaTime, new Rectangle(1280 - 720, 0, 720, 720)); RenderNoteHit(deltaTime, laneStartPos + new Int2(0, laneHeight)); RenderGauge(deltaTime, laneStartPos + new Int2(-9, laneHeight + 94)); + RenderFSIndicator(deltaTime, laneStartPos + new Int2(laneTotalWidth / 2, (int)(laneHeight * judgeTextY))); string songInfo = string.Format("{0} - {1}", chart.artist, chart.title); spriteRenderer.DrawText(Game.debugFont, songInfo, new Int2(0, Game.debugFont.pointSize * 1), Color.White); @@ -849,6 +850,33 @@ private void RenderKeys(double deltaTime, Int2 keyStartPos) } } + private void RenderFSIndicator(double deltaTime, Int2 pos) + { + Settings settings = SettingsManager.instance; + bool showIndicator = settings.gameplay.showFSIndicator; + if (judgeText == JudgeText.Empty || judgeFont == null || judgeText == JudgeText.PGreat || !showIndicator) + return; + + SpriteRenderer spriteRenderer = renderer.spriteRenderer; + String indicatorStr; + Color indicatorColor; + if (judge.GetLastDelay() < 0) + { + indicatorStr = "FAST"; + indicatorColor = Color.Blue; + }else + { + indicatorStr = "SLOW"; + indicatorColor = Color.Red; + } + + pos.x = pos.x - (Game.debugFont.MeasureSize(indicatorStr).x / 2); + pos.y = pos.y + 40; + + spriteRenderer.DrawTextOutline(Game.debugFont, indicatorStr, pos, Color.Black, 1); + spriteRenderer.DrawText(Game.debugFont, indicatorStr, pos, indicatorColor); + } + private void RenderJudgeText(double deltaTime, Int2 judgePos) { if (judgeText == JudgeText.Empty) diff --git a/Pulsus/Shared/Settings.cs b/Pulsus/Shared/Settings.cs index b75eddb..4dce686 100644 --- a/Pulsus/Shared/Settings.cs +++ b/Pulsus/Shared/Settings.cs @@ -278,7 +278,9 @@ public class GameplaySettings //public PlayMode playMode; //public LaneMode laneMode; public GaugeMode gaugeMode; - //public RandomMode randomMode; + //public RandomMode randomMode; + + public bool showFSIndicator = true; } public enum OutputMode