Hide keyboard tutorial from mobile users

This commit is contained in:
LoveEevee 2018-10-06 18:09:57 +03:00
parent 386b8905ac
commit d36d013551
2 changed files with 20 additions and 13 deletions

View File

@ -111,12 +111,16 @@ class SongSelect{
action: "random", action: "random",
category: "ランダム" category: "ランダム"
}) })
if(touchEnabled){
fromTutorial = false
}else{
this.songs.push({ this.songs.push({
title: "あそびかた説明", title: "あそびかた説明",
skin: this.songSkin.tutorial, skin: this.songSkin.tutorial,
action: "tutorial", action: "tutorial",
category: "ランダム" category: "ランダム"
}) })
}
this.songs.push({ this.songs.push({
title: "もどる", title: "もどる",
skin: this.songSkin.back, skin: this.songSkin.back,
@ -143,16 +147,16 @@ class SongSelect{
this.selectedDiff = 0 this.selectedDiff = 0
assets.sounds["bgm_songsel"].playLoop(0.1, false, 0, 1.442, 3.506) assets.sounds["bgm_songsel"].playLoop(0.1, false, 0, 1.442, 3.506)
if(fromTutorial || !("selectedSong" in localStorage)){ if(touchEnabled || !fromTutorial && "selectedSong" in localStorage){
this.selectedSong = this.songs.findIndex(song => song.action === "tutorial")
this.playBgm(true)
}else{
if("selectedSong" in localStorage){ if("selectedSong" in localStorage){
this.selectedSong = Math.min(Math.max(0, localStorage["selectedSong"] |0), this.songs.length) this.selectedSong = Math.min(Math.max(0, localStorage["selectedSong"] |0), this.songs.length)
} }
assets.sounds["song-select"].play() assets.sounds["song-select"].play()
snd.musicGain.fadeOut() snd.musicGain.fadeOut()
this.playBgm(false) this.playBgm(false)
}else{
this.selectedSong = this.songs.findIndex(song => song.action === "tutorial")
this.playBgm(true)
} }
if("selectedDiff" in localStorage){ if("selectedDiff" in localStorage){
this.selectedDiff = Math.min(Math.max(0, localStorage["selectedDiff"] |0), 4) this.selectedDiff = Math.min(Math.max(0, localStorage["selectedDiff"] |0), 4)
@ -324,6 +328,9 @@ class SongSelect{
} }
} }
pointer(enabled){ pointer(enabled){
if(!this.canvas){
return
}
if(enabled && this.state.hasPointer === false){ if(enabled && this.state.hasPointer === false){
this.canvas.style.cursor = "pointer" this.canvas.style.cursor = "pointer"
this.state.hasPointer = true this.state.hasPointer = true

View File

@ -26,10 +26,10 @@ class Titlescreen{
setTimeout(this.goNext.bind(this), 500) setTimeout(this.goNext.bind(this), 500)
} }
goNext(){ goNext(){
if(localStorage.getItem("tutorial") !== "true"){ if(this.touched || localStorage.getItem("tutorial") === "true"){
new Tutorial()
}else{
new SongSelect(false, false, this.touched) new SongSelect(false, false, this.touched)
}else{
new Tutorial()
} }
} }
clean(){ clean(){