Added leaderboard, music & respawn screen

This commit is contained in:
Thomas
2020-09-03 16:13:04 +02:00
parent 4d542c1091
commit 832e55c0a3
20 changed files with 259 additions and 113 deletions

View File

@@ -1,17 +1,18 @@
import { ToastProgrammatic as Toast } from 'buefy'
// const connection = new WebSocket('ws://localhost:8181/socket')
const connection = new WebSocket('wss://tronio.gltronic.ovh/socket')
const connection = new WebSocket('ws://localhost:8181/socket')
// const connection = new WebSocket('wss://tronio.gltronic.ovh/socket')
export default function createSocketPlugin () {
return store => {
connection.onopen = function () {
console.log('[WS] connected')
store.dispatch('game/socketConnected')
store.dispatch('game/socketConnected', true)
}
connection.onclose = function () {
console.log('[WS] closed')
store.dispatch('game/socketConnected', false)
}
connection.onerror = function (error) {
@@ -41,6 +42,9 @@ export default function createSocketPlugin () {
case 'gamePlayerDead':
store.dispatch('game/dead', data.message)
break
case 'gamePlayerSpawn':
store.dispatch('game/spawn', data.message)
break
default:
break
}