@unboxy/phaser-sdk 0.2.40 → 0.2.41

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.
@@ -1093,25 +1093,19 @@ export function applyHudPatch(game, entityId, patch) {
1093
1093
  }
1094
1094
  }
1095
1095
  if (patch.visual && entity.kind === 'icon-button') {
1096
- // Icon-button is a Container — visual patches require a small refresh.
1097
- // For v1 we just patch the entity record + label/colour fields cheaply;
1098
- // wholesale re-spawn lands in slice 5.5 if we add live re-styling.
1096
+ // Icon-button is a Container — visual patches re-spawn the container
1097
+ // in place. Use a generic loop to copy every patched field into the
1098
+ // entity record so we don't have to enumerate fields here every time
1099
+ // the schema grows. Older fields kept as explicit for clarity below
1100
+ // are now subsumed by this loop but left commented as a reminder.
1099
1101
  const v = entity.visual;
1100
1102
  const p = patch.visual;
1101
- if (typeof p.label === 'string')
1102
- v.label = p.label;
1103
- if (typeof p.fillColor === 'string')
1104
- v.fillColor = p.fillColor;
1105
- if (typeof p.iconAssetId === 'string')
1106
- v.iconAssetId = p.iconAssetId;
1107
- if (typeof p.backgroundAssetId === 'string')
1108
- v.backgroundAssetId = p.backgroundAssetId;
1109
- else if (p.backgroundAssetId === null)
1110
- v.backgroundAssetId = undefined;
1111
- if (typeof p.backgroundFrame === 'number')
1112
- v.backgroundFrame = p.backgroundFrame;
1113
- else if (p.backgroundFrame === null)
1114
- v.backgroundFrame = undefined;
1103
+ for (const [k, val] of Object.entries(p)) {
1104
+ if (val === null)
1105
+ delete v[k];
1106
+ else if (val !== undefined)
1107
+ v[k] = val;
1108
+ }
1115
1109
  // Patches that change the rendered visual deeply (label, colour, icon)
1116
1110
  // re-render by destroying + re-spawning the container in place.
1117
1111
  const reg2 = reg;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboxy/phaser-sdk",
3
- "version": "0.2.40",
3
+ "version": "0.2.41",
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",