From 8cb0797587c53fdfa1803f4eef7c7a4a1adeba34 Mon Sep 17 00:00:00 2001 From: eguneys Date: Fri, 29 Dec 2023 17:37:42 +0300 Subject: [PATCH] foundation --- src/solitaire.ts | 6 +++++- src/solitaire_back.ts | 5 ++++- src/solitaire_game.ts | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/solitaire.ts b/src/solitaire.ts index 51c11a5..d188d27 100644 --- a/src/solitaire.ts +++ b/src/solitaire.ts @@ -512,7 +512,11 @@ export class SolitairePlay extends Play { scoreboard.score = _ } - make_solitaire_back(game, on_score).then(back_res => { + const on_new_game = (_: Settings) => { + title.settings = _ + } + + make_solitaire_back(game, on_score, on_new_game).then(back_res => { game.back_res = back_res game._collect_pov() Sound.music('main') diff --git a/src/solitaire_back.ts b/src/solitaire_back.ts index 062570e..1b8e2b4 100644 --- a/src/solitaire_back.ts +++ b/src/solitaire_back.ts @@ -11,7 +11,9 @@ export type BackRes = { } -export const make_solitaire_back = async (game: SolitaireGame, on_score: (_: number) => void): Promise => { +export const make_solitaire_back = async (game: SolitaireGame, + on_score: (_: number) => void, + on_new_game: (_: Settings) => void): Promise => { let back = solitaire_back let game_pov = await back.get_pov() @@ -64,6 +66,7 @@ export const make_solitaire_back = async (game: SolitaireGame, on_score: (_: num game.new_game() back.get_pov().then(_ => on_score(_.score)) + back.get_pov().then(_ => on_new_game(_.game.settings)) } } diff --git a/src/solitaire_game.ts b/src/solitaire_game.ts index cd7480d..19c389e 100644 --- a/src/solitaire_game.ts +++ b/src/solitaire_game.ts @@ -700,7 +700,9 @@ export class SolitaireGame extends Play { cant(cmd: IMoveType, data: any) { - if (cmd === WasteToTableu) { + if (cmd === FoundationToTableu) { + this._release_cancel_drag() + } else if (cmd === WasteToTableu) { this._release_cancel_drag() } else if (cmd === WasteToFoundation) { this._release_cancel_drag()