From 911841af9517fae10990059f607914be053e2f02 Mon Sep 17 00:00:00 2001 From: KatieFrogs <23621460+KatieFrogs@users.noreply.github.com> Date: Fri, 18 Feb 2022 00:06:50 +0300 Subject: [PATCH] Fix tutorial --- public/src/js/tutorial.js | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/public/src/js/tutorial.js b/public/src/js/tutorial.js index 935f298..73c5d5e 100644 --- a/public/src/js/tutorial.js +++ b/public/src/js/tutorial.js @@ -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)