This commit is contained in:
syuilo 2018-03-07 22:25:26 +09:00
parent 81d0f59e4f
commit 4b7efd1f17
2 changed files with 7 additions and 1 deletions

View file

@ -29,6 +29,8 @@ export default class Othello {
}); });
} }
public prevPos = -1;
public get blackCount() { public get blackCount() {
return this.board.filter(s => s == 'black').length; return this.board.filter(s => s == 'black').length;
} }
@ -59,6 +61,7 @@ export default class Othello {
* *
*/ */
public set2(color, x, y) { public set2(color, x, y) {
this.prevPos = x + (y * 8);
this.write(color, x, y); this.write(color, x, y);
const reverses = this.getReverse(color, x, y); const reverses = this.getReverse(color, x, y);

View file

@ -10,7 +10,7 @@
</p> </p>
<div class="board"> <div class="board">
<div v-for="(stone, i) in o.board" <div v-for="(stone, i) in o.board"
:class="{ empty: stone == null, myTurn: isMyTurn, can: o.canReverse(turn.id == game.black_user.id ? 'black' : 'white', i) }" :class="{ empty: stone == null, myTurn: isMyTurn, can: o.canReverse(turn.id == game.black_user.id ? 'black' : 'white', i), prev: o.prevPos == i }"
@click="set(i)" @click="set(i)"
> >
<img v-if="stone == 'black'" :src="`${game.black_user.avatar_url}?thumbnail&size=64`" alt=""> <img v-if="stone == 'black'" :src="`${game.black_user.avatar_url}?thumbnail&size=64`" alt="">
@ -218,6 +218,9 @@ export default Vue.extend({
&:active &:active
background darken($theme-color, 10%) background darken($theme-color, 10%)
&.prev
box-shadow 0 0 0 4px rgba($theme-color, 0.7)
> img > img
display block display block
width 100% width 100%