Clean up classes before exiting them
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
function Tutorial() {
|
||||
var _this = this;
|
||||
|
||||
this.run = function() {
|
||||
assets.sounds["bgm_setsume"].playLoop(0.1, false, 0, 1.054, 16.054)
|
||||
|
||||
$('#tutorial-end-button').click(function(){
|
||||
assets.sounds["bgm_setsume"].stop();
|
||||
assets.sounds["don"].play();
|
||||
|
||||
localStorage.setItem('tutorial', 'true');
|
||||
new SongSelect();
|
||||
});
|
||||
};
|
||||
|
||||
$('#screen').load('/src/views/tutorial.html', _this.run);
|
||||
};
|
||||
class Tutorial{
|
||||
constructor(){
|
||||
loader.changePage("tutorial")
|
||||
assets.sounds["bgm_setsume"].playLoop(0.1, false, 0, 1.054, 16.054)
|
||||
this.endButton = document.getElementById("tutorial-end-button")
|
||||
pageEvents.once(this.endButton, "click").then(this.onEnd.bind(this))
|
||||
}
|
||||
onEnd(){
|
||||
this.clean()
|
||||
assets.sounds["don"].play()
|
||||
localStorage.setItem("tutorial", "true")
|
||||
new SongSelect()
|
||||
}
|
||||
clean(){
|
||||
assets.sounds["bgm_setsume"].stop()
|
||||
pageEvents.remove(this.endButton, "click")
|
||||
delete this.endButton
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user