Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Fast/Slow indicator. #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Pulsus/Gameplay/BMS/BMSJudge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -384,6 +388,11 @@ public double GetAverageDelay()
return totalDifference / judgedKeyCount;
}

public double GetLastDelay()
{
return lastDelay;
}

public double GetCurrentPercentage()
{
return (double)GetScoreEx() / scoreExMax;
Expand Down
28 changes: 28 additions & 0 deletions Pulsus/Gameplay/EventPlayers/Skin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion Pulsus/Shared/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down