M3: модуль сохранения

По ARCHITECTURE.md: реестр независимых секций, JSON с ключом на секцию.
Ключи — явные строковые константы, а не имена классов: релизная сборка
минифицирует имена и молча потеряла бы все сохранения.

- ISaveSection, SaveManager, IStorage + MemoryStorage
- CocosStorage: единственный файл модуля, знающий про движок;
  при отказе хранилища уходит в память, а не роняет игру
- StatsSection: сыграно/побед/поражений/ничьих, текущая и лучшая серия
- терпимая загрузка: битый JSON, чужая версия, сломанная секция
  или отвалившееся хранилище не ломают остальное
- проверка чистоты расширена на modules/ со списком адаптеров

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
ftc
2026-09-13 10:45:52 +03:00
co-authored by Claude Opus 5
parent c60fbcbb94
commit 51117a698c
17 changed files with 756 additions and 29 deletions
+6 -6
View File
@@ -50,12 +50,12 @@ progress. The Cocos layer only renders state and turns taps into actions.
- [x] `MatchRunner` driving a full headless match
- [x] Soak test: thousands of seeded self-play matches finish with no illegal state
### M3 — Savegame module `[ ]`
- [ ] `ISaveSection` contract, `SaveManager` registry, JSON keyed by section name
- [ ] Storage backend over `sys.localStorage` (works on web and native)
- [ ] `StatsSection`: games played / won / lost, current and best win streak
- [ ] Versioning + tolerant load (unknown or missing sections do not break a load)
- [ ] Tests for save/load round-trip and corrupted-payload recovery
### M3 — Savegame module `[x]`
- [x] `ISaveSection` contract, `SaveManager` registry, JSON keyed by section name
- [x] Storage backend over `sys.localStorage` (works on web and native)
- [x] `StatsSection`: games played / won / lost, current and best win streak
- [x] Versioning + tolerant load (unknown or missing sections do not break a load)
- [x] Tests for save/load round-trip and corrupted-payload recovery
### M4 — Art pipeline `[ ]`
- [ ] Pick the 36 needed faces from `local/`, downscale to the 1080-wide budget