mirror of
https://github.com/jiojciojsioe3/a3cjroijsiojiorj.git
synced 2024-11-15 15:31:51 +08:00
SongSelect: Session sound effects play in appropriate sound channels
This commit is contained in:
parent
33b9b206a7
commit
a25e108a4b
@ -87,11 +87,7 @@ var assets = {
|
|||||||
"settings_gamepad.png"
|
"settings_gamepad.png"
|
||||||
],
|
],
|
||||||
"audioSfx": [
|
"audioSfx": [
|
||||||
"se_cancel.wav",
|
|
||||||
"se_don.wav",
|
|
||||||
"se_ka.wav",
|
|
||||||
"se_pause.wav",
|
"se_pause.wav",
|
||||||
"se_jump.wav",
|
|
||||||
"se_calibration.wav",
|
"se_calibration.wav",
|
||||||
|
|
||||||
"v_results.wav",
|
"v_results.wav",
|
||||||
@ -103,6 +99,10 @@ var assets = {
|
|||||||
"audioSfxLR": [
|
"audioSfxLR": [
|
||||||
"neiro_1_don.wav",
|
"neiro_1_don.wav",
|
||||||
"neiro_1_ka.wav",
|
"neiro_1_ka.wav",
|
||||||
|
"se_cancel.wav",
|
||||||
|
"se_don.wav",
|
||||||
|
"se_ka.wav",
|
||||||
|
"se_jump.wav",
|
||||||
|
|
||||||
"se_balloon.wav",
|
"se_balloon.wav",
|
||||||
"se_gameclear.wav",
|
"se_gameclear.wav",
|
||||||
|
@ -6,7 +6,11 @@ class Controller{
|
|||||||
this.saveScore = !autoPlayEnabled
|
this.saveScore = !autoPlayEnabled
|
||||||
this.multiplayer = multiplayer
|
this.multiplayer = multiplayer
|
||||||
this.touchEnabled = touchEnabled
|
this.touchEnabled = touchEnabled
|
||||||
this.snd = this.multiplayer ? "_p" + this.multiplayer : ""
|
if(multiplayer === 2){
|
||||||
|
this.snd = p2.player === 2 ? "_p1" : "_p2"
|
||||||
|
}else{
|
||||||
|
this.snd = multiplayer ? "_p" + p2.player : ""
|
||||||
|
}
|
||||||
|
|
||||||
this.calibrationMode = selectedSong.folder === "calibration"
|
this.calibrationMode = selectedSong.folder === "calibration"
|
||||||
this.audioLatency = 0
|
this.audioLatency = 0
|
||||||
|
@ -497,7 +497,7 @@ class SongSelect{
|
|||||||
window.open(this.songs[this.selectedSong].maker.url)
|
window.open(this.songs[this.selectedSong].maker.url)
|
||||||
}else if(moveBy === this.diffOptions.length + 4){
|
}else if(moveBy === this.diffOptions.length + 4){
|
||||||
this.state.ura = !this.state.ura
|
this.state.ura = !this.state.ura
|
||||||
this.playSound("se_ka")
|
this.playSound("se_ka", 0, p2.session ? p2.player : false)
|
||||||
if(this.selectedDiff === this.diffOptions.length + 4 && !this.state.ura){
|
if(this.selectedDiff === this.diffOptions.length + 4 && !this.state.ura){
|
||||||
this.state.move = -1
|
this.state.move = -1
|
||||||
}
|
}
|
||||||
@ -639,9 +639,10 @@ class SongSelect{
|
|||||||
var scroll = resize2 - resize - scrollDelay * 2
|
var scroll = resize2 - resize - scrollDelay * 2
|
||||||
|
|
||||||
var soundsDelay = Math.abs((scroll + resize) / moveBy)
|
var soundsDelay = Math.abs((scroll + resize) / moveBy)
|
||||||
|
this.lastMoveBy = fromP2 ? fromP2.player : false
|
||||||
|
|
||||||
for(var i = 0; i < Math.abs(moveBy) - 1; i++){
|
for(var i = 0; i < Math.abs(moveBy) - 1; i++){
|
||||||
this.playSound("se_ka", (resize + i * soundsDelay) / 1000)
|
this.playSound("se_ka", (resize + i * soundsDelay) / 1000, fromP2 ? fromP2.player : false)
|
||||||
}
|
}
|
||||||
this.pointer(false)
|
this.pointer(false)
|
||||||
}
|
}
|
||||||
@ -663,7 +664,7 @@ class SongSelect{
|
|||||||
this.state.locked = 1
|
this.state.locked = 1
|
||||||
|
|
||||||
this.endPreview()
|
this.endPreview()
|
||||||
this.playSound("se_jump")
|
this.playSound("se_jump", 0, fromP2 ? fromP2.player : false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -672,7 +673,7 @@ class SongSelect{
|
|||||||
this.state.move = moveBy
|
this.state.move = moveBy
|
||||||
this.state.moveMS = this.getMS() - 500
|
this.state.moveMS = this.getMS() - 500
|
||||||
this.state.locked = 1
|
this.state.locked = 1
|
||||||
this.playSound("se_ka")
|
this.playSound("se_ka", 0, p2.session ? p2.player : false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,7 +704,7 @@ class SongSelect{
|
|||||||
this.selectedDiff = this.diffOptions.length + 3
|
this.selectedDiff = this.diffOptions.length + 3
|
||||||
}
|
}
|
||||||
|
|
||||||
this.playSound("se_don")
|
this.playSound("se_don", 0, fromP2 ? fromP2.player : false)
|
||||||
assets.sounds["v_songsel"].stop()
|
assets.sounds["v_songsel"].stop()
|
||||||
this.playSound("v_diffsel", 0.3)
|
this.playSound("v_diffsel", 0.3)
|
||||||
pageEvents.send("song-select-difficulty", currentSong)
|
pageEvents.send("song-select-difficulty", currentSong)
|
||||||
@ -711,14 +712,14 @@ class SongSelect{
|
|||||||
this.clean()
|
this.clean()
|
||||||
this.toTitleScreen()
|
this.toTitleScreen()
|
||||||
}else if(currentSong.action === "random"){
|
}else if(currentSong.action === "random"){
|
||||||
this.playSound("se_don")
|
this.playSound("se_don", 0, fromP2 ? fromP2.player : false)
|
||||||
this.state.locked = true
|
this.state.locked = true
|
||||||
do{
|
do{
|
||||||
var i = Math.floor(Math.random() * this.songs.length)
|
var i = Math.floor(Math.random() * this.songs.length)
|
||||||
}while(!this.songs[i].courses)
|
}while(!this.songs[i].courses)
|
||||||
var moveBy = i - this.selectedSong
|
var moveBy = i - this.selectedSong
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.moveToSong(moveBy)
|
this.moveToSong(moveBy, fromP2)
|
||||||
}, 200)
|
}, 200)
|
||||||
pageEvents.send("song-select-random")
|
pageEvents.send("song-select-random")
|
||||||
}else if(currentSong.action === "tutorial"){
|
}else if(currentSong.action === "tutorial"){
|
||||||
@ -748,7 +749,7 @@ class SongSelect{
|
|||||||
this.state.moveHover = null
|
this.state.moveHover = null
|
||||||
|
|
||||||
assets.sounds["v_diffsel"].stop()
|
assets.sounds["v_diffsel"].stop()
|
||||||
this.playSound("se_cancel")
|
this.playSound("se_cancel", 0, fromP2 ? fromP2.player : false)
|
||||||
}
|
}
|
||||||
this.clearHash()
|
this.clearHash()
|
||||||
pageEvents.send("song-select-back")
|
pageEvents.send("song-select-back")
|
||||||
@ -757,7 +758,7 @@ class SongSelect{
|
|||||||
this.clean()
|
this.clean()
|
||||||
var selectedSong = this.songs[this.selectedSong]
|
var selectedSong = this.songs[this.selectedSong]
|
||||||
assets.sounds["v_diffsel"].stop()
|
assets.sounds["v_diffsel"].stop()
|
||||||
this.playSound("se_don")
|
this.playSound("se_don", 0, p2.session ? p2.player : false)
|
||||||
|
|
||||||
try{
|
try{
|
||||||
if(assets.customSongs){
|
if(assets.customSongs){
|
||||||
@ -799,7 +800,7 @@ class SongSelect{
|
|||||||
}
|
}
|
||||||
toOptions(moveBy){
|
toOptions(moveBy){
|
||||||
if(!p2.session){
|
if(!p2.session){
|
||||||
this.playSound("se_ka")
|
this.playSound("se_ka", 0, p2.session ? p2.player : false)
|
||||||
this.selectedDiff = 1
|
this.selectedDiff = 1
|
||||||
do{
|
do{
|
||||||
this.state.options = this.mod(this.optionsList.length, this.state.options + moveBy)
|
this.state.options = this.mod(this.optionsList.length, this.state.options + moveBy)
|
||||||
@ -848,6 +849,7 @@ class SongSelect{
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if(p2.session){
|
if(p2.session){
|
||||||
|
this.playSound("se_don")
|
||||||
p2.send("gameend")
|
p2.send("gameend")
|
||||||
this.state.moveHover = null
|
this.state.moveHover = null
|
||||||
}else{
|
}else{
|
||||||
@ -1045,7 +1047,7 @@ class SongSelect{
|
|||||||
var previousSelectedSong = this.selectedSong
|
var previousSelectedSong = this.selectedSong
|
||||||
|
|
||||||
if(!isJump){
|
if(!isJump){
|
||||||
this.playSound("se_ka")
|
this.playSound("se_ka", 0, this.lastMoveBy)
|
||||||
this.selectedSong = this.mod(this.songs.length, this.selectedSong + this.state.move)
|
this.selectedSong = this.mod(this.songs.length, this.selectedSong + this.state.move)
|
||||||
}else{
|
}else{
|
||||||
var currentCat = this.songs[this.selectedSong].category
|
var currentCat = this.songs[this.selectedSong].category
|
||||||
@ -2442,7 +2444,7 @@ class SongSelect{
|
|||||||
this.selectedSong = index
|
this.selectedSong = index
|
||||||
this.state.move = 0
|
this.state.move = 0
|
||||||
if(this.state.screen !== "difficulty"){
|
if(this.state.screen !== "difficulty"){
|
||||||
this.toSelectDifficulty(true)
|
this.toSelectDifficulty({player: response.value.player})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2463,7 +2465,7 @@ class SongSelect{
|
|||||||
var moveBy = response.value.move
|
var moveBy = response.value.move
|
||||||
if(moveBy === -1 || moveBy === 1){
|
if(moveBy === -1 || moveBy === 1){
|
||||||
this.selectedSong = song
|
this.selectedSong = song
|
||||||
this.categoryJump(moveBy, true)
|
this.categoryJump(moveBy, {player: response.value.player})
|
||||||
}
|
}
|
||||||
}else if(!selected){
|
}else if(!selected){
|
||||||
this.state.locked = true
|
this.state.locked = true
|
||||||
@ -2480,13 +2482,13 @@ class SongSelect{
|
|||||||
if(Math.abs(altMoveBy) < Math.abs(moveBy)){
|
if(Math.abs(altMoveBy) < Math.abs(moveBy)){
|
||||||
moveBy = altMoveBy
|
moveBy = altMoveBy
|
||||||
}
|
}
|
||||||
this.moveToSong(moveBy, true)
|
this.moveToSong(moveBy, {player: response.value.player})
|
||||||
}
|
}
|
||||||
}else if(this.songs[song].courses){
|
}else if(this.songs[song].courses){
|
||||||
this.selectedSong = song
|
this.selectedSong = song
|
||||||
this.state.move = 0
|
this.state.move = 0
|
||||||
if(this.state.screen !== "difficulty"){
|
if(this.state.screen !== "difficulty"){
|
||||||
this.toSelectDifficulty(true)
|
this.toSelectDifficulty({player: response.value.player})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2543,13 +2545,13 @@ class SongSelect{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
playSound(id, time){
|
playSound(id, time, snd){
|
||||||
if(!this.drumSounds && (id === "se_don" || id === "se_ka" || id === "se_cancel")){
|
if(!this.drumSounds && (id === "se_don" || id === "se_ka" || id === "se_cancel")){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var ms = Date.now() + (time || 0) * 1000
|
var ms = Date.now() + (time || 0) * 1000
|
||||||
if(!(id in this.playedSounds) || ms > this.playedSounds[id] + 30){
|
if(!(id in this.playedSounds) || ms > this.playedSounds[id] + 30){
|
||||||
assets.sounds[id].play(time)
|
assets.sounds[id + (snd ? "_p" + snd : "")].play(time)
|
||||||
this.playedSounds[id] = ms
|
this.playedSounds[id] = ms
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,8 @@ async def connection(ws, path):
|
|||||||
user["action"] = "loading"
|
user["action"] = "loading"
|
||||||
user["other_user"]["action"] = "loading"
|
user["other_user"]["action"] = "loading"
|
||||||
user["other_user"]["other_user"] = user
|
user["other_user"]["other_user"] = user
|
||||||
|
user["other_user"]["player"] = 1
|
||||||
|
user["player"] = 2
|
||||||
await asyncio.wait([
|
await asyncio.wait([
|
||||||
ws.send(msgobj("gameload", {"diff": waiting_diff, "player": 2})),
|
ws.send(msgobj("gameload", {"diff": waiting_diff, "player": 2})),
|
||||||
user["other_user"]["ws"].send(msgobj("gameload", {"diff": diff, "player": 1})),
|
user["other_user"]["ws"].send(msgobj("gameload", {"diff": diff, "player": 1})),
|
||||||
@ -138,6 +140,8 @@ async def connection(ws, path):
|
|||||||
user["other_user"]["other_user"] = user
|
user["other_user"]["other_user"] = user
|
||||||
user["action"] = "invite"
|
user["action"] = "invite"
|
||||||
user["session"] = value["id"]
|
user["session"] = value["id"]
|
||||||
|
user["other_user"]["player"] = 1
|
||||||
|
user["player"] = 2
|
||||||
await asyncio.wait([
|
await asyncio.wait([
|
||||||
ws.send(msgobj("session", {"player": 2})),
|
ws.send(msgobj("session", {"player": 2})),
|
||||||
user["other_user"]["ws"].send(msgobj("session", {"player": 1})),
|
user["other_user"]["ws"].send(msgobj("session", {"player": 1})),
|
||||||
@ -273,6 +277,7 @@ async def connection(ws, path):
|
|||||||
if type == "songsel" or type == "catjump":
|
if type == "songsel" or type == "catjump":
|
||||||
# Change song select position
|
# Change song select position
|
||||||
if user["other_user"]["action"] == "songsel":
|
if user["other_user"]["action"] == "songsel":
|
||||||
|
value["player"] = user["player"]
|
||||||
sent_msg = msgobj(type, value)
|
sent_msg = msgobj(type, value)
|
||||||
await asyncio.wait([
|
await asyncio.wait([
|
||||||
ws.send(sent_msg),
|
ws.send(sent_msg),
|
||||||
|
Loading…
Reference in New Issue
Block a user