"use strict"
import GameCommon from './../../common/GameCommon.js'
import Upload from './../components/Upload.vue.js'
import ImageTeaser from './../components/ImageTeaser.vue.js'
export default {
name: 'new-game-dialog',
components: {
Upload,
ImageTeaser,
},
template: `
`,
props: {
images: Array,
},
emits: {
newGame: null,
},
data() {
return {
tiles: 1000,
image: '',
scoreMode: GameCommon.SCORE_MODE_ANY,
}
},
methods: {
mediaImgUploaded(j) {
this.image = j.image
},
canStartNewGame () {
if (!this.tilesInt || !this.image || ![0, 1].includes(this.scoreModeInt)) {
return false
}
return true
},
onNewGameClick() {
this.$emit('newGame', {
tiles: this.tilesInt,
image: this.image,
scoreMode: this.scoreModeInt,
})
},
},
computed: {
scoreModeInt () {
return parseInt(this.scoreMode, 10)
},
tilesInt () {
return parseInt(this.tiles, 10)
},
},
}