From 6d5b486833f068a95dceaa25adf1b7a0bd3fb7bb Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 8 Mar 2018 18:30:28 +0900 Subject: [PATCH] Fix bug --- src/api/stream/othello-game.ts | 1 + src/web/app/common/views/components/othello.game.vue | 4 +++- src/web/app/common/views/components/othello.room.vue | 12 ++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/api/stream/othello-game.ts b/src/api/stream/othello-game.ts index 1dcd37efa..2af1bd97a 100644 --- a/src/api/stream/othello-game.ts +++ b/src/api/stream/othello-game.ts @@ -96,6 +96,7 @@ export default function(request: websocket.request, connection: websocket.connec setTimeout(async () => { const freshGame = await Game.findOne({ _id: gameId }); if (freshGame == null || freshGame.is_started || freshGame.is_ended) return; + if (!freshGame.user1_accepted || !freshGame.user2_accepted) return; let bw: number; if (freshGame.settings.bw == 'random') { diff --git a/src/web/app/common/views/components/othello.game.vue b/src/web/app/common/views/components/othello.game.vue index 2ef6b645c..f0254a0b7 100644 --- a/src/web/app/common/views/components/othello.game.vue +++ b/src/web/app/common/views/components/othello.game.vue @@ -12,7 +12,7 @@
@@ -129,6 +129,8 @@ export default Vue.extend({ methods: { set(pos) { + if (this.game.is_ended) return; + if (!this.iAmPlayer) return; if (!this.isMyTurn) return; if (!this.o.canPut(this.myColor, pos)) return; diff --git a/src/web/app/common/views/components/othello.room.vue b/src/web/app/common/views/components/othello.room.vue index b41d97ec6..445a0b45d 100644 --- a/src/web/app/common/views/components/othello.room.vue +++ b/src/web/app/common/views/components/othello.room.vue @@ -21,6 +21,13 @@
+

+ + + + +

+
キャンセル 準備完了 @@ -50,6 +57,11 @@ export default Vue.extend({ if (this.game.user1_id == (this as any).os.i.id && this.game.user1_accepted) return true; if (this.game.user2_id == (this as any).os.i.id && this.game.user2_accepted) return true; return false; + }, + isOpAccepted(): boolean { + if (this.game.user1_id != (this as any).os.i.id && this.game.user1_accepted) return true; + if (this.game.user2_id != (this as any).os.i.id && this.game.user2_accepted) return true; + return false; } },