@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.
- package/dist/scene/HudRuntime.js +11 -17
- package/package.json +1 -1
package/dist/scene/HudRuntime.js
CHANGED
|
@@ -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
|
|
1097
|
-
//
|
|
1098
|
-
//
|
|
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
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
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;
|