View: Change pause screen

This commit is contained in:
LoveEevee
2018-11-12 13:32:02 +03:00
parent 76108d47d6
commit 89e25f237e
8 changed files with 271 additions and 123 deletions

View File

@@ -30,7 +30,6 @@ class Controller{
this.playedSounds = {}
}
run(syncWith){
this.loadUIEvents()
this.game.run()
this.view.run()
this.startMainLoop()
@@ -47,22 +46,6 @@ class Controller{
}
}
}
loadUIEvents(){
this.pauseMenu = document.getElementById("pause-menu")
this.continueBtn = document.getElementById("continue-butt")
this.restartBtn = document.getElementById("restart-butt")
this.songSelBtn = document.getElementById("song-selection-butt")
pageEvents.add(this.pauseMenu, "touchstart", event => event.preventDefault())
pageEvents.add(this.continueBtn, ["click", "touchend"], this.togglePauseMenu.bind(this))
pageEvents.add(this.restartBtn, ["click", "touchend"], () => {
assets.sounds["don"].play()
this.restartSong()
})
pageEvents.add(this.songSelBtn, ["click", "touchend"], () => {
assets.sounds["don"].play()
this.songSelection()
})
}
startMainLoop(){
this.mainLoopStarted = false
this.mainLoopRunning = true
@@ -115,15 +98,11 @@ class Controller{
}
this.game.playMainMusic()
}
this.view.refresh()
}
this.view.refresh()
this.keyboard.checkMenuKeys()
}
}
togglePauseMenu(){
this.togglePause()
this.view.togglePauseMenu()
}
gameEnded(){
var score = this.getGlobalScore()
var vp
@@ -231,15 +210,6 @@ class Controller{
this.keyboard.clean()
this.view.clean()
pageEvents.remove(this.pauseMenu, "touchstart")
delete this.pauseMenu
pageEvents.remove(this.continueBtn, ["click", "touchend"])
delete this.continueBtn
pageEvents.remove(this.restartBtn, ["click", "touchend"])
delete this.restartBtn
pageEvents.remove(this.songSelBtn, ["click", "touchend"])
delete this.songSelBtn
if(!this.multiplayer){
debugObj.controller = null
if(debugObj.debug){