Fix backgrounds in multiplayer

This commit is contained in:
LoveEevee 2018-11-23 22:44:14 +03:00
parent f523700dc4
commit edd76b55a4
2 changed files with 19 additions and 4 deletions

View File

@ -26,6 +26,18 @@
} }
.portrait #songbg{ .portrait #songbg{
height: 63.4%; height: 63.4%;
max-height: calc(50% + 24vw);
}
.touchp2 #songbg{
height: calc(50% - 5.5vw);
}
.multiplayer.portrait #songbg{
height: calc(50% - 37vw);
min-height: calc(29% + 1px);
}
.multiplayer:not(.touchp2):not(.portrait) #songbg,
.multiplayer:not(.touchp2):not(.portrait) #song-stage{
display: none;
} }
.game-paused *{ .game-paused *{
animation-play-state: paused !important; animation-play-state: paused !important;

View File

@ -113,12 +113,16 @@
} }
} }
} }
if(!this.multiplayer){ if(this.multiplayer){
this.gameDiv.classList.add("multiplayer")
}else{
pageEvents.add(this.canvas, "mousedown", this.onmousedown.bind(this)) pageEvents.add(this.canvas, "mousedown", this.onmousedown.bind(this))
} }
} }
run(){ run(){
if(this.multiplayer !== 2){
this.setBackground() this.setBackground()
}
this.lastMousemove = this.controller.getElapsedTime() this.lastMousemove = this.controller.getElapsedTime()
pageEvents.mouseAdd(this, this.onmousemove.bind(this)) pageEvents.mouseAdd(this, this.onmousemove.bind(this))
@ -952,7 +956,6 @@
} }
} }
setBackground(){ setBackground(){
var gameDiv = document.getElementById("game")
var songBg = document.getElementById("songbg") var songBg = document.getElementById("songbg")
var songStage = document.getElementById("song-stage") var songStage = document.getElementById("song-stage")
@ -962,7 +965,7 @@
}else{ }else{
var catId = this.categories.default.sort var catId = this.categories.default.sort
} }
this.setBgImage(gameDiv, assets.image["bg_genre_" + catId].src) this.setBgImage(this.gameDiv, assets.image["bg_genre_" + catId].src)
if(selectedSong.customBg){ if(selectedSong.customBg){
var bg = gameConfig.songs_baseurl + selectedSong.folder + "/bg.png" var bg = gameConfig.songs_baseurl + selectedSong.folder + "/bg.png"