Added leaderboard, music & respawn screen
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user