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