skip and footer stuff

This commit is contained in:
ntr 2019-06-05 20:46:27 +10:00
parent a05d97bb36
commit 1f5fba80f1
5 changed files with 37 additions and 27 deletions

View File

@ -36,7 +36,6 @@
purge green disable purge green disable
rework scatter rework scatter
change strangle
hatred maybe hatred maybe
reconnect based on time delta reconnect based on time delta

View File

@ -482,6 +482,11 @@ main .top button {
width: 100%; width: 100%;
} }
.ready-btn:hover, .ready-btn:focus, .ready-btn:active {
color: forestgreen;
}
.ready { .ready {
background: forestgreen; background: forestgreen;
color: black; color: black;

View File

@ -75,26 +75,34 @@ function GameFooter(props) {
const playerTeam = game.players.find(t => t.id === account.id); const playerTeam = game.players.find(t => t.id === account.id);
function actionClick() { function quitClick() {
if (game.phase === 'Finish') {
sendInstanceState(game.instance); sendInstanceState(game.instance);
quit(); quit();
return true; return true;
} }
if (resolution) { const quitBtn = (
return skip(); <button
} onClick={quitClick}>
Back
</button>
);
return sendGameReady(); const skipBtn = (
} <button
onClick={skip}>
Skip
</button>
);
let actionText = 'Ready';
if (game.phase === 'Finish') actionText = 'Done'; const readyBtn = (
if (resolution) actionText = 'Skip'; <button
const ready = (actionText === 'Ready' && playerTeam.ready) className={`${playerTeam.ready ? 'ready' : ''} ready-btn`}
? 'ready' onClick={sendGameReady}>
: ''; Ready
</button>
);
const zero = Date.parse(game.phase_start); const zero = Date.parse(game.phase_start);
const now = Date.now(); const now = Date.now();
@ -125,11 +133,9 @@ function GameFooter(props) {
<footer> <footer>
{timer} {timer}
<button id="nav-btn" onClick={() => setShowNav(!showNav)} ></button> <button id="nav-btn" onClick={() => setShowNav(!showNav)} ></button>
<button {resolution && skipBtn}
className={ready} {game.phase === 'Finish' && quitBtn }
onClick={() => actionClick()}> {!resolution && game.phase === 'Skill' && readyBtn }
{actionText}
</button>
</footer> </footer>
); );
} }

View File

@ -62,7 +62,7 @@ function Instance(args) {
return setInfo(info); return setInfo(info);
} }
const rdyClasses = `${player.ready ? 'ready' : ''}`; const rdyClasses = `${player.ready ? 'ready ready-btn' : 'ready-btn'}`;
const readyInfo = instance.phase === 'Lobby' const readyInfo = instance.phase === 'Lobby'
? 'lobbyReady' ? 'lobbyReady'
: 'ready'; : 'ready';

View File

@ -61,14 +61,14 @@ function registerEvents(store) {
const sequence = getCombatSequence(r); const sequence = getCombatSequence(r);
return eachSeries(sequence, (stage, sCb) => { return eachSeries(sequence, (stage, sCb) => {
const { skip } = store.getState(); const { skip } = store.getState();
if (skip) return sCb(); if (skip) return sCb('skip');
const stagedR = Object.create(r); const stagedR = Object.create(r);
stagedR.stage = stage; stagedR.stage = stage;
store.dispatch(actions.setResolution(stagedR)); store.dispatch(actions.setResolution(stagedR));
return setTimeout(sCb, TIMES[stage]); return setTimeout(sCb, TIMES[stage]);
}, err => { }, err => {
if (err) return console.error(err); if (err) console.error(err);
// Finished this resolution // Finished this resolution
return cb(); return cb();
}); });