Починен зелёный экран: все узлы были не на том слое

nodeCreate кладёт узел на слой DEFAULT, а камера Canvas рисует только
UI_2D. Поэтому сборка показывала цвет очистки камеры и больше ничего.
В редакторе это не видно вообще: камера вида сцены рисует все слои,
так что сцена выглядит правильной, а билд — пустым.

- 45 узлов в обеих сценах и префабе переведены на слой UI_2D
- scripts/check-scenes.mjs: headless-проверка сцен и префабов —
  слои, наличие камеры у Canvas, видимость UI_2D у камеры,
  незаполненные ссылки в наших компонентах. Проверено, что она
  действительно падает на подсунутом неверном слое
- npm run check — всё разом (чистота core, сцены, типы, тесты)
- Bootstrap теперь докладывает каждый шаг в лейбл и в консоль
  и через 10 секунд уходит в лобби даже если арт не догрузился:
  молча висящий загрузчик — худший вид бага в отчёте
- ловушка со слоями описана в docs/CODE_MODE_SETUP.md

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
ftc
2026-09-13 11:58:17 +03:00
co-authored by Claude Opus 5
parent 3a36b698dc
commit 43f5bc5df3
8 changed files with 231 additions and 48 deletions
+1 -1
View File
@@ -53,7 +53,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
+8 -5
View File
@@ -111,7 +111,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -159,7 +159,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -278,7 +278,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -417,7 +417,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -549,7 +549,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -691,6 +691,9 @@
"_enabled": true,
"__prefab": null,
"nextScene": "lobby",
"statusLabel": {
"__id__": 15
},
"_id": "dcSHYP80NEeZirk4SzzDBT"
},
{
+39 -39
View File
@@ -108,7 +108,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -156,7 +156,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -275,7 +275,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -424,7 +424,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -488,7 +488,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -536,7 +536,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -668,7 +668,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -828,7 +828,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -876,7 +876,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -1008,7 +1008,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -1140,7 +1140,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -1272,7 +1272,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -1404,7 +1404,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -1536,7 +1536,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -1668,7 +1668,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -1800,7 +1800,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -1932,7 +1932,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -2132,7 +2132,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -2180,7 +2180,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -2545,7 +2545,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -2594,7 +2594,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -2642,7 +2642,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -2796,7 +2796,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -2928,7 +2928,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -3060,7 +3060,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -3164,7 +3164,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -3219,7 +3219,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -3267,7 +3267,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -3529,7 +3529,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -3577,7 +3577,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -3861,7 +3861,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -3909,7 +3909,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -4171,7 +4171,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -4225,7 +4225,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -4424,7 +4424,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -4472,7 +4472,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -4604,7 +4604,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -4743,7 +4743,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
@@ -4791,7 +4791,7 @@
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
+41 -2
View File
@@ -1,42 +1,81 @@
import { _decorator, Component, director, game, resources, SpriteFrame } from 'cc';
import { _decorator, Component, director, game, Label, resources, SpriteFrame } from 'cc';
import { App } from './App';
import { CARDS_DIR } from '../ui/game/CardLibrary';
const { ccclass, property } = _decorator;
/** If the art has not arrived by then, open the lobby anyway rather than hang. */
const PRELOAD_TIMEOUT = 10;
/**
* The loader scene, per ARCHITECTURE.md: bring the modules up, then hand over
* to the lobby. Everything that must exist before any gameplay runs belongs
* here, and nowhere else.
*
* Every step reports itself to the on-screen label and to the console, because
* a loader that stalls silently is the hardest kind of bug to diagnose from a
* bug report — "it shows a green screen" should never again be all we know.
*/
@ccclass('Bootstrap')
export class Bootstrap extends Component {
@property({ tooltip: 'Scene to open once the modules are ready.' })
nextScene = 'lobby';
@property({ type: Label, tooltip: 'Shows what the loader is doing.' })
statusLabel: Label | null = null;
private _handedOver = false;
start(): void {
// A phone that throttles to 30 fps makes the card animations stutter;
// asking for 60 up front is cheap and the engine falls back on its own.
game.frameRate = 60;
this._report('starting modules');
App.create();
// Warm the card art here rather than on the first deal: thirty-seven
// sprites are the only sizeable load in the game, and a loader scene is
// exactly where a player expects to wait for it.
resources.loadDir(CARDS_DIR, SpriteFrame, (error) => {
this._report('loading cards');
resources.loadDir(CARDS_DIR, SpriteFrame, (error, frames) => {
if (error) {
console.error('[bootstrap] could not preload the card art', error);
} else {
console.log(`[bootstrap] ${frames.length} card sprites ready`);
}
this._openLobby();
});
// A failed bundle can leave that callback unfired. The lobby does not
// need the art to show, so never let the loader be a dead end.
this.scheduleOnce(() => {
if (!this._handedOver) {
console.warn('[bootstrap] card art did not arrive in time, opening the lobby anyway');
this._openLobby();
}
}, PRELOAD_TIMEOUT);
}
private _openLobby(): void {
if (this._handedOver) {
return;
}
this._handedOver = true;
this._report('opening lobby');
director.loadScene(this.nextScene, (error) => {
if (error) {
console.error(`[bootstrap] could not open '${this.nextScene}'`, error);
this._report(`could not open ${this.nextScene}`);
}
});
}
private _report(what: string): void {
console.log(`[bootstrap] ${what}`);
if (this.statusLabel) {
this.statusLabel.string = what;
}
}
}