enhance(reversi): tweak reversi

This commit is contained in:
syuilo
2024-01-21 12:05:51 +09:00
parent 4de77784c9
commit 6039f27bd5
7 changed files with 149 additions and 78 deletions

View File

@@ -40,6 +40,7 @@ class ReversiGameChannel extends Channel {
switch (type) {
case 'ready': this.ready(body); break;
case 'updateSettings': this.updateSettings(body.key, body.value); break;
case 'cancel': this.cancelGame(); break;
case 'putStone': this.putStone(body.pos, body.id); break;
case 'checkState': this.checkState(body.crc32); break;
case 'claimTimeIsUp': this.claimTimeIsUp(); break;
@@ -60,6 +61,13 @@ class ReversiGameChannel extends Channel {
this.reversiService.gameReady(this.gameId!, this.user, ready);
}
@bindThis
private async cancelGame() {
if (this.user == null) return;
this.reversiService.cancelGame(this.gameId!, this.user);
}
@bindThis
private async putStone(pos: number, id: string) {
if (this.user == null) return;