restart
This commit is contained in:
parent
47bbc83788
commit
3e13e77d26
30
app.js
30
app.js
@ -123,7 +123,6 @@ class MinoesTable {
|
|||||||
this.table = document.getElementById(id)
|
this.table = document.getElementById(id)
|
||||||
this.rows = this.table.rows.length
|
this.rows = this.table.rows.length
|
||||||
this.columns = this.table.rows[0].childElementCount
|
this.columns = this.table.rows[0].childElementCount
|
||||||
this.init()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
@ -166,7 +165,6 @@ MinoesTable.prototype.init_center = [2, 2]
|
|||||||
class NextQueue extends MinoesTable {
|
class NextQueue extends MinoesTable {
|
||||||
constructor() {
|
constructor() {
|
||||||
super("nextTable")
|
super("nextTable")
|
||||||
this.init()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
@ -205,6 +203,7 @@ class Matrix extends MinoesTable {
|
|||||||
init() {
|
init() {
|
||||||
super.init()
|
super.init()
|
||||||
this.blocks = Array(this.rows).fill().map(() => Array(this.columns))
|
this.blocks = Array(this.rows).fill().map(() => Array(this.columns))
|
||||||
|
this.redraw()
|
||||||
}
|
}
|
||||||
|
|
||||||
cellIsEmpty(position) {
|
cellIsEmpty(position) {
|
||||||
@ -446,7 +445,6 @@ class Settings {
|
|||||||
settingsModal.addEventListener('shown.bs.modal', () => {
|
settingsModal.addEventListener('shown.bs.modal', () => {
|
||||||
resumeButton.focus()
|
resumeButton.focus()
|
||||||
})
|
})
|
||||||
this.init()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
load() {
|
load() {
|
||||||
@ -519,7 +517,6 @@ class Stats {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.modal = new bootstrap.Modal('#statsModal')
|
this.modal = new bootstrap.Modal('#statsModal')
|
||||||
this.load()
|
this.load()
|
||||||
this.init()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
load() {
|
load() {
|
||||||
@ -527,7 +524,7 @@ class Stats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
levelInput.value = localStorage["startLevel"]
|
levelInput.value = localStorage["startLevel"] || 1
|
||||||
this.score = 0
|
this.score = 0
|
||||||
this.goal = 0
|
this.goal = 0
|
||||||
this.combo = 0
|
this.combo = 0
|
||||||
@ -728,6 +725,18 @@ let nextQueue = new NextQueue()
|
|||||||
let playing = false
|
let playing = false
|
||||||
let favicon = document.querySelector("link[rel~='icon']")
|
let favicon = document.querySelector("link[rel~='icon']")
|
||||||
|
|
||||||
|
function restart() {
|
||||||
|
stats.modal.hide()
|
||||||
|
holdQueue.init()
|
||||||
|
stats.init()
|
||||||
|
matrix.init()
|
||||||
|
nextQueue.init()
|
||||||
|
settings.init()
|
||||||
|
pauseSettings()
|
||||||
|
}
|
||||||
|
|
||||||
|
restart()
|
||||||
|
|
||||||
function pauseSettings() {
|
function pauseSettings() {
|
||||||
scheduler.clearInterval(fall)
|
scheduler.clearInterval(fall)
|
||||||
scheduler.clearTimeout(lockDown)
|
scheduler.clearTimeout(lockDown)
|
||||||
@ -925,17 +934,6 @@ function gameOver() {
|
|||||||
stats.show()
|
stats.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
function restart() {
|
|
||||||
stats.modal.hide()
|
|
||||||
holdQueue.init()
|
|
||||||
stats.init()
|
|
||||||
matrix.init()
|
|
||||||
matrix.redraw()
|
|
||||||
nextQueue.init()
|
|
||||||
settings.init()
|
|
||||||
pauseSettings()
|
|
||||||
}
|
|
||||||
|
|
||||||
window.onbeforeunload = function(event) {
|
window.onbeforeunload = function(event) {
|
||||||
stats.save()
|
stats.save()
|
||||||
settings.save()
|
settings.save()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user