2020-01-14 21:04:45 +00:00
|
|
|
import { compareSummonernames } from '@/helpers/functions.js'
|
|
|
|
|
import { gameModes } from '@/data/data.js'
|
|
|
|
|
import { mapState } from 'vuex'
|
|
|
|
|
|
|
|
|
|
export const liveGame = {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
gameLength: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
|
allyTeam() {
|
|
|
|
|
return this.current.participants.filter(p => p.teamId === this.teamColor)
|
|
|
|
|
},
|
|
|
|
|
enemyTeam() {
|
|
|
|
|
return this.current.participants.filter(p => p.teamId !== this.teamColor)
|
|
|
|
|
},
|
|
|
|
|
gamemode() {
|
|
|
|
|
return gameModes[this.current.gameQueueConfigId]
|
|
|
|
|
},
|
2020-01-15 20:55:22 +00:00
|
|
|
gameStartTime() {
|
|
|
|
|
return (new Date() - new Date(this.current.gameStartTime)) / 1000
|
|
|
|
|
},
|
2020-01-14 21:04:45 +00:00
|
|
|
teamColor() {
|
|
|
|
|
return this.current.participants.find(p => p.summonerId === this.account.id).teamId
|
|
|
|
|
},
|
|
|
|
|
...mapState({
|
|
|
|
|
account: state => state.summoner.basic.account,
|
|
|
|
|
current: state => state.summoner.basic.current,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
created() {
|
2020-01-15 20:55:22 +00:00
|
|
|
this.gameLength = this.current ? this.gameStartTime : 0
|
2020-01-14 21:04:45 +00:00
|
|
|
|
|
|
|
|
setInterval(() => {
|
|
|
|
|
this.gameLength++
|
|
|
|
|
}, 1000)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
compareSummonernames,
|
|
|
|
|
}
|
|
|
|
|
}
|