Files
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

38 lines
1.1 KiB
C#

using System.Collections.Generic;
// 依 SongClock 把譜面事件放到格子上(遊玩與主畫面的背景譜面共用)
public class ChartPlayer
{
private readonly List<ChartEvent> events;
private int next;
public int Count => events.Count;
public ChartPlayer(List<ChartEvent> events)
{
this.events = events;
}
// 從某個時間點開始(之前的事件略過,例如主畫面音樂已經在播)
public void Seek(double time)
{
next = 0;
while (next < events.Count && events[next].hitTime < time) next++;
}
public void Tick(Grid grid, double now)
{
double until = now + Grid.AppearLead;
while (next < events.Count && events[next].hitTime <= until)
{
var e = events[next++];
switch (e.type)
{
case "tap": grid.ShowNote(e.x, e.y, NoteType.Tap, e.hitTime); break;
case "hold": grid.ShowNote(e.x, e.y, NoteType.Hold, e.hitTime, e.holdMs); break;
case "slide": grid.ShowNote(e.x, e.y, NoteType.Slide, e.hitTime); break;
}
}
}
}