From d36d0135511e51b93d1c343898fa675e20b57f6f Mon Sep 17 00:00:00 2001 From: LoveEevee Date: Sat, 6 Oct 2018 18:09:57 +0300 Subject: [PATCH] Hide keyboard tutorial from mobile users --- public/src/js/songselect.js | 27 +++++++++++++++++---------- public/src/js/titlescreen.js | 6 +++--- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/public/src/js/songselect.js b/public/src/js/songselect.js index 9719648..e113b28 100644 --- a/public/src/js/songselect.js +++ b/public/src/js/songselect.js @@ -111,12 +111,16 @@ class SongSelect{ action: "random", category: "ランダム" }) - this.songs.push({ - title: "あそびかた説明", - skin: this.songSkin.tutorial, - action: "tutorial", - category: "ランダム" - }) + if(touchEnabled){ + fromTutorial = false + }else{ + this.songs.push({ + title: "あそびかた説明", + skin: this.songSkin.tutorial, + action: "tutorial", + category: "ランダム" + }) + } this.songs.push({ title: "もどる", skin: this.songSkin.back, @@ -143,16 +147,16 @@ class SongSelect{ this.selectedDiff = 0 assets.sounds["bgm_songsel"].playLoop(0.1, false, 0, 1.442, 3.506) - if(fromTutorial || !("selectedSong" in localStorage)){ - this.selectedSong = this.songs.findIndex(song => song.action === "tutorial") - this.playBgm(true) - }else{ + if(touchEnabled || !fromTutorial && "selectedSong" in localStorage){ if("selectedSong" in localStorage){ this.selectedSong = Math.min(Math.max(0, localStorage["selectedSong"] |0), this.songs.length) } assets.sounds["song-select"].play() snd.musicGain.fadeOut() this.playBgm(false) + }else{ + this.selectedSong = this.songs.findIndex(song => song.action === "tutorial") + this.playBgm(true) } if("selectedDiff" in localStorage){ this.selectedDiff = Math.min(Math.max(0, localStorage["selectedDiff"] |0), 4) @@ -324,6 +328,9 @@ class SongSelect{ } } pointer(enabled){ + if(!this.canvas){ + return + } if(enabled && this.state.hasPointer === false){ this.canvas.style.cursor = "pointer" this.state.hasPointer = true diff --git a/public/src/js/titlescreen.js b/public/src/js/titlescreen.js index 6bddd09..63cdd89 100644 --- a/public/src/js/titlescreen.js +++ b/public/src/js/titlescreen.js @@ -26,10 +26,10 @@ class Titlescreen{ setTimeout(this.goNext.bind(this), 500) } goNext(){ - if(localStorage.getItem("tutorial") !== "true"){ - new Tutorial() - }else{ + if(this.touched || localStorage.getItem("tutorial") === "true"){ new SongSelect(false, false, this.touched) + }else{ + new Tutorial() } } clean(){