From 454028a7e63cb113f741b97e02067fc0d230f616 Mon Sep 17 00:00:00 2001 From: LoveEevee Date: Tue, 16 Apr 2019 23:29:26 +0300 Subject: [PATCH] Fix tutorial not saving --- public/src/js/settings.js | 19 +++++++++---------- public/src/js/tutorial.js | 4 +++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/public/src/js/settings.js b/public/src/js/settings.js index b7ee558..35a863e 100644 --- a/public/src/js/settings.js +++ b/public/src/js/settings.js @@ -431,19 +431,15 @@ class SettingsView{ this.gamepadButtons.style.backgroundPosition = "0 " + (-318 - 132 * this.gamepadSelected) + "px" this.gamepadSettings.style.display = "block" } - gamepadBack(save){ + gamepadBack(confirm){ if(this.mode !== "gamepad"){ return } - if(save){ - var selected = this.items[this.selected] - var current = settings.items[selected.id] - settings.setItem(selected.id, current.options[this.gamepadSelected]) - this.getValue(selected.id, selected.valueDiv) - assets.sounds["se_don"].play() - }else{ - assets.sounds["se_cancel"].play() - } + var selected = this.items[this.selected] + var current = settings.items[selected.id] + settings.setItem(selected.id, current.options[this.gamepadSelected]) + this.getValue(selected.id, selected.valueDiv) + assets.sounds[confirm ? "se_don" : "se_cancel"].play() this.gamepadSettings.style.display = "" this.mode = "settings" } @@ -466,6 +462,9 @@ class SettingsView{ if(this.tutorial && !this.touched){ new Tutorial(false, this.songId) }else{ + try{ + localStorage.setItem("tutorial", "true") + }catch(e){} new SongSelect(this.tutorial ? false : "settings", false, this.touched, this.songId) } }, 500) diff --git a/public/src/js/tutorial.js b/public/src/js/tutorial.js index 711265c..2d1302c 100644 --- a/public/src/js/tutorial.js +++ b/public/src/js/tutorial.js @@ -44,7 +44,9 @@ class Tutorial{ if(pressed){ this.clean() assets.sounds["se_don"].play() - localStorage.setItem("tutorial", "true") + try{ + localStorage.setItem("tutorial", "true") + }catch(e){} setTimeout(() => { new SongSelect(this.fromSongSel ? "tutorial" : false, false, this.touched, this.songId) }, 500)