reversi 💮 💯

This commit is contained in:
syuilo
2018-06-17 08:10:54 +09:00
parent 03f20599ba
commit 1ef66c962a
48 changed files with 197 additions and 197 deletions

View File

@@ -1,7 +1,7 @@
<template>
<mk-window ref="window" width="500px" height="560px" :popout-url="popout" @closed="$destroy">
<span slot="header" :class="$style.header">%fa:gamepad%%i18n:@game%</span>
<mk-othello :class="$style.content" @gamed="g => game = g"/>
<mk-reversi :class="$style.content" @gamed="g => game = g"/>
</mk-window>
</template>
@@ -18,8 +18,8 @@ export default Vue.extend({
computed: {
popout(): string {
return this.game
? `${url}/othello/${this.game.id}`
: `${url}/othello`;
? `${url}/reversi/${this.game.id}`
: `${url}/reversi`;
}
}
});

View File

@@ -56,23 +56,23 @@ export default Vue.extend({
this.connection = (this as any).os.stream.getConnection();
this.connectionId = (this as any).os.stream.use();
this.connection.on('othello_invited', this.onOthelloInvited);
this.connection.on('othello_no_invites', this.onOthelloNoInvites);
this.connection.on('reversi_invited', this.onReversiInvited);
this.connection.on('reversi_no_invites', this.onReversiNoInvites);
}
},
beforeDestroy() {
if (this.$store.getters.isSignedIn) {
this.connection.off('othello_invited', this.onOthelloInvited);
this.connection.off('othello_no_invites', this.onOthelloNoInvites);
this.connection.off('reversi_invited', this.onReversiInvited);
this.connection.off('reversi_no_invites', this.onReversiNoInvites);
(this as any).os.stream.dispose(this.connectionId);
}
},
methods: {
onOthelloInvited() {
onReversiInvited() {
this.hasGameInvitations = true;
},
onOthelloNoInvites() {
onReversiNoInvites() {
this.hasGameInvitations = false;
},

View File

@@ -1,6 +1,6 @@
<template>
<component :is="ui ? 'mk-ui' : 'div'">
<mk-othello v-if="!fetching" :init-game="game" @gamed="onGamed"/>
<mk-reversi v-if="!fetching" :init-game="game" @gamed="onGamed"/>
</component>
</template>
@@ -33,7 +33,7 @@ export default Vue.extend({
Progress.start();
this.fetching = true;
(this as any).api('othello/games/show', {
(this as any).api('reversi/games/show', {
gameId: this.$route.params.game
}).then(game => {
this.game = game;
@@ -43,7 +43,7 @@ export default Vue.extend({
});
},
onGamed(game) {
history.pushState(null, null, '/othello/' + game.id);
history.pushState(null, null, '/reversi/' + game.id);
}
}
});