Fixed speach sythesis conditions
This commit is contained in:
@@ -54,7 +54,4 @@ const PiecesCache = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
window.PiecesCache = PiecesCache;
|
|
||||||
|
|
||||||
export default PiecesCache;
|
export default PiecesCache;
|
||||||
|
|||||||
@@ -190,18 +190,12 @@ class Player {
|
|||||||
await this.board.frame(position, this.game.header);
|
await this.board.frame(position, this.game.header);
|
||||||
this.board.render();
|
this.board.render();
|
||||||
|
|
||||||
if (window.speechSynthesis) {
|
if (window.speechSynthesis && state.siteConfig.speech) {
|
||||||
if (this.ply > 0 && state.siteConfig.speech) {
|
if (this.ply > 0) {
|
||||||
this.speech.say(sanToText(position.move?.san as string));
|
this.speech.say(sanToText(position.move?.san as string));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.ply > 0 && state.siteConfig.sounds) {
|
if (position.end === 0) {
|
||||||
state.boardConfig.piecesStyle.includes("anarchy")
|
|
||||||
? this.playAnarchySFX(position)
|
|
||||||
: this.playSFX(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (position.end === 0 && state.siteConfig.speech) {
|
|
||||||
const result = this.game.header.Result;
|
const result = this.game.header.Result;
|
||||||
if (result) {
|
if (result) {
|
||||||
this.speech.say(
|
this.speech.say(
|
||||||
@@ -214,6 +208,12 @@ class Player {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.ply > 0 && state.siteConfig.sounds) {
|
||||||
|
state.boardConfig.piecesStyle.includes("anarchy")
|
||||||
|
? this.playAnarchySFX(position)
|
||||||
|
: this.playSFX(position);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async first() {
|
async first() {
|
||||||
|
|||||||
Reference in New Issue
Block a user