WIP
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -89,8 +89,8 @@ export type BoardConfig = {
|
||||
showChecks: boolean;
|
||||
showCoords: boolean;
|
||||
showShadows: boolean;
|
||||
sounds: boolean;
|
||||
speech: boolean;
|
||||
sounds?: boolean;
|
||||
speech?: boolean;
|
||||
flipped: boolean;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user