From 10de5582f12266987de3f160faaec414d0e31f40 Mon Sep 17 00:00:00 2001 From: LoveEevee Date: Thu, 11 Oct 2018 03:50:00 +0300 Subject: [PATCH] Sync dai note faces and fix multiplayer --- public/src/js/loadsong.js | 18 ++++++++++++------ public/src/js/view.js | 11 ++++++----- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/public/src/js/loadsong.js b/public/src/js/loadsong.js index 1811ba8..b90b2d1 100644 --- a/public/src/js/loadsong.js +++ b/public/src/js/loadsong.js @@ -75,14 +75,20 @@ class loadSong{ this.selectedSong2 = { title: this.selectedSong.title, 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 => { - this.song2Data = data.replace(/\0/g, "").split("\n") + if(this.selectedSong.type === "tja"){ p2.send("gamestart") - }, () => { - p2.send("gamestart") - }) + }else{ + loader.ajax(this.getSongPath(this.selectedSong2)).then(data => { + this.song2Data = data.replace(/\0/g, "").split("\n") + p2.send("gamestart") + }, () => { + p2.send("gamestart") + }) + } } }else if(event.type === "gamestart"){ this.clean() diff --git a/public/src/js/view.js b/public/src/js/view.js index 619331f..13cbb94 100644 --- a/public/src/js/view.js +++ b/public/src/js/view.js @@ -216,13 +216,14 @@ class View{ //this.drawTime() } updateDonFaces(){ - if(this.controller.getElapsedTime() >= this.nextBeat){ + var ms = this.controller.getElapsedTime() + while(ms >= this.nextBeat){ this.nextBeat += this.beatInterval if(this.controller.getCombo() >= 50){ - this.currentBigDonFace = (this.currentBigDonFace + 1) % 2 - this.currentDonFace = (this.currentDonFace + 1) % 2 - } - else{ + var face = Math.floor(ms / this.beatInterval) % 2 + this.currentBigDonFace = face + this.currentDonFace = face + }else{ this.currentBigDonFace = 1 this.currentDonFace = 0 }