@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/pixi.d.ts CHANGED
@@ -392,8 +392,10 @@ interface ShellRenderer {
392
392
  setLayout(layout: ShellLayoutMode): void;
393
393
  /** Apply colour tokens (CSS vars in DOM / repaint in Pixi). */
394
394
  applyTheme(tokens: ShellTokens): void;
395
- /** Count a money readout from→to on the freshly-rendered bar (DOM rAF / Pixi ticker). */
396
- animateMoney(field: 'balance' | 'win', from: number, to: number): void;
395
+ /** Count a money readout from→to on the freshly-rendered bar (DOM rAF / Pixi ticker).
396
+ * `durationMs` overrides the renderer's default count-up length a cascade/tumble scene
397
+ * reporting a win per step needs each count-up to fit inside its step. */
398
+ animateMoney(field: 'balance' | 'win', from: number, to: number, durationMs?: number): void;
397
399
  /** Build + show an overlay from a controller-supplied model; return a handle for key routing
398
400
  * and programmatic close. Returns void when nothing was shown. */
399
401
  openOverlay(req: OverlayRequest): OverlayHandle | void;
@@ -518,7 +520,7 @@ declare class ShellController extends EventEmitter<ShellEvents> implements Shell
518
520
  tokens: ShellTokens;
519
521
  layout: ShellLayoutMode;
520
522
  soundOn: boolean;
521
- readonly engineVersion = "0.6.5";
523
+ readonly engineVersion = "0.6.6";
522
524
  readonly actions: ShellActions;
523
525
  private renderer;
524
526
  private i18n;
@@ -562,9 +564,12 @@ declare class ShellController extends EventEmitter<ShellEvents> implements Shell
562
564
  setBalance(n: number): void;
563
565
  /** Set the WIN readout. Counts up/down from the previous value by default. Pass
564
566
  * `{ animate: false }` to SNAP instantly (renderBar cancels any in-flight count-up) — used by the
565
- * host to clear WIN to 0 at spin start, where an animated count-DOWN would look wrong. */
567
+ * host to clear WIN to 0 at spin start, where an animated count-DOWN would look wrong.
568
+ * `{ durationMs }` shortens/lengthens the count-up (default 450ms) — a scene reporting a win per
569
+ * cascade step passes its step length so each count-up finishes before the next step lands. */
566
570
  setWin(n: number, opts?: {
567
571
  animate?: boolean;
572
+ durationMs?: number;
568
573
  }): void;
569
574
  setBet(n: number): void;
570
575
  setMode(mode: ShellMode): void;
@@ -600,7 +605,7 @@ interface I18n {
600
605
  declare function createI18n(opts: I18nOptions): I18n;
601
606
 
602
607
  /** The @energy8platform/shell package version, stamped into the game-info footer. */
603
- declare const PACKAGE_VERSION = "0.6.5";
608
+ declare const PACKAGE_VERSION = "0.6.6";
604
609
 
605
610
  /** A shell: the renderer-agnostic controller plus the surface facade (safeArea/barHeight/setVisible)
606
611
  * an embedding host reads. `createShell`, `createGameShell` and `createPixiShell` all return this. */
@@ -666,7 +671,7 @@ declare class PixiRenderer implements ShellRenderer {
666
671
  applyTheme(_tokens: ShellTokens): void;
667
672
  /** Count a money readout from→to on the freshly-rendered bar's value Text node. Mirrors
668
673
  * PixiGameShell.animateMoney (which counted on the just-built bar's value Texts). */
669
- animateMoney(field: 'balance' | 'win', from: number, to: number): void;
674
+ animateMoney(field: 'balance' | 'win', from: number, to: number, durationMs?: number): void;
670
675
  private cancelMoneyAnims;
671
676
  openOverlay(req: OverlayRequest): OverlayHandle | void;
672
677
  closeOverlay(): void;
package/dist/pixi.esm.js CHANGED
@@ -1454,7 +1454,7 @@ class KeyboardController {
1454
1454
 
1455
1455
  // AUTO-GENERATED by scripts/gen-version.mjs — do not edit. Mirrors package.json "version".
1456
1456
  /** The @energy8platform/shell package version, stamped into the game-info footer. */
1457
- const PACKAGE_VERSION = '0.6.5';
1457
+ const PACKAGE_VERSION = '0.6.6';
1458
1458
 
1459
1459
  /** Apply defaults to the raw config (the mount target lives on the renderer, not here). */
1460
1460
  function resolveConfig(config) {
@@ -1721,10 +1721,10 @@ class ShellController extends EventEmitter {
1721
1721
  this.renderer.renderBar();
1722
1722
  }
1723
1723
  // ── game-facing public API (mirrors GameShell/PixiGameShell) ───────────────────
1724
- money(field, from, to) {
1724
+ money(field, from, to, durationMs) {
1725
1725
  this.renderer.renderBar();
1726
1726
  if (to !== from)
1727
- this.renderer.animateMoney(field, from, to);
1727
+ this.renderer.animateMoney(field, from, to, durationMs);
1728
1728
  }
1729
1729
  setBalance(n) {
1730
1730
  const from = this.prevBalance;
@@ -1734,7 +1734,9 @@ class ShellController extends EventEmitter {
1734
1734
  }
1735
1735
  /** Set the WIN readout. Counts up/down from the previous value by default. Pass
1736
1736
  * `{ animate: false }` to SNAP instantly (renderBar cancels any in-flight count-up) — used by the
1737
- * host to clear WIN to 0 at spin start, where an animated count-DOWN would look wrong. */
1737
+ * host to clear WIN to 0 at spin start, where an animated count-DOWN would look wrong.
1738
+ * `{ durationMs }` shortens/lengthens the count-up (default 450ms) — a scene reporting a win per
1739
+ * cascade step passes its step length so each count-up finishes before the next step lands. */
1738
1740
  setWin(n, opts) {
1739
1741
  const from = this.prevWin;
1740
1742
  this.state.win = n;
@@ -1743,7 +1745,7 @@ class ShellController extends EventEmitter {
1743
1745
  this.renderer.renderBar(); // instant repaint from state; cancels running money anims
1744
1746
  return;
1745
1747
  }
1746
- this.money('win', from, n);
1748
+ this.money('win', from, n, opts?.durationMs);
1747
1749
  }
1748
1750
  setBet(n) {
1749
1751
  this.state.bet = n;
@@ -5962,14 +5964,18 @@ class PixiRenderer {
5962
5964
  }
5963
5965
  /** Count a money readout from→to on the freshly-rendered bar's value Text node. Mirrors
5964
5966
  * PixiGameShell.animateMoney (which counted on the just-built bar's value Texts). */
5965
- animateMoney(field, from, to) {
5967
+ animateMoney(field, from, to, durationMs) {
5966
5968
  if (!this.bar)
5967
5969
  return;
5970
+ // countUpText defaults durationMs to 450 — pass it only when the caller overrode it.
5971
+ const count = (text, fmt) => durationMs == null
5972
+ ? countUpText(this.ticker, text, from, to, fmt)
5973
+ : countUpText(this.ticker, text, from, to, fmt, durationMs);
5968
5974
  if (field === 'balance' && this.bar.balanceValue) {
5969
- this.moneyAnims.push(countUpText(this.ticker, this.bar.balanceValue, from, to, (n) => this.ctx.fmt(n)));
5975
+ this.moneyAnims.push(count(this.bar.balanceValue, (n) => this.ctx.fmt(n)));
5970
5976
  }
5971
5977
  else if (field === 'win' && this.bar.winValue) {
5972
- this.moneyAnims.push(countUpText(this.ticker, this.bar.winValue, from, to, (n) => this.ctx.fmtWin(n)));
5978
+ this.moneyAnims.push(count(this.bar.winValue, (n) => this.ctx.fmtWin(n)));
5973
5979
  }
5974
5980
  }
5975
5981
  cancelMoneyAnims() {