automatically rollback uncommented wrong move

pull/3523/head
Thibault Duplessis 2017-08-24 22:23:49 -05:00
parent 98b59807dd
commit 31828313c9
3 changed files with 13 additions and 7 deletions

View File

@ -79,7 +79,7 @@
.gb_play .feedback.act:hover {
opacity: 1;
}
.gb_play .feedback.act span {
.gb_play .feedback.act.com span {
animation: rubberBand 8s infinite;
}
.gb_play .feedback.bad {

View File

@ -54,10 +54,16 @@ export default class GamebookPlayCtrl {
}
}
this.state = state as State;
if (state.feedback === 'good' && !state.comment) setTimeout(() => {
this.next();
this.redraw();
}, this.root.path ? 1000 : 300);
if (!state.comment) {
if (state.feedback === 'good') setTimeout(() => {
this.next();
this.redraw();
}, this.root.path ? 1000 : 300);
else if (state.feedback === 'bad') setTimeout(() => {
this.retry();
this.redraw();
}, 800);
}
}
isMyMove = () => this.root.turnColor() === this.root.data.orientation;

View File

@ -38,13 +38,13 @@ export function render(ctrl: GamebookPlayCtrl): VNode {
function renderFeedback(ctrl: GamebookPlayCtrl, state: State) {
const fb = state.feedback;
if (fb === 'bad') return h('div.feedback.act.bad', {
if (fb === 'bad') return h('div.feedback.act.bad' + (state.comment ? '.com' : ''), {
hook: bind('click', ctrl.retry, ctrl.redraw)
}, [
h('i', { attrs: dataIcon('P') }),
h('span', 'Retry')
]);
if (fb === 'good' && state.comment) return h('div.feedback.act.good', {
if (fb === 'good' && state.comment) return h('div.feedback.act.good.com', {
hook: bind('click', () => ctrl.next())
}, [
h('i', { attrs: dataIcon('G') }),