fix game navigation and added skip
This commit is contained in:
parent
d72118b157
commit
fedc52b558
@ -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 });
|
||||
|
||||
|
||||
@ -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 = (
|
||||
<div className="top">
|
||||
<button
|
||||
className="instance-btn instance-ui-btn right"
|
||||
onClick={() => sendGameReady()}>
|
||||
Ready
|
||||
onClick={() => actionClick()}>
|
||||
{actionText}
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -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 };
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
@ -31,15 +31,6 @@ function Main(props) {
|
||||
);
|
||||
}
|
||||
|
||||
if (nav === 'team') return <Team />;
|
||||
if (nav === 'list') return <List />;
|
||||
|
||||
if (instance) {
|
||||
return (
|
||||
<InstanceContainer />
|
||||
);
|
||||
}
|
||||
|
||||
if (game) {
|
||||
console.log('game time');
|
||||
return (
|
||||
@ -47,6 +38,14 @@ function Main(props) {
|
||||
);
|
||||
}
|
||||
|
||||
if (instance) {
|
||||
return (
|
||||
<InstanceContainer />
|
||||
);
|
||||
}
|
||||
|
||||
if (nav === 'team') return <Team />;
|
||||
if (nav === 'list') return <List />;
|
||||
|
||||
return (
|
||||
<Team />
|
||||
|
||||
@ -37,6 +37,8 @@ const addState = connect(
|
||||
}
|
||||
|
||||
function navTo(place) {
|
||||
dispatch(actions.setGame(null));
|
||||
dispatch(actions.setInstance(null));
|
||||
return dispatch(actions.setNav(place));
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user