@energy8platform/shell 0.6.5 → 0.6.6
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 +11 -9
- package/dist/html.cjs.js.map +1 -1
- package/dist/html.d.ts +11 -6
- package/dist/html.esm.js +11 -9
- package/dist/html.esm.js.map +1 -1
- package/dist/index.cjs.js +7 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +10 -5
- package/dist/index.esm.js +7 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/pixi.cjs.js +14 -8
- package/dist/pixi.cjs.js.map +1 -1
- package/dist/pixi.d.ts +11 -6
- package/dist/pixi.esm.js +14 -8
- package/dist/pixi.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/core/ShellController.ts +7 -5
- package/src/core/renderer.ts +4 -2
- package/src/core/version.ts +1 -1
- package/src/ui/html/HtmlRenderer.ts +4 -4
- package/src/ui/pixi/PixiRenderer.ts +9 -7
package/dist/html.d.ts
CHANGED
|
@@ -390,8 +390,10 @@ interface ShellRenderer {
|
|
|
390
390
|
setLayout(layout: ShellLayoutMode): void;
|
|
391
391
|
/** Apply colour tokens (CSS vars in DOM / repaint in Pixi). */
|
|
392
392
|
applyTheme(tokens: ShellTokens): void;
|
|
393
|
-
/** Count a money readout from→to on the freshly-rendered bar (DOM rAF / Pixi ticker).
|
|
394
|
-
|
|
393
|
+
/** Count a money readout from→to on the freshly-rendered bar (DOM rAF / Pixi ticker).
|
|
394
|
+
* `durationMs` overrides the renderer's default count-up length — a cascade/tumble scene
|
|
395
|
+
* reporting a win per step needs each count-up to fit inside its step. */
|
|
396
|
+
animateMoney(field: 'balance' | 'win', from: number, to: number, durationMs?: number): void;
|
|
395
397
|
/** Build + show an overlay from a controller-supplied model; return a handle for key routing
|
|
396
398
|
* and programmatic close. Returns void when nothing was shown. */
|
|
397
399
|
openOverlay(req: OverlayRequest): OverlayHandle | void;
|
|
@@ -516,7 +518,7 @@ declare class ShellController extends EventEmitter<ShellEvents> implements Shell
|
|
|
516
518
|
tokens: ShellTokens;
|
|
517
519
|
layout: ShellLayoutMode;
|
|
518
520
|
soundOn: boolean;
|
|
519
|
-
readonly engineVersion = "0.6.
|
|
521
|
+
readonly engineVersion = "0.6.6";
|
|
520
522
|
readonly actions: ShellActions;
|
|
521
523
|
private renderer;
|
|
522
524
|
private i18n;
|
|
@@ -560,9 +562,12 @@ declare class ShellController extends EventEmitter<ShellEvents> implements Shell
|
|
|
560
562
|
setBalance(n: number): void;
|
|
561
563
|
/** Set the WIN readout. Counts up/down from the previous value by default. Pass
|
|
562
564
|
* `{ animate: false }` to SNAP instantly (renderBar cancels any in-flight count-up) — used by the
|
|
563
|
-
* host to clear WIN to 0 at spin start, where an animated count-DOWN would look wrong.
|
|
565
|
+
* host to clear WIN to 0 at spin start, where an animated count-DOWN would look wrong.
|
|
566
|
+
* `{ durationMs }` shortens/lengthens the count-up (default 450ms) — a scene reporting a win per
|
|
567
|
+
* cascade step passes its step length so each count-up finishes before the next step lands. */
|
|
564
568
|
setWin(n: number, opts?: {
|
|
565
569
|
animate?: boolean;
|
|
570
|
+
durationMs?: number;
|
|
566
571
|
}): void;
|
|
567
572
|
setBet(n: number): void;
|
|
568
573
|
setMode(mode: ShellMode): void;
|
|
@@ -598,7 +603,7 @@ interface I18n {
|
|
|
598
603
|
declare function createI18n(opts: I18nOptions): I18n;
|
|
599
604
|
|
|
600
605
|
/** The @energy8platform/shell package version, stamped into the game-info footer. */
|
|
601
|
-
declare const PACKAGE_VERSION = "0.6.
|
|
606
|
+
declare const PACKAGE_VERSION = "0.6.6";
|
|
602
607
|
|
|
603
608
|
/** A shell: the renderer-agnostic controller plus the surface facade (safeArea/barHeight/setVisible)
|
|
604
609
|
* an embedding host reads. `createShell`, `createGameShell` and `createPixiShell` all return this. */
|
|
@@ -636,7 +641,7 @@ declare class HtmlRenderer implements ShellRenderer {
|
|
|
636
641
|
applyTheme(tokens: ShellTokens): void;
|
|
637
642
|
renderBar(): void;
|
|
638
643
|
setLayout(): void;
|
|
639
|
-
animateMoney(field: 'balance' | 'win', from: number, to: number): void;
|
|
644
|
+
animateMoney(field: 'balance' | 'win', from: number, to: number, durationMs?: number): void;
|
|
640
645
|
openOverlay(req: OverlayRequest): OverlayHandle | void;
|
|
641
646
|
closeOverlay(): void;
|
|
642
647
|
refreshSoundIcon?(_on: boolean): void;
|
package/dist/html.esm.js
CHANGED
|
@@ -1453,7 +1453,7 @@ class KeyboardController {
|
|
|
1453
1453
|
|
|
1454
1454
|
// AUTO-GENERATED by scripts/gen-version.mjs — do not edit. Mirrors package.json "version".
|
|
1455
1455
|
/** The @energy8platform/shell package version, stamped into the game-info footer. */
|
|
1456
|
-
const PACKAGE_VERSION = '0.6.
|
|
1456
|
+
const PACKAGE_VERSION = '0.6.6';
|
|
1457
1457
|
|
|
1458
1458
|
/** Apply defaults to the raw config (the mount target lives on the renderer, not here). */
|
|
1459
1459
|
function resolveConfig(config) {
|
|
@@ -1720,10 +1720,10 @@ class ShellController extends EventEmitter {
|
|
|
1720
1720
|
this.renderer.renderBar();
|
|
1721
1721
|
}
|
|
1722
1722
|
// ── game-facing public API (mirrors GameShell/PixiGameShell) ───────────────────
|
|
1723
|
-
money(field, from, to) {
|
|
1723
|
+
money(field, from, to, durationMs) {
|
|
1724
1724
|
this.renderer.renderBar();
|
|
1725
1725
|
if (to !== from)
|
|
1726
|
-
this.renderer.animateMoney(field, from, to);
|
|
1726
|
+
this.renderer.animateMoney(field, from, to, durationMs);
|
|
1727
1727
|
}
|
|
1728
1728
|
setBalance(n) {
|
|
1729
1729
|
const from = this.prevBalance;
|
|
@@ -1733,7 +1733,9 @@ class ShellController extends EventEmitter {
|
|
|
1733
1733
|
}
|
|
1734
1734
|
/** Set the WIN readout. Counts up/down from the previous value by default. Pass
|
|
1735
1735
|
* `{ animate: false }` to SNAP instantly (renderBar cancels any in-flight count-up) — used by the
|
|
1736
|
-
* host to clear WIN to 0 at spin start, where an animated count-DOWN would look wrong.
|
|
1736
|
+
* host to clear WIN to 0 at spin start, where an animated count-DOWN would look wrong.
|
|
1737
|
+
* `{ durationMs }` shortens/lengthens the count-up (default 450ms) — a scene reporting a win per
|
|
1738
|
+
* cascade step passes its step length so each count-up finishes before the next step lands. */
|
|
1737
1739
|
setWin(n, opts) {
|
|
1738
1740
|
const from = this.prevWin;
|
|
1739
1741
|
this.state.win = n;
|
|
@@ -1742,7 +1744,7 @@ class ShellController extends EventEmitter {
|
|
|
1742
1744
|
this.renderer.renderBar(); // instant repaint from state; cancels running money anims
|
|
1743
1745
|
return;
|
|
1744
1746
|
}
|
|
1745
|
-
this.money('win', from, n);
|
|
1747
|
+
this.money('win', from, n, opts?.durationMs);
|
|
1746
1748
|
}
|
|
1747
1749
|
setBet(n) {
|
|
1748
1750
|
this.state.bet = n;
|
|
@@ -3888,13 +3890,13 @@ function buildReplayModal(host, opts, reopen) {
|
|
|
3888
3890
|
const REMOVE_FADE_MS = 300;
|
|
3889
3891
|
/** Count-up the value span (.ge-rd-val) of a readout, leaving its label untouched.
|
|
3890
3892
|
* Returns the count-up canceler so the renderer can stop it before the node is replaced. */
|
|
3891
|
-
function animateReadout(el, from, to, fmt) {
|
|
3893
|
+
function animateReadout(el, from, to, fmt, durationMs) {
|
|
3892
3894
|
const val = el.querySelector('.ge-rd-val');
|
|
3893
3895
|
if (!val) {
|
|
3894
3896
|
el.textContent = fmt(to);
|
|
3895
3897
|
return () => { };
|
|
3896
3898
|
}
|
|
3897
|
-
return countUp(val, from, to, fmt);
|
|
3899
|
+
return durationMs == null ? countUp(val, from, to, fmt) : countUp(val, from, to, fmt, durationMs);
|
|
3898
3900
|
}
|
|
3899
3901
|
class HtmlRenderer {
|
|
3900
3902
|
host;
|
|
@@ -3953,11 +3955,11 @@ class HtmlRenderer {
|
|
|
3953
3955
|
setLayout() {
|
|
3954
3956
|
this.renderBar();
|
|
3955
3957
|
}
|
|
3956
|
-
animateMoney(field, from, to) {
|
|
3958
|
+
animateMoney(field, from, to, durationMs) {
|
|
3957
3959
|
const fmt = (n) => this.host.formatCurrency(n, field === 'win');
|
|
3958
3960
|
const el = this.barHost.querySelector(`[data-ge="${field}"]`);
|
|
3959
3961
|
if (el)
|
|
3960
|
-
this.moneyAnims.push(animateReadout(el, from, to, fmt));
|
|
3962
|
+
this.moneyAnims.push(animateReadout(el, from, to, fmt, durationMs));
|
|
3961
3963
|
}
|
|
3962
3964
|
openOverlay(req) {
|
|
3963
3965
|
const built = this.buildOverlay(req);
|