animate all turns that have happened since last game state
This commit is contained in:
parent
71b7f0b2b4
commit
5940be499e
@ -77,21 +77,24 @@ function registerEvents(store) {
|
||||
|
||||
if (game && currentGame) {
|
||||
if (game.resolutions.length !== currentGame.resolutions.length) {
|
||||
// stop fetching the game state til animations are done
|
||||
store.dispatch(actions.setAnimating(true));
|
||||
store.dispatch(actions.setGameSkillInfo(null));
|
||||
// stop fetching the game state til animations are done
|
||||
const newRes = game.resolutions[game.resolutions.length - 1];
|
||||
return eachSeries(newRes, (r, cb) => {
|
||||
|
||||
const newTurns = game.resolutions.slice(currentGame.resolutions.length);
|
||||
return eachSeries(newTurns, (turn, turnCb) => {
|
||||
return eachSeries(turn, (r, cb) => {
|
||||
if (r.delay === 0) return cb(); // TargetKo etc
|
||||
setAnimations(r, store);
|
||||
return setTimeout(cb, r.delay);
|
||||
}, turnCb);
|
||||
}, err => {
|
||||
if (err) return console.error(err);
|
||||
clearAnimations(store);
|
||||
// set the game state so resolutions don't fire twice
|
||||
store.dispatch(actions.setGame(game));
|
||||
ws.sendGameState(game.id);
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user