Do not play song sel when scrolling, fix pause menu
This commit is contained in:
parent
b053dffec1
commit
8ffcdc16ac
@ -91,7 +91,7 @@ class Keyboard{
|
|||||||
var ms = this.game.getAccurateTime()
|
var ms = this.game.getAccurateTime()
|
||||||
this.gamepadMenu.play((pressed, keyCode) => {
|
this.gamepadMenu.play((pressed, keyCode) => {
|
||||||
if(pressed){
|
if(pressed){
|
||||||
if(paused){
|
if(this.game.isPaused()){
|
||||||
if(keyCode === "cancel"){
|
if(keyCode === "cancel"){
|
||||||
return setTimeout(() => {
|
return setTimeout(() => {
|
||||||
this.controller.togglePauseMenu()
|
this.controller.togglePauseMenu()
|
||||||
@ -108,8 +108,11 @@ class Keyboard{
|
|||||||
})
|
})
|
||||||
this.checkKey(this.kbd["pause"], "menu", () => {
|
this.checkKey(this.kbd["pause"], "menu", () => {
|
||||||
this.controller.togglePauseMenu()
|
this.controller.togglePauseMenu()
|
||||||
|
for(var key in this.keyTime){
|
||||||
|
this.keys[key] = null
|
||||||
|
this.keyTime[key] = null
|
||||||
|
}
|
||||||
})
|
})
|
||||||
if(this.game.isPaused()){
|
|
||||||
var moveMenuMinus = () => {
|
var moveMenuMinus = () => {
|
||||||
moveMenu = -1
|
moveMenu = -1
|
||||||
}
|
}
|
||||||
@ -117,6 +120,7 @@ class Keyboard{
|
|||||||
moveMenu = 1
|
moveMenu = 1
|
||||||
}
|
}
|
||||||
var moveMenuConfirm = () => {
|
var moveMenuConfirm = () => {
|
||||||
|
if(this.game.isPaused()){
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
var selected = document.getElementsByClassName("selected")[0]
|
var selected = document.getElementsByClassName("selected")[0]
|
||||||
if(selected){
|
if(selected){
|
||||||
@ -127,6 +131,7 @@ class Keyboard{
|
|||||||
this.keyTime[key] = null
|
this.keyTime[key] = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.checkKey(this.kbd["previous"], "menu", moveMenuMinus)
|
this.checkKey(this.kbd["previous"], "menu", moveMenuMinus)
|
||||||
this.checkKey(this.kbd["ka_l"], "menu", moveMenuMinus)
|
this.checkKey(this.kbd["ka_l"], "menu", moveMenuMinus)
|
||||||
this.checkKey(this.kbd["next"], "menu", moveMenuPlus)
|
this.checkKey(this.kbd["next"], "menu", moveMenuPlus)
|
||||||
@ -134,8 +139,7 @@ class Keyboard{
|
|||||||
this.checkKey(this.kbd["confirm"], "menu", moveMenuConfirm)
|
this.checkKey(this.kbd["confirm"], "menu", moveMenuConfirm)
|
||||||
this.checkKey(this.kbd["don_l"], "menu", moveMenuConfirm)
|
this.checkKey(this.kbd["don_l"], "menu", moveMenuConfirm)
|
||||||
this.checkKey(this.kbd["don_r"], "menu", moveMenuConfirm)
|
this.checkKey(this.kbd["don_r"], "menu", moveMenuConfirm)
|
||||||
}
|
if(moveMenu && this.game.isPaused()){
|
||||||
if(moveMenu){
|
|
||||||
assets.sounds["ka"].play()
|
assets.sounds["ka"].play()
|
||||||
var selected = document.getElementsByClassName("selected")[0]
|
var selected = document.getElementsByClassName("selected")[0]
|
||||||
selected.classList.remove("selected")
|
selected.classList.remove("selected")
|
||||||
|
@ -74,7 +74,7 @@ class SongSelect{
|
|||||||
outline: "#656565"
|
outline: "#656565"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.font = "DFPKanTeiRyu-XB"
|
this.font = "TnT"
|
||||||
|
|
||||||
this.songs = []
|
this.songs = []
|
||||||
for(let song of assets.songs){
|
for(let song of assets.songs){
|
||||||
@ -181,11 +181,14 @@ class SongSelect{
|
|||||||
|
|
||||||
if(fromTutorial || !"selectedSong" in localStorage){
|
if(fromTutorial || !"selectedSong" in localStorage){
|
||||||
this.selectedSong = this.songs.findIndex(song => song.action === "tutorial")
|
this.selectedSong = this.songs.findIndex(song => song.action === "tutorial")
|
||||||
|
this.playBgm(true)
|
||||||
}else{
|
}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()
|
||||||
|
this.playBgm(false)
|
||||||
}
|
}
|
||||||
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)
|
||||||
@ -610,6 +613,7 @@ class SongSelect{
|
|||||||
if(elapsed < resize){
|
if(elapsed < resize){
|
||||||
selectedWidth = this.songAsset.width + (((resize - elapsed) / resize) * (selectedWidth - this.songAsset.width))
|
selectedWidth = this.songAsset.width + (((resize - elapsed) / resize) * (selectedWidth - this.songAsset.width))
|
||||||
}else if(elapsed > resize2){
|
}else if(elapsed > resize2){
|
||||||
|
this.playBgm(!this.songs[this.selectedSong].stars)
|
||||||
this.state.locked = 1
|
this.state.locked = 1
|
||||||
selectedWidth = this.songAsset.width + ((elapsed - resize2) / resize * (selectedWidth - this.songAsset.width))
|
selectedWidth = this.songAsset.width + ((elapsed - resize2) / resize * (selectedWidth - this.songAsset.width))
|
||||||
}else{
|
}else{
|
||||||
@ -1510,23 +1514,28 @@ class SongSelect{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
previewLoaded(startLoad, prvtime){
|
previewLoaded(startLoad, prvtime){
|
||||||
snd.musicGain.fadeOut(0.4)
|
|
||||||
var endLoad = this.getMS()
|
var endLoad = this.getMS()
|
||||||
var difference = endLoad - startLoad
|
var difference = endLoad - startLoad
|
||||||
var minDelay = 300
|
var minDelay = 300
|
||||||
var delay = minDelay - Math.min(minDelay, difference)
|
var delay = minDelay - Math.min(minDelay, difference)
|
||||||
this.preview.playLoop(delay / 1000, false, prvtime / 1000)
|
this.preview.playLoop(delay / 1000, false, prvtime / 1000)
|
||||||
}
|
}
|
||||||
endPreview(noFadeIn){
|
endPreview(){
|
||||||
if(!noFadeIn){
|
|
||||||
snd.musicGain.fadeIn(0.4)
|
|
||||||
}
|
|
||||||
this.previewId++
|
this.previewId++
|
||||||
this.previewing = null
|
this.previewing = null
|
||||||
if(this.preview){
|
if(this.preview){
|
||||||
this.preview.stop()
|
this.preview.stop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
playBgm(enabled){
|
||||||
|
if(enabled && !this.bgmEnabled){
|
||||||
|
this.bgmEnabled = true
|
||||||
|
snd.musicGain.fadeIn(0.4)
|
||||||
|
}else if(!enabled && this.bgmEnabled){
|
||||||
|
this.bgmEnabled = false
|
||||||
|
snd.musicGain.fadeOut(0.4)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onusers(response){
|
onusers(response){
|
||||||
this.songs.forEach(song => {
|
this.songs.forEach(song => {
|
||||||
@ -1566,10 +1575,12 @@ class SongSelect{
|
|||||||
|
|
||||||
clean(){
|
clean(){
|
||||||
assets.sounds["bgm_songsel"].stop()
|
assets.sounds["bgm_songsel"].stop()
|
||||||
|
if(!this.bgmEnabled){
|
||||||
snd.musicGain.fadeIn()
|
snd.musicGain.fadeIn()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
snd.musicGain.fadeIn()
|
snd.musicGain.fadeIn()
|
||||||
}, 500)
|
}, 500)
|
||||||
|
}
|
||||||
this.redrawRunning = false
|
this.redrawRunning = false
|
||||||
this.endPreview()
|
this.endPreview()
|
||||||
pageEvents.keyRemove(this, "all")
|
pageEvents.keyRemove(this, "all")
|
||||||
|
Loading…
Reference in New Issue
Block a user