Fix tutorial not saving

This commit is contained in:
LoveEevee 2019-04-16 23:29:26 +03:00
parent f5d4c6bce5
commit 454028a7e6
2 changed files with 12 additions and 11 deletions

View File

@ -431,19 +431,15 @@ class SettingsView{
this.gamepadButtons.style.backgroundPosition = "0 " + (-318 - 132 * this.gamepadSelected) + "px" this.gamepadButtons.style.backgroundPosition = "0 " + (-318 - 132 * this.gamepadSelected) + "px"
this.gamepadSettings.style.display = "block" this.gamepadSettings.style.display = "block"
} }
gamepadBack(save){ gamepadBack(confirm){
if(this.mode !== "gamepad"){ if(this.mode !== "gamepad"){
return return
} }
if(save){ var selected = this.items[this.selected]
var selected = this.items[this.selected] var current = settings.items[selected.id]
var current = settings.items[selected.id] settings.setItem(selected.id, current.options[this.gamepadSelected])
settings.setItem(selected.id, current.options[this.gamepadSelected]) this.getValue(selected.id, selected.valueDiv)
this.getValue(selected.id, selected.valueDiv) assets.sounds[confirm ? "se_don" : "se_cancel"].play()
assets.sounds["se_don"].play()
}else{
assets.sounds["se_cancel"].play()
}
this.gamepadSettings.style.display = "" this.gamepadSettings.style.display = ""
this.mode = "settings" this.mode = "settings"
} }
@ -466,6 +462,9 @@ class SettingsView{
if(this.tutorial && !this.touched){ if(this.tutorial && !this.touched){
new Tutorial(false, this.songId) new Tutorial(false, this.songId)
}else{ }else{
try{
localStorage.setItem("tutorial", "true")
}catch(e){}
new SongSelect(this.tutorial ? false : "settings", false, this.touched, this.songId) new SongSelect(this.tutorial ? false : "settings", false, this.touched, this.songId)
} }
}, 500) }, 500)

View File

@ -44,7 +44,9 @@ class Tutorial{
if(pressed){ if(pressed){
this.clean() this.clean()
assets.sounds["se_don"].play() assets.sounds["se_don"].play()
localStorage.setItem("tutorial", "true") try{
localStorage.setItem("tutorial", "true")
}catch(e){}
setTimeout(() => { setTimeout(() => {
new SongSelect(this.fromSongSel ? "tutorial" : false, false, this.touched, this.songId) new SongSelect(this.fromSongSel ? "tutorial" : false, false, this.touched, this.songId)
}, 500) }, 500)