Fix tutorial

This commit is contained in:
KatieFrogs 2022-02-18 00:06:50 +03:00
parent 0655b79293
commit 911841af95

View File

@ -20,7 +20,6 @@ class Tutorial{
this.setStrings()
pageEvents.add(this.endButton, ["mousedown", "touchstart"], this.onEnd.bind(this))
pageEvents.add(this.formButton, ["mousedown", "touchstart"], this.linkButton.bind(this))
this.keyboard = new Keyboard({
confirm: ["enter", "space", "don_l", "don_r"],
previous: ["left", "up", "ka_l"],
@ -52,10 +51,12 @@ class Tutorial{
assets.sounds["se_don"].play()
}
}else if(name === "previous" || name === "next"){
selected.classList.remove("selected")
this.selected = this.mod(this.items.length, this.selected + (name === "next" ? 1 : -1))
this.items[this.selected].classList.add("selected")
assets.sounds["se_ka"].play()
if(this.items.length >= 2){
selected.classList.remove("selected")
this.selected = this.mod(this.items.length, this.selected + (name === "next" ? 1 : -1))
this.items[this.selected].classList.add("selected")
assets.sounds["se_ka"].play()
}
}else if(name === "back"){
this.onEnd()
}
@ -119,18 +120,6 @@ class Tutorial{
parent.appendChild(kbd)
}
}
onEnd(pressed, name){
if(pressed){
this.clean()
assets.sounds["se_don"].play()
try{
localStorage.setItem("tutorial", "true")
}catch(e){}
setTimeout(() => {
new SongSelect(this.fromSongSel ? "tutorial" : false, false, this.touched, this.songId)
}, 500)
}
}
setStrings(){
this.tutorialTitle.innerText = strings.howToPlay
this.tutorialTitle.setAttribute("alt", strings.howToPlay)