Add StartGame handling
This commit is contained in:
parent
b7df92a06e
commit
17bec179cd
1 changed files with 20 additions and 2 deletions
|
|
@ -36,8 +36,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div v-if="is_host" class="controls">
|
||||
<button v-if="is_host">Start Game</button>
|
||||
<br>
|
||||
<button @click.stop="start_game()">Start Game</button>
|
||||
<button @click.stop="handle_exit_button()">Kill Game</button>
|
||||
</div>
|
||||
<div v-else class="controls">
|
||||
|
|
@ -108,6 +107,12 @@ export default {
|
|||
ban: false,
|
||||
});
|
||||
},
|
||||
start_game() {
|
||||
this.$socket.emit(`StartGame`, {
|
||||
game_code: this.game_code,
|
||||
user: this.username,
|
||||
});
|
||||
},
|
||||
},
|
||||
sockets: {
|
||||
PlayerList(data) {
|
||||
|
|
@ -156,6 +161,19 @@ export default {
|
|||
}, 3000);
|
||||
};
|
||||
},
|
||||
Starting(data) {
|
||||
if (!data.success) {
|
||||
this.$emit(`alert`, {
|
||||
message: data.message,
|
||||
classes: [`error`]
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$emit(`alert`, { message: ``, classes: [] }, 3000)
|
||||
})
|
||||
} else {
|
||||
this.$emit(`go-to`, `in-game`);
|
||||
};
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue