timing sync fixes, block timer during animation, remove timeout for POST_ONLY

This commit is contained in:
Mashy
2019-10-08 13:35:39 +10:00
parent 38bd94875d
commit e93b56541f
6 changed files with 49 additions and 26 deletions
+5 -2
View File
@@ -10,11 +10,13 @@ const GameCtrlTopButtons = require('./game.ctrl.btns.top');
const addState = connect(
function receiveState(state) {
const {
animating,
game,
account,
} = state;
return {
animating,
game,
account,
};
@@ -23,6 +25,7 @@ const addState = connect(
function Controls(args) {
const {
animating,
account,
game,
} = args;
@@ -31,10 +34,10 @@ function Controls(args) {
const opponent = game.players.find(t => t.id !== account.id);
const player = game.players.find(t => t.id === account.id);
const zero = Date.parse(game.phase_start);
const now = Date.now();
const now = animating ? zero : Date.now();
const end = Date.parse(game.phase_end);
const timerPct = game.phase_end
? ((now - zero) / (end - zero) * 100)
: 100;