@umicat/phaser-sdk 1.0.10 → 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.
- package/dist/editor/EditorBridge.js +19 -4
- package/package.json +1 -1
|
@@ -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,
|
|
1467
|
+
scene.load.atlasXML(asset.textureKey, loadFrom, atlasFrom);
|
|
1454
1468
|
}
|
|
1455
1469
|
else if (asset.atlasPath) {
|
|
1456
|
-
scene.load.atlas(asset.textureKey, loadFrom,
|
|
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,
|
|
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;
|