@umicat/phaser-sdk 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1405,6 +1405,17 @@ function pickLoadUrl(asset) {
1405
1405
  const loadUrl = asset.loadUrl;
1406
1406
  return loadUrl || asset.path;
1407
1407
  }
1408
+ /**
1409
+ * Atlas JSON URL for editor lazy-load. Mirrors `pickLoadUrl` for the companion
1410
+ * atlas/ninepatch file: `atlasLoadUrl` (off-record, set by the host's Bg-image
1411
+ * picker from `AssetSummary.atlasUrl`) loads the JSON from the CDN so a freshly
1412
+ * generated + region-tagged asset renders LIVE — its bytes aren't in the
1413
+ * workspace until save. Falls back to the workspace `atlasPath` for saved assets.
1414
+ */
1415
+ function pickAtlasUrl(asset) {
1416
+ const atlasLoadUrl = asset.atlasLoadUrl;
1417
+ return atlasLoadUrl || asset.atlasPath;
1418
+ }
1408
1419
  function loadAssetIntoScene(scene, asset) {
1409
1420
  return new Promise((resolve, reject) => {
1410
1421
  if (scene.textures.exists(asset.textureKey)) {
@@ -1448,21 +1459,25 @@ function loadAssetIntoScene(scene, asset) {
1448
1459
  scene.load.image(asset.textureKey, loadFrom);
1449
1460
  }
1450
1461
  break;
1451
- case 'atlas':
1462
+ case 'atlas': {
1463
+ // The companion JSON loads from `atlasLoadUrl` (CDN) when present so a
1464
+ // freshly generated + 9-sliced asset renders live, not just the texture.
1465
+ const atlasFrom = pickAtlasUrl(asset);
1452
1466
  if (asset.atlasPath && asset.atlasFormat === 'xml') {
1453
- scene.load.atlasXML(asset.textureKey, loadFrom, asset.atlasPath);
1467
+ scene.load.atlasXML(asset.textureKey, loadFrom, atlasFrom);
1454
1468
  }
1455
1469
  else if (asset.atlasPath) {
1456
- scene.load.atlas(asset.textureKey, loadFrom, asset.atlasPath);
1470
+ scene.load.atlas(asset.textureKey, loadFrom, atlasFrom);
1457
1471
  // Also fetch the raw JSON into the side-cache for per-region
1458
1472
  // ninePatch lookups (slice 10). Phaser's atlas parser drops
1459
1473
  // unknown per-frame fields, so we keep the original JSON around.
1460
1474
  const sidecarKey = `umicat:atlas-ninepatch:${asset.textureKey}`;
1461
1475
  if (!scene.cache.json.exists(sidecarKey)) {
1462
- scene.load.json(sidecarKey, asset.atlasPath);
1476
+ scene.load.json(sidecarKey, atlasFrom);
1463
1477
  }
1464
1478
  }
1465
1479
  break;
1480
+ }
1466
1481
  case 'audio':
1467
1482
  scene.load.audio(asset.textureKey, loadFrom);
1468
1483
  break;
@@ -310,6 +310,21 @@ function queueAssetLoad(scene, asset) {
310
310
  }
311
311
  : null);
312
312
  if (!cfg) {
313
+ // A TILESET asset can be modality 'spritesheet' yet carry no
314
+ // spriteSheetConfig — it's sliced by `tileset.cellSize` in
315
+ // `createTilemap`'s `addTilesetImage`, never consumed as Phaser
316
+ // animation frames. Load it as a plain image so tilemap layers
317
+ // referencing it actually render. Mirrors the editor's
318
+ // `loadAssetIntoScene` fallback (EditorBridge) — without this the
319
+ // two load paths diverge: a tilemap-ref renders live in the editor
320
+ // but its layer vanishes after save+reload because scene-load
321
+ // skipped the texture. (Host now writes tilesets as kind:'image',
322
+ // but this keeps agent-authored / legacy spritesheet-kind tilesets
323
+ // robust too.)
324
+ if (asset.tileset) {
325
+ scene.load.image(asset.textureKey, asset.path);
326
+ return;
327
+ }
313
328
  // eslint-disable-next-line no-console
314
329
  console.warn(`[umicat/scene] asset '${asset.id}' kind=spritesheet missing spriteSheetConfig (and no top-level frameWidth/frameHeight); skipping load`);
315
330
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umicat/phaser-sdk",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "Umicat Phaser 3 SDK — game infrastructure for the Umicat platform",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",