- 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]>
26 lines
996 B
C#
26 lines
996 B
C#
using System.Collections.Generic;
|
|
|
|
// 延遲校正的計算(純函式,方便測試)
|
|
public static class CalibrationMath
|
|
{
|
|
// 點擊時間對最近一拍的偏差;超出半拍或屬於暖身拍則回傳 false
|
|
public static bool TryBeatDelta(double tapTime, double firstBeat, double interval, int beatCount, int warmupBeats, out double delta)
|
|
{
|
|
delta = 0;
|
|
int i = (int)System.Math.Round((tapTime - firstBeat) / interval);
|
|
if (i < warmupBeats || i >= beatCount) return false;
|
|
delta = tapTime - (firstBeat + i * interval);
|
|
return System.Math.Abs(delta) < interval / 2;
|
|
}
|
|
|
|
// 中位數(比平均值不受誤觸影響)
|
|
public static double Median(List<double> values)
|
|
{
|
|
if (values == null || values.Count == 0) return 0;
|
|
var sorted = new List<double>(values);
|
|
sorted.Sort();
|
|
int n = sorted.Count;
|
|
return n % 2 == 1 ? sorted[n / 2] : (sorted[n / 2 - 1] + sorted[n / 2]) / 2;
|
|
}
|
|
}
|