From ee9bf18c6a72a7723fa9428ee96b7bf85a53bf8c Mon Sep 17 00:00:00 2001 From: eguneys Date: Tue, 30 Jan 2024 19:18:59 +0300 Subject: [PATCH] cant undo bug --- src/game.ts | 4 ++-- src/showcase.ts | 1 + src/solitaire_game_dragful.ts | 14 +++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/game.ts b/src/game.ts index c382518..f176ac1 100644 --- a/src/game.ts +++ b/src/game.ts @@ -2699,8 +2699,8 @@ class SceneTransition extends Play { //this.current = this._make(CardShowcase, Vec2.zero, {}) // this.current = this._make(MainMenu, Vec2.zero, {}) - this.current = this._make(Statistics2, Vec2.zero, {}) - //this.current = this._make(MainMenu2, Vec2.zero, {}) + //this.current = this._make(Statistics2, Vec2.zero, {}) + this.current = this._make(MainMenu2, Vec2.zero, {}) //this.current = this._make(HowtoPlay2, Vec2.zero, {}) //this.current = this._make(Settings2, Vec2.zero, {}) //this.current = this._make(SolitairePlay, Vec2.zero, {}) diff --git a/src/showcase.ts b/src/showcase.ts index 31c9c4e..9259a6c 100644 --- a/src/showcase.ts +++ b/src/showcase.ts @@ -847,6 +847,7 @@ export class Tableu extends Play { } remove_fronts(i: number) { + this.hover_end() let cards = this.fronts.remove_cards(i) return cards } diff --git a/src/solitaire_game_dragful.ts b/src/solitaire_game_dragful.ts index 0bc1297..de9de08 100644 --- a/src/solitaire_game_dragful.ts +++ b/src/solitaire_game_dragful.ts @@ -65,7 +65,7 @@ export class SolitaireGameDragful extends Play { } cant_undo() { - throw new Error("Method not implemented."); + //throw new Error("Method not implemented."); } undo(cmd: IMove) { this.cards.undo(cmd) @@ -537,6 +537,18 @@ class SolitaireCards extends Play { this.tableus[i].add_fronts(fronts) }) + + + back.foundations.forEach((foundation, i) => { + let fs = foundation.foundation.cards.map(card => { + let c = this.cards.borrow() + c.card = card + c.flip_front() + return c + }) + + this.foundations[i].add_cards(fs) + }) } _release_cancel_drag() {