@unboxy/phaser-sdk 0.2.35 → 0.2.36

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.
@@ -172,12 +172,29 @@ function queueAssetLoad(scene, asset) {
172
172
  case 'image':
173
173
  scene.load.image(asset.textureKey, asset.path);
174
174
  return;
175
- case 'spritesheet':
176
- if (!asset.spriteSheetConfig) {
177
- throw new Error(`[unboxy/scene] asset '${asset.id}' kind=spritesheet missing spriteSheetConfig`);
175
+ case 'spritesheet': {
176
+ // Tolerant config resolution: prefer nested `spriteSheetConfig`, fall
177
+ // back to top-level `frameWidth/frameHeight/margin/spacing` if the
178
+ // agent put them there (common typo — both shapes appear in real
179
+ // workspaces). Soft-fail with warning when neither shape provides
180
+ // frame dims so the rest of the scene still boots.
181
+ const cfg = asset.spriteSheetConfig
182
+ ?? (asset.frameWidth && asset.frameHeight
183
+ ? {
184
+ frameWidth: asset.frameWidth,
185
+ frameHeight: asset.frameHeight,
186
+ margin: asset.margin,
187
+ spacing: asset.spacing,
188
+ }
189
+ : null);
190
+ if (!cfg) {
191
+ // eslint-disable-next-line no-console
192
+ console.warn(`[unboxy/scene] asset '${asset.id}' kind=spritesheet missing spriteSheetConfig (and no top-level frameWidth/frameHeight); skipping load`);
193
+ return;
178
194
  }
179
- scene.load.spritesheet(asset.textureKey, asset.path, asset.spriteSheetConfig);
195
+ scene.load.spritesheet(asset.textureKey, asset.path, cfg);
180
196
  return;
197
+ }
181
198
  case 'atlas':
182
199
  if (!asset.atlasPath || !asset.atlasFormat) {
183
200
  throw new Error(`[unboxy/scene] asset '${asset.id}' kind=atlas missing atlasPath/atlasFormat`);
@@ -42,6 +42,15 @@ export interface AssetRecord {
42
42
  margin?: number;
43
43
  spacing?: number;
44
44
  };
45
+ /**
46
+ * Top-level convenience fields. When the agent writes a spritesheet asset
47
+ * entry, it commonly puts these at the top level instead of nested in
48
+ * `spriteSheetConfig` — both shapes are now accepted by the loader.
49
+ */
50
+ frameWidth?: number;
51
+ frameHeight?: number;
52
+ margin?: number;
53
+ spacing?: number;
45
54
  /** For `atlas`: companion atlas file path (xml or json). */
46
55
  atlasPath?: string;
47
56
  /** `'xml'` (Starling) or `'json'` (TexturePacker). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboxy/phaser-sdk",
3
- "version": "0.2.35",
3
+ "version": "0.2.36",
4
4
  "description": "Unboxy Phaser 3 SDK — game infrastructure for the Unboxy platform",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",