M5-M7: сцены, лобби, экран игры и цикл матча

Обе сцены собраны через Code Mode, не руками.

- loader: поднимает модули, прогревает арт карт, уходит в lobby
- lobby: обе UI-ветки в одной сцене (по ARCHITECTURE.md), матч — это
  смена видимого корня, а не загрузка сцены
- GameScreen рисует текущее состояние и доводит узлы твинами, а не
  проигрывает поток событий: узел карты живёт вместе со своей картой,
  поэтому "шестёрка ушла из руки на стол" не требует отдельного случая
- один тап = ход целиком; логика вынесена в core/rules/intent.ts
  и покрыта тестами, в том числе проверкой, что она никогда не предложит
  ход, который правила отвергнут
- арт карт переехал в assets/resources: .pac — это инструкция упаковки
  на сборке, а не рантайм-ассет, и без ссылок на кадры в сборку
  не попадало ничего. Теперь все 37 спрайтов в одной текстуре 2048x2048
- клики кнопок подписываются в коде, а не через clickEvents сцены
- строки интерфейса собраны в одном файле

Сборка web-mobile проходит чисто, все ссылки в сцене проверены.
Вживую не запускалось: браузер в этом окружении не поднимает
главный цикл движка. Подробности — в docs/TECHNICAL.md.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
ftc
2026-09-13 11:30:28 +03:00
co-authored by Claude Opus 5
parent 2056673946
commit 4f3a26dc45
111 changed files with 8168 additions and 37 deletions
+56
View File
@@ -0,0 +1,56 @@
import { CocosStorage } from '../modules/save/CocosStorage';
import { SaveManager } from '../modules/save/SaveManager';
import { StatsSection } from '../modules/save/StatsSection';
/**
* The application's services, created once by the loader scene.
*
* Cocos components are built by the engine, so there is nowhere to inject
* dependencies through a constructor; a small explicit locator is the honest
* alternative to every component reaching for its own singleton. Everything it
* holds is engine-independent apart from the storage adapter, so a test can
* build one over `MemoryStorage` and drive the whole thing headlessly.
*/
export class App {
private static _instance: App | null = null;
readonly save: SaveManager;
readonly stats: StatsSection;
private constructor(save: SaveManager, stats: StatsSection) {
this.save = save;
this.stats = stats;
}
/** Builds the services and loads saved progress. Called once, from `Bootstrap`. */
static create(): App {
if (App._instance) {
return App._instance;
}
const stats = new StatsSection();
const save = new SaveManager(new CocosStorage());
save.register(stats);
save.load();
App._instance = new App(save, stats);
return App._instance;
}
static get instance(): App {
if (!App._instance) {
throw new Error('App.create() has not run — is the loader scene the start scene?');
}
return App._instance;
}
static get exists(): boolean {
return App._instance !== null;
}
/** Records the result of a match and writes it out immediately. */
recordMatch(outcome: 'win' | 'loss' | 'draw'): void {
this.stats.recordResult(outcome);
this.save.save();
}
}