diff --git a/client/src/actions.jsx b/client/src/actions.jsx index 994e2f65..deffd2ec 100644 --- a/client/src/actions.jsx +++ b/client/src/actions.jsx @@ -7,6 +7,9 @@ export const setCryps = value => ({ type: SET_CRYPS, value }); export const SET_VBOX_INFO = 'SET_VBOX_INFO'; export const setVboxInfo = value => ({ type: SET_VBOX_INFO, value }); +export const SET_SKIP = 'SET_SKIP'; +export const setSkip = value => ({ type: SET_SKIP, value }); + export const SET_VBOX_HIGHLIGHT = 'SET_VBOX_HIGHLIGHT'; export const setVboxHighlight = value => ({ type: SET_VBOX_HIGHLIGHT, value }); diff --git a/client/src/components/game.component.jsx b/client/src/components/game.component.jsx index 78a3a03c..b9151889 100644 --- a/client/src/components/game.component.jsx +++ b/client/src/components/game.component.jsx @@ -15,6 +15,7 @@ function GamePanel(props) { sendGameReady, showLog, toggleLog, + skip, quit, } = props; @@ -41,17 +42,29 @@ function GamePanel(props) { // ); // } - function backClick() { - if (game.phase === 'Finish') sendInstanceState(game.instance); - return quit(); + function actionClick() { + if (game.phase === 'Finish') { + sendInstanceState(game.instance); + quit(); + } + + if (resolution) { + return skip(); + } + + return sendGameReady(); } + let actionText = 'Ready'; + if (game.phase === 'Finish') actionText = 'Done'; + if (resolution) actionText = 'Skip'; + const header = (
); diff --git a/client/src/components/game.container.jsx b/client/src/components/game.container.jsx index 473782f5..47b34f67 100644 --- a/client/src/components/game.container.jsx +++ b/client/src/components/game.container.jsx @@ -69,8 +69,11 @@ const addState = connect( dispatch(actions.setShowLog(v)); } + function skip() { + dispatch(actions.setSkip(true)); + } - return { setActiveSkill, setActiveCryp, quit, toggleLog }; + return { setActiveSkill, setActiveCryp, quit, toggleLog, skip }; } ); diff --git a/client/src/components/main.jsx b/client/src/components/main.jsx index 196ce8d1..b37720e1 100644 --- a/client/src/components/main.jsx +++ b/client/src/components/main.jsx @@ -31,15 +31,6 @@ function Main(props) { ); } - if (nav === 'team') return ; - if (nav === 'list') return ; - - if (instance) { - return ( - - ); - } - if (game) { console.log('game time'); return ( @@ -47,6 +38,14 @@ function Main(props) { ); } + if (instance) { + return ( + + ); + } + + if (nav === 'team') return ; + if (nav === 'list') return ; return ( diff --git a/client/src/components/nav.jsx b/client/src/components/nav.jsx index a72c9a9c..f36c6c3e 100644 --- a/client/src/components/nav.jsx +++ b/client/src/components/nav.jsx @@ -37,6 +37,8 @@ const addState = connect( } function navTo(place) { + dispatch(actions.setGame(null)); + dispatch(actions.setInstance(null)); return dispatch(actions.setNav(place)); } diff --git a/client/src/events.jsx b/client/src/events.jsx index d26ef0a8..578235e0 100644 --- a/client/src/events.jsx +++ b/client/src/events.jsx @@ -66,6 +66,8 @@ function registerEvents(store) { // Create sub events for combat animations const sequence = getCombatSequence(r.event); return eachSeries(sequence, (stage, sCb) => { + const { skip } = store.getState(); + if (skip) return sCb(); const stagedR = Object.create(r); stagedR.stage = stage; store.dispatch(actions.setResolution(stagedR)); @@ -78,6 +80,8 @@ function registerEvents(store) { }, err => { if (err) return console.error(err); store.dispatch(actions.setResolution(null)); + // stop skipping resolutions + store.dispatch(actions.setSkip(false)); // update the game store.dispatch(actions.setGame(game)); // get the latest state and restart polling diff --git a/client/src/reducers.jsx b/client/src/reducers.jsx index 694ee2b7..91c04fcf 100644 --- a/client/src/reducers.jsx +++ b/client/src/reducers.jsx @@ -23,6 +23,7 @@ module.exports = { info: createReducer([null, null], actions.SET_INFO), instance: createReducer(null, actions.SET_INSTANCE), instances: createReducer([], actions.SET_INSTANCES), + skip: createReducer(false, actions.SET_SKIP), nav: createReducer(null, actions.SET_NAV), ping: createReducer(null, actions.SET_PING), player: createReducer(null, actions.SET_PLAYER),