This commit is contained in:
Maciej Caderek
2022-04-01 21:05:34 +02:00
parent 02406b9e18
commit 251fe05d28
2 changed files with 16 additions and 3 deletions

View File

@@ -113,7 +113,7 @@ class Player {
await this.board.frame(position, this.game.header);
this.board.render();
if (state.boardConfig.speech) {
if (this.ply > 0 && state.boardConfig.speech) {
this.speech.say(sanToText(position.move?.san as string));
}
@@ -128,6 +128,19 @@ class Player {
sfx.move.play();
}
}
if (position.end === 0) {
const result = this.game.header.Result;
if (result) {
this.speech.say(
result === "1-0"
? "White wins!"
: result === "0-1"
? "Black wins!"
: "Draw"
);
}
}
}
async first() {

View File

@@ -89,8 +89,8 @@ export type BoardConfig = {
showChecks: boolean;
showCoords: boolean;
showShadows: boolean;
sounds: boolean;
speech: boolean;
sounds?: boolean;
speech?: boolean;
flipped: boolean;
};