Disable checking sound timer on touch devices
This commit is contained in:
parent
c999dca204
commit
57632a83e5
@ -339,21 +339,23 @@ class Game{
|
|||||||
this.started = true
|
this.started = true
|
||||||
this.sndTime = this.startDate - snd.buffer.getTime() * 1000
|
this.sndTime = this.startDate - snd.buffer.getTime() * 1000
|
||||||
}else if(ms < 0 || ms >= 0 && this.started){
|
}else if(ms < 0 || ms >= 0 && this.started){
|
||||||
this.elapsedTime = this.getAccurateTime(ms >= 0)
|
var currentDate = +new Date
|
||||||
|
if(!this.controller.touchEnabled){
|
||||||
|
var sndTime = currentDate - snd.buffer.getTime() * 1000
|
||||||
|
var lag = sndTime - this.sndTime
|
||||||
|
if(Math.abs(lag) >= 50){
|
||||||
|
this.startDate += lag
|
||||||
|
this.sndTime = sndTime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.elapsedTime = currentDate - this.startDate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getAccurateTime(){
|
getAccurateTime(){
|
||||||
if(this.isPaused()){
|
if(this.isPaused()){
|
||||||
return this.elapsedTime
|
return this.elapsedTime
|
||||||
}else{
|
}else{
|
||||||
var currentDate = +new Date
|
return (+new Date) - this.startDate
|
||||||
var sndTime = currentDate - snd.buffer.getTime() * 1000
|
|
||||||
var lag = sndTime - this.sndTime
|
|
||||||
if(Math.abs(lag) >= 50){
|
|
||||||
this.startDate += lag
|
|
||||||
this.sndTime = sndTime
|
|
||||||
}
|
|
||||||
return currentDate - this.startDate
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getCircles(){
|
getCircles(){
|
||||||
|
Loading…
Reference in New Issue
Block a user