diff options
Diffstat (limited to '')
| -rw-r--r-- | web/play/src/slots.ts | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/web/play/src/slots.ts b/web/play/src/slots.ts index 8b821cf..cfc9070 100644 --- a/web/play/src/slots.ts +++ b/web/play/src/slots.ts | |||
| @@ -49,10 +49,6 @@ export function renderSlots( | |||
| 49 | clear(board); | 49 | clear(board); |
| 50 | clear(side); | 50 | clear(side); |
| 51 | 51 | ||
| 52 | const title = node("h2", undefined, "Slots"); | ||
| 53 | const note = node("p", "note", "Match three or more symbols from the left. Five paylines."); | ||
| 54 | board.append(title, note); | ||
| 55 | |||
| 56 | const reels = node("div", "reels"); | 52 | const reels = node("div", "reels"); |
| 57 | const tiles: HTMLElement[] = []; | 53 | const tiles: HTMLElement[] = []; |
| 58 | const flat = Array.isArray(view.reels) | 54 | const flat = Array.isArray(view.reels) |
| @@ -81,24 +77,28 @@ export function renderSlots( | |||
| 81 | board.append(reels); | 77 | board.append(reels); |
| 82 | 78 | ||
| 83 | const lines = node("div", "win-lines"); | 79 | const lines = node("div", "win-lines"); |
| 80 | let resultText = "Ready"; | ||
| 84 | if (!active && view.phase === "result") { | 81 | if (!active && view.phase === "result") { |
| 85 | const winnings = Number(view.winnings ?? 0); | 82 | const winnings = Number(view.winnings ?? 0); |
| 86 | if (winnings > 0) { | 83 | if (winnings > 0) { |
| 87 | const names = (view.win_lines ?? []) | 84 | const names = (view.win_lines ?? []) |
| 88 | .map((line: number) => `${line} (${LINE_NAMES[line - 1] ?? "line"})`) | 85 | .map((line: number) => `${line} (${LINE_NAMES[line - 1] ?? "line"})`) |
| 89 | .join(" · "); | 86 | .join(" · "); |
| 90 | lines.textContent = `${view.win_type === "mega" ? "MEGA WIN" : view.win_type === "big" ? "BIG WIN" : "WIN"} ${money(winnings)}${names ? ` · ${names}` : ""}`; | 87 | resultText = `${view.win_type === "mega" ? "MEGA WIN" : view.win_type === "big" ? "BIG WIN" : "WIN"} ${money(winnings)}${names ? ` · ${names}` : ""}`; |
| 88 | lines.textContent = names; | ||
| 91 | lines.classList.add("win-text"); | 89 | lines.classList.add("win-text"); |
| 92 | } else { | 90 | } else { |
| 93 | lines.textContent = "No win — spin again."; | 91 | resultText = "No win"; |
| 94 | } | 92 | } |
| 95 | } else if (active) { | 93 | } else if (active) { |
| 96 | lines.textContent = "Spinning…"; | 94 | resultText = "Spinning…"; |
| 97 | } else { | ||
| 98 | lines.textContent = "Pick a bet and spin."; | ||
| 99 | } | 95 | } |
| 100 | board.append(lines); | 96 | board.append(lines); |
| 101 | 97 | ||
| 98 | const foot = node("div", "board-foot"); | ||
| 99 | foot.append(node("span", "label", "Result"), node("span", undefined, resultText)); | ||
| 100 | board.append(foot); | ||
| 101 | |||
| 102 | if (active) { | 102 | if (active) { |
| 103 | let tick = 0; | 103 | let tick = 0; |
| 104 | animation = window.setInterval(() => { | 104 | animation = window.setInterval(() => { |
| @@ -117,13 +117,13 @@ export function renderSlots( | |||
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | // Sidebar | 119 | // Sidebar |
| 120 | side.append(node("div", "label", "Slots")); | 120 | side.append(node("h2", undefined, "Slots")); |
| 121 | side.append(node("p", "note", "5 reels × 3 rows, 5 paylines.")); | 121 | side.append(node("p", "note", "Match three or more symbols from the left.")); |
| 122 | 122 | ||
| 123 | const betRow = node("div", "row"); | 123 | const betRow = node("div", "row"); |
| 124 | const minus = node("button", "btn small", "−10"); | 124 | const minus = node("button", "btn small", "−"); |
| 125 | const bet = node("strong", "mono", money(Number(view.bet ?? 0))); | 125 | const bet = node("strong", "mono", money(Number(view.bet ?? 0))); |
| 126 | const plus = node("button", "btn small", "+10"); | 126 | const plus = node("button", "btn small", "+"); |
| 127 | minus.disabled = active; | 127 | minus.disabled = active; |
| 128 | plus.disabled = active; | 128 | plus.disabled = active; |
| 129 | minus.addEventListener("click", () => send({ AdjustBet: -10 })); | 129 | minus.addEventListener("click", () => send({ AdjustBet: -10 })); |
| @@ -136,12 +136,12 @@ export function renderSlots( | |||
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | const status = node("p", "note"); | 138 | const status = node("p", "note"); |
| 139 | if (active) status.textContent = "Spinning…"; | 139 | if (active) status.textContent = "SPINNING…"; |
| 140 | else if (view.phase === "result") { | 140 | else if (view.phase === "result") { |
| 141 | const winnings = Number(view.winnings ?? 0); | 141 | const winnings = Number(view.winnings ?? 0); |
| 142 | status.textContent = winnings > 0 ? `Won ${money(winnings)}` : "No win this spin."; | 142 | status.textContent = winnings > 0 ? `WON ${money(winnings)}` : "NO WIN"; |
| 143 | if (winnings > 0) status.classList.add("win-text"); | 143 | if (winnings > 0) status.classList.add("win-text"); |
| 144 | } else status.textContent = "Ready when you are."; | 144 | } else status.textContent = "Press SPIN to play."; |
| 145 | side.append(status); | 145 | side.append(status); |
| 146 | 146 | ||
| 147 | const actions = node("div", "actions"); | 147 | const actions = node("div", "actions"); |
