@energy8platform/shell 0.6.0 → 0.6.2
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/html.cjs.js +9 -2
- package/dist/html.cjs.js.map +1 -1
- package/dist/html.d.ts +8 -3
- package/dist/html.esm.js +9 -2
- package/dist/html.esm.js.map +1 -1
- package/dist/index.cjs.js +9 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.esm.js +9 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/pixi.cjs.js +34 -3
- package/dist/pixi.cjs.js.map +1 -1
- package/dist/pixi.d.ts +8 -3
- package/dist/pixi.esm.js +34 -3
- package/dist/pixi.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/core/ShellController.ts +8 -1
- package/src/core/version.ts +1 -1
- package/src/ui/pixi/PixiRenderer.ts +6 -0
- package/src/ui/pixi/components/GameInfo.ts +18 -1
package/dist/pixi.cjs.js
CHANGED
|
@@ -1449,7 +1449,7 @@ class KeyboardController {
|
|
|
1449
1449
|
|
|
1450
1450
|
// AUTO-GENERATED by scripts/gen-version.mjs — do not edit. Mirrors package.json "version".
|
|
1451
1451
|
/** The @energy8platform/shell package version, stamped into the game-info footer. */
|
|
1452
|
-
const PACKAGE_VERSION = '0.6.
|
|
1452
|
+
const PACKAGE_VERSION = '0.6.2';
|
|
1453
1453
|
|
|
1454
1454
|
/** Apply defaults to the raw config (the mount target lives on the renderer, not here). */
|
|
1455
1455
|
function resolveConfig(config) {
|
|
@@ -1727,10 +1727,17 @@ class ShellController extends EventEmitter {
|
|
|
1727
1727
|
this.prevBalance = n;
|
|
1728
1728
|
this.money('balance', from, n);
|
|
1729
1729
|
}
|
|
1730
|
-
|
|
1730
|
+
/** Set the WIN readout. Counts up/down from the previous value by default. Pass
|
|
1731
|
+
* `{ animate: false }` to SNAP instantly (renderBar cancels any in-flight count-up) — used by the
|
|
1732
|
+
* host to clear WIN to 0 at spin start, where an animated count-DOWN would look wrong. */
|
|
1733
|
+
setWin(n, opts) {
|
|
1731
1734
|
const from = this.prevWin;
|
|
1732
1735
|
this.state.win = n;
|
|
1733
1736
|
this.prevWin = n;
|
|
1737
|
+
if (opts?.animate === false) {
|
|
1738
|
+
this.renderer.renderBar(); // instant repaint from state; cancels running money anims
|
|
1739
|
+
return;
|
|
1740
|
+
}
|
|
1734
1741
|
this.money('win', from, n);
|
|
1735
1742
|
}
|
|
1736
1743
|
setBet(n) {
|
|
@@ -4627,7 +4634,7 @@ function sectionCustom(host, s, width) {
|
|
|
4627
4634
|
const sec = section(host, s.title != null ? host.t(s.title) : undefined);
|
|
4628
4635
|
const inner = width - SECTION_PAD;
|
|
4629
4636
|
if (s.node) {
|
|
4630
|
-
sec.add(s.node); // game-supplied Pixi content owns its own layout
|
|
4637
|
+
sec.add(persistentSlot(s.node)); // game-supplied Pixi content owns its own layout
|
|
4631
4638
|
}
|
|
4632
4639
|
else if (s.html) {
|
|
4633
4640
|
const text = s.html.replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim();
|
|
@@ -4684,6 +4691,23 @@ function spacerBox(w, h) {
|
|
|
4684
4691
|
g.rect(0, 0, w, h).fill({ color: 0xffffff, alpha: 0 });
|
|
4685
4692
|
return g;
|
|
4686
4693
|
}
|
|
4694
|
+
/** Wrap a GAME-supplied custom `node` so the shell BORROWS it instead of owning it. The overlay is
|
|
4695
|
+
* torn down with `destroy({ children: true })` on every close; that would recursively destroy the
|
|
4696
|
+
* game's node, so the section renders blank on reopen. This slot's `destroy` DETACHES the node
|
|
4697
|
+
* (leaving it intact) and destroys only the empty wrapper — the SAME node instance is re-mounted,
|
|
4698
|
+
* with all its drawing, the next time Game info opens. Mirrors the HTML shell, where the game's DOM
|
|
4699
|
+
* node simply persists in config across open/close. The game owns the node's lifetime, not us. */
|
|
4700
|
+
function persistentSlot(node) {
|
|
4701
|
+
const slot = new pixi_js.Container();
|
|
4702
|
+
slot.addChild(node);
|
|
4703
|
+
const destroySelf = pixi_js.Container.prototype.destroy.bind(slot);
|
|
4704
|
+
slot.destroy = () => {
|
|
4705
|
+
if (node.parent === slot)
|
|
4706
|
+
slot.removeChild(node); // keep the game node alive for the next open
|
|
4707
|
+
destroySelf({ children: false });
|
|
4708
|
+
};
|
|
4709
|
+
return slot;
|
|
4710
|
+
}
|
|
4687
4711
|
/** A fixed box that loads an image into it (object-fit: contain) once the texture resolves. */
|
|
4688
4712
|
function imageBox(url, w, h) {
|
|
4689
4713
|
const c = new pixi_js.Container();
|
|
@@ -5926,6 +5950,13 @@ class PixiRenderer {
|
|
|
5926
5950
|
// make sure the stage delivers global pointer moves (drag, sliders)
|
|
5927
5951
|
this.app.stage.eventMode = 'static';
|
|
5928
5952
|
this.app.renderer.on('resize', this.onResize);
|
|
5953
|
+
// Seed the layout from the CURRENT screen size. The renderer was resized to the container during
|
|
5954
|
+
// boot (ViewportManager.refresh) BEFORE this shell mounted and subscribed above, so that initial
|
|
5955
|
+
// 'resize' event is already gone and won't fire again on a stationary device. Without this seed
|
|
5956
|
+
// the controller's layout stays at its 'wide' DEFAULT — a portrait mobile would show the DESKTOP
|
|
5957
|
+
// bar. (The HTML renderer gets this for free: its ResizeObserver fires immediately on observe.)
|
|
5958
|
+
if (this.screenW > 0)
|
|
5959
|
+
this.host.notifyResize(this.screenW, this.screenH);
|
|
5929
5960
|
whenFontReady(() => {
|
|
5930
5961
|
if (!this.destroyed)
|
|
5931
5962
|
this.renderBar();
|