@open-slot-ui/pixi 0.7.0 → 0.7.1

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/index.cjs CHANGED
@@ -3985,6 +3985,30 @@ var PanelBodyView = class extends ControlView {
3985
3985
  super.dispose();
3986
3986
  }
3987
3987
  };
3988
+ function showReplayModal(ui, info, buttonKey, onSelect) {
3989
+ const cur = info.currency ?? ui.balance.currency.get();
3990
+ const money = (n) => core.formatAmount(n, cur);
3991
+ ui.showNotice(
3992
+ [
3993
+ { kind: "heading", id: "openui-replay-h", text: "openui.replay.title" },
3994
+ {
3995
+ kind: "stat-grid",
3996
+ id: "openui-replay-g",
3997
+ items: [
3998
+ { label: "openui.replay.baseBet", value: money(info.baseBet) },
3999
+ { label: "openui.replay.costMultiplier", value: `${info.costMultiplier}\xD7` },
4000
+ { label: "openui.replay.payoutMultiplier", value: `${info.payoutMultiplier}\xD7` },
4001
+ { label: "openui.replay.amount", value: money(info.amount) }
4002
+ ]
4003
+ }
4004
+ ],
4005
+ [{ label: buttonKey, variant: "primary", onSelect: () => {
4006
+ ui.hideNotice();
4007
+ onSelect();
4008
+ } }],
4009
+ { blocking: true }
4010
+ );
4011
+ }
3988
4012
  function mountHud(app, spec = {}, opts = {}) {
3989
4013
  const { hooks, ...pixiOpts } = opts;
3990
4014
  const ui = core.createUI(spec, hooks);
@@ -4050,30 +4074,10 @@ function mountHud(app, spec = {}, opts = {}) {
4050
4074
  setReplay: (on2) => ui.setReplay(on2),
4051
4075
  replayStart: (info, onPlay) => {
4052
4076
  ui.setReplay(true);
4053
- const cur = info.currency ?? ui.balance.currency.get();
4054
- const money = (n) => core.formatAmount(n, cur);
4055
- ui.showNotice(
4056
- [
4057
- { kind: "heading", id: "openui-replay-h", text: "openui.replay.title" },
4058
- {
4059
- kind: "stat-grid",
4060
- id: "openui-replay-g",
4061
- items: [
4062
- { label: "openui.replay.baseBet", value: money(info.baseBet) },
4063
- { label: "openui.replay.costMultiplier", value: `${info.costMultiplier}\xD7` },
4064
- { label: "openui.replay.payoutMultiplier", value: `${info.payoutMultiplier}\xD7` },
4065
- { label: "openui.replay.amount", value: money(info.amount) }
4066
- ]
4067
- }
4068
- ],
4069
- [{ label: "openui.replay.play", variant: "primary", onSelect: onPlay }]
4070
- );
4077
+ showReplayModal(ui, info, "openui.replay.play", () => onPlay?.());
4071
4078
  },
4072
- replayEnd: (onReplay) => {
4073
- ui.showNotice(
4074
- [{ kind: "heading", id: "openui-replay-end", text: "openui.replay.title" }],
4075
- [{ label: "openui.replay.again", variant: "primary", onSelect: onReplay }]
4076
- );
4079
+ replayEnd: (info, onReplay) => {
4080
+ showReplayModal(ui, info, "openui.replay.again", onReplay);
4077
4081
  },
4078
4082
  confirmBuy: (o) => {
4079
4083
  if (ui.isDisabled("buyFeature")) return;