- 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]>
56 lines
4.0 KiB
Markdown
56 lines
4.0 KiB
Markdown
# Rhyculator
|
||
|
||
以雙指為主的 Android 節奏遊戲:在 5x6 的格子上按下出現的音符,有 tap、hold、slide 三種音符。
|
||
|
||
遊戲本身**不內建任何曲目**,歌曲以曲包(`.zip`)提供;曲包用 [Rhyculator Maker](https://gitea.sthkm3.org/sthkm3/RhyculatorMaker) 製作,
|
||
也可以從曲包網站下載別人上傳的曲包。
|
||
|
||
## 曲包資料夾
|
||
|
||
遊戲啟動時(以及之後每秒)讀取 **package 資料夾**裡的曲包,像插上一個隨身碟:裡面有什麼就玩什麼。
|
||
|
||
| 權限 | package 資料夾 |
|
||
|---|---|
|
||
| 允許「所有檔案存取權」(第一次開啟時詢問,或在設定裡開啟) | `內部儲存空間/Rhyculator/package/` |
|
||
| 不允許 | `Android/data/com.DefaultCompany.Lunchpad/files/package/` |
|
||
|
||
- 放進去的 `.zip` 不會被刪除或搬動;遊戲解壓到自己的快取資料夾讀取,zip 被換掉、刪掉時快取跟著更新
|
||
- 也可以放已解開的曲包資料夾(資料夾裡直接有 `config.json`)
|
||
- 同一個 `id` 有多個檔案時只使用最新的那個
|
||
- 放入曲包的其他方式(都會存進 package 資料夾):
|
||
- 在檔案管理員、瀏覽器下載列表或聊天軟體點 `.zip`,選擇以「Rhyculator」開啟(或「分享」給 Rhyculator)
|
||
- 選歌畫面的「代碼下載」:輸入曲包網站上的 8 碼代碼
|
||
- 曲包網站的「在遊戲中下載」按鈕(`rhyculator://pack/<code>`)
|
||
- 開發時可用 `adb push song.zip /sdcard/Rhyculator/package/`(或沒有權限時的 app 資料夾)
|
||
|
||
曲包內容:`config.json`、`easy.json` / `normal.json` / `hard.json`(至少一個)、`music.ogg|wav|mp3`、`image.png`,可選 `video.mp4`(遊玩時當背景)。
|
||
格式細節見 Maker 的 README。舊版匯入在 `files/songs/` 的曲包會在第一次開啟時自動搬進 package 資料夾。
|
||
|
||
## 開發
|
||
|
||
- Unity 6000.2.10f1,Android Build Support(IL2CPP,ARM64)
|
||
- 整個遊戲只有一個空場景(`Assets/Scenes/Main.unity`,只有攝影機),畫面全部由程式建立,沒有 prefab
|
||
- 指令列打包(產出 `Build/Rhyculator.apk`,並複製一份到專案根目錄 `Rhyculator.apk`;加 `-development` 為 Development Build):
|
||
`Unity.exe -batchmode -quit -projectPath <此資料夾> -buildTarget Android -executeMethod BuildAndroid.Build -logFile build.log`
|
||
- 測試:`Unity.exe -batchmode -projectPath <此資料夾> -runTests -testPlatform EditMode -testResults results.xml`
|
||
- 伺服器網址在 `Assets/Scripts/Platform/ServerConfig.cs`;`UseLocal = true` 時連 `127.0.0.1`(模擬器用 `adb reverse tcp:2010 tcp:2010`、`tcp:2030`)
|
||
|
||
程式(`Assets/Scripts`):
|
||
|
||
| 資料夾 | 檔案 | 內容 |
|
||
|---|---|---|
|
||
| `Core/` | `SongInfo` `ChartLoader` `MiniJson` | 曲包 config 與 Maker 統一格式譜面的解析 |
|
||
| | `PackReader` `PackLibrary` | zip 檢查與解壓;掃描 package 資料夾、快取管理(不依賴 UnityEngine,可在背景執行緒與測試中使用) |
|
||
| | `NoteJudge` `PlayResult` `CalibrationMath` `Prefs` | 判定、計分、延遲校正計算、PlayerPrefs 鍵 |
|
||
| `Game/` | `Grid` | 共用的 5x6 格子:外框閃色、圖示、音符動畫、長按進度環、文字 |
|
||
| | `GridInput` `SongClock` `ChartPlayer` | 觸控(EnhancedTouch,回推精確按下時間)、以 DSP 為準的歌曲時鐘、依時間生成音符 |
|
||
| `Platform/` | `PackStorage` `Library` | package 資料夾位置與權限、舊資料搬移;每秒在背景掃描曲包 |
|
||
| | `Api` `ServerConfig` | 遊戲伺服器、驗證伺服器、曲包下載 |
|
||
| `UI/` | `App` `Ui` | 啟動、版面(安全區域、格子大小)、畫面切換;以程式建立 UI 的工具與對話框 |
|
||
| `UI/Pages/` | `Intro` `Main` `Choose` `Play` `Account` `Settings` | 各畫面 |
|
||
|
||
`Assets/Plugins/Android/`:`AndroidManifest.xml`(開啟 / 分享 zip、`rhyculator://` 連結、儲存權限)與
|
||
`RhyculatorActivity.java`(把收到的 zip 存進 package 資料夾、權限檢查)。
|
||
|
||
帳號、成績、排行榜伺服器與曲包網站在 RhyculatorServer(私人 repo)。
|