Files
Rhyculator/Assets/Scripts/Core/NoteJudge.cs
T
SahikandClaude Opus 5.5 ddd5fdc28b Rebuild the game as a single code-driven scene with a package-folder pack source
- One empty scene; App builds the canvas, safe-area layout and a shared 5x6
  Grid in code. Pages (Intro, Main, Choose, Play, Account, Settings) replace
  5 scenes, 5 prefabs and the per-cell spawner/display components.
- Packs: the game reads Rhyculator/package/ (with All files access) or the
  app folder, like a plugged-in USB stick. Zips stay where they are and are
  extracted to a cache keyed by name/size/mtime; folders are read directly.
  Scans run every second on a background thread. Old songs/ imports and inbox
  zips are migrated automatically.
- Download packs by 8-char code from the new pack website, or via
  rhyculator://pack/<code> links; opened/shared zips go into the package folder.
- Play: pause/resume/retry, auto-pause on background, combo and progress bar;
  judging and scoring unchanged. Choose page fits 9:16 screens; empty state,
  pack delete. Android back key handled everywhere.
- Slimming: removed TextMesh Pro, unused 2D/Timeline/VisualScripting/etc.
  packages and modules, scene template, unused sprites; menu theme wav (20MB)
  -> ogg (2.3MB). Build profile replaced by explicit settings in BuildAndroid.
- Tests: PackLibrary/PackReader/migration/serializer tests (39 passing).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 14:18:54 +08:00

40 lines
1.1 KiB
C#

// 判定:以「按下時間 - 音符時間」決定結果(秒)
// 時間窗沿用舊版以動畫縮放判定時的手感:Perfect ±50ms、Fast/Slow ±130ms、Bad ±200ms
public enum Judgement
{
None, // 不在判定範圍內(太早),不處理
Perfect,
Fast,
Slow,
Bad,
Miss // 音符過期沒按到
}
public static class NoteJudge
{
public const double PerfectWindow = 0.050;
public const double GreatWindow = 0.130;
public const double BadWindow = 0.200;
public static Judgement Evaluate(double delta)
{
double abs = System.Math.Abs(delta);
if (abs <= PerfectWindow) return Judgement.Perfect;
if (abs <= GreatWindow) return delta < 0 ? Judgement.Fast : Judgement.Slow;
if (abs <= BadWindow) return Judgement.Bad;
return delta > 0 ? Judgement.Miss : Judgement.None;
}
public static int Score(Judgement j)
{
switch (j)
{
case Judgement.Perfect: return 212;
case Judgement.Fast:
case Judgement.Slow: return 159;
case Judgement.Bad: return 53;
default: return 0;
}
}
}