2018-09-18 06:37:59 +08:00
|
|
|
class Tutorial{
|
2018-09-27 02:30:57 +08:00
|
|
|
constructor(fromSongSel){
|
|
|
|
this.fromSongSel = fromSongSel
|
2018-09-18 06:37:59 +08:00
|
|
|
loader.changePage("tutorial")
|
|
|
|
assets.sounds["bgm_setsume"].playLoop(0.1, false, 0, 1.054, 16.054)
|
|
|
|
this.endButton = document.getElementById("tutorial-end-button")
|
|
|
|
pageEvents.once(this.endButton, "click").then(this.onEnd.bind(this))
|
2018-09-27 02:30:57 +08:00
|
|
|
pageEvents.keyOnce(this, 13, "down").then(this.onEnd.bind(this))
|
|
|
|
this.gamepad = new Gamepad({
|
|
|
|
"confirm": ["start", "b"]
|
|
|
|
}, this.onEnd.bind(this))
|
2018-09-18 06:37:59 +08:00
|
|
|
}
|
|
|
|
onEnd(){
|
|
|
|
this.clean()
|
|
|
|
assets.sounds["don"].play()
|
|
|
|
localStorage.setItem("tutorial", "true")
|
2018-09-27 02:30:57 +08:00
|
|
|
setTimeout(() => {
|
|
|
|
new SongSelect(this.fromSongSel)
|
|
|
|
}, 500)
|
2018-09-18 06:37:59 +08:00
|
|
|
}
|
|
|
|
clean(){
|
2018-09-27 02:30:57 +08:00
|
|
|
this.gamepad.clean()
|
2018-09-18 06:37:59 +08:00
|
|
|
assets.sounds["bgm_setsume"].stop()
|
|
|
|
pageEvents.remove(this.endButton, "click")
|
2018-09-27 02:30:57 +08:00
|
|
|
pageEvents.keyRemove(this, 13)
|
2018-09-18 06:37:59 +08:00
|
|
|
delete this.endButton
|
|
|
|
}
|
|
|
|
}
|