Sync dai note faces and fix multiplayer

This commit is contained in:
LoveEevee 2018-10-11 03:50:00 +03:00
parent fc0e951491
commit 10de5582f1
2 changed files with 18 additions and 11 deletions

View File

@ -75,15 +75,21 @@ class loadSong{
this.selectedSong2 = { this.selectedSong2 = {
title: this.selectedSong.title, title: this.selectedSong.title,
folder: this.selectedSong.folder, folder: this.selectedSong.folder,
difficulty: event.value difficulty: event.value,
type: this.selectedSong.type,
offset: this.selectedSong.offset
} }
loader.ajax(this.getOsuPath(this.selectedSong2)).then(data => { if(this.selectedSong.type === "tja"){
p2.send("gamestart")
}else{
loader.ajax(this.getSongPath(this.selectedSong2)).then(data => {
this.song2Data = data.replace(/\0/g, "").split("\n") this.song2Data = data.replace(/\0/g, "").split("\n")
p2.send("gamestart") p2.send("gamestart")
}, () => { }, () => {
p2.send("gamestart") p2.send("gamestart")
}) })
} }
}
}else if(event.type === "gamestart"){ }else if(event.type === "gamestart"){
this.clean() this.clean()
loader.changePage("game") loader.changePage("game")

View File

@ -216,13 +216,14 @@ class View{
//this.drawTime() //this.drawTime()
} }
updateDonFaces(){ updateDonFaces(){
if(this.controller.getElapsedTime() >= this.nextBeat){ var ms = this.controller.getElapsedTime()
while(ms >= this.nextBeat){
this.nextBeat += this.beatInterval this.nextBeat += this.beatInterval
if(this.controller.getCombo() >= 50){ if(this.controller.getCombo() >= 50){
this.currentBigDonFace = (this.currentBigDonFace + 1) % 2 var face = Math.floor(ms / this.beatInterval) % 2
this.currentDonFace = (this.currentDonFace + 1) % 2 this.currentBigDonFace = face
} this.currentDonFace = face
else{ }else{
this.currentBigDonFace = 1 this.currentBigDonFace = 1
this.currentDonFace = 0 this.currentDonFace = 0
} }