show racer skip help once
parent
2df2a5f6cf
commit
2431422667
|
@ -63,6 +63,7 @@
|
|||
@extend %flex-column;
|
||||
align-items: center;
|
||||
@include transition;
|
||||
outline: none;
|
||||
&.disabled {
|
||||
opacity: 0;
|
||||
cursor: default;
|
||||
|
@ -78,15 +79,23 @@
|
|||
transform: scaleX(-1);
|
||||
}
|
||||
}
|
||||
&--pre .racer__skip {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
&__spectating .puz-clock__time {
|
||||
font-size: 3em;
|
||||
}
|
||||
|
||||
&__pre__message {
|
||||
@extend %flex-center-nowrap;
|
||||
justify-content: space-between;
|
||||
&__pov {
|
||||
margin: 1em 0;
|
||||
color: $c-brag;
|
||||
margin: 1em 0;
|
||||
@include breakpoint($mq-col2) {
|
||||
margin: 1em 0 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,10 @@ import CurrentPuzzle from 'puz/current';
|
|||
import makePromotion from 'puz/promotion';
|
||||
import throttle from 'common/throttle';
|
||||
import { Api as CgApi } from 'chessground/api';
|
||||
import { Boost } from './boost';
|
||||
import { Clock } from 'puz/clock';
|
||||
import { Combo } from 'puz/combo';
|
||||
import { Countdown } from './countdown';
|
||||
import { getNow, puzzlePov, sound } from 'puz/util';
|
||||
import { makeCgOpts } from 'puz/run';
|
||||
import { parseUci } from 'chessops/util';
|
||||
|
@ -12,8 +14,7 @@ import { Promotion, Run } from 'puz/interfaces';
|
|||
import { prop, Prop } from 'common';
|
||||
import { RacerOpts, RacerData, RacerVm, RacerPrefs, Race, UpdatableData, RaceStatus, WithGround } from './interfaces';
|
||||
import { Role } from 'chessground/types';
|
||||
import { Countdown } from './countdown';
|
||||
import { Boost } from './boost';
|
||||
import { storedProp } from 'common/storage';
|
||||
|
||||
export default class StormCtrl {
|
||||
private data: RacerData;
|
||||
|
@ -29,6 +30,7 @@ export default class StormCtrl {
|
|||
countdown: Countdown;
|
||||
boost: Boost = new Boost();
|
||||
skipAvailable = true;
|
||||
knowsSkip = storedProp('racer.skip', false);
|
||||
ground = prop<CgApi | false>(false) as Prop<CgApi | false>;
|
||||
|
||||
constructor(opts: RacerOpts, redraw: (data: RacerData) => void) {
|
||||
|
@ -115,10 +117,11 @@ export default class StormCtrl {
|
|||
canSkip = () => this.skipAvailable;
|
||||
|
||||
skip = () => {
|
||||
if (this.skipAvailable) {
|
||||
if (this.skipAvailable && this.run.clock.started()) {
|
||||
this.skipAvailable = false;
|
||||
sound.good();
|
||||
this.playUci(this.run.current.expectedMove());
|
||||
this.knowsSkip(true);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -32,8 +32,11 @@ const selectScreen = (ctrl: RacerCtrl): MaybeVNodes => {
|
|||
? [
|
||||
waitingToStart(noarg),
|
||||
h('div.racer__pre__message', [
|
||||
h('p', noarg(ctrl.vm.startsAt ? 'getReady' : 'waitingForMorePlayers')),
|
||||
povMsg,
|
||||
h('div.racer__pre__message__text', [
|
||||
h('p', ctrl.knowsSkip() ? noarg(ctrl.vm.startsAt ? 'getReady' : 'waitingForMorePlayers') : skipHelp()),
|
||||
povMsg,
|
||||
]),
|
||||
ctrl.knowsSkip() ? null : renderSkip(ctrl),
|
||||
]),
|
||||
comboZone(ctrl),
|
||||
]
|
||||
|
@ -81,6 +84,8 @@ const renderSkip = (ctrl: RacerCtrl) =>
|
|||
'skip'
|
||||
);
|
||||
|
||||
const skipHelp = () => h('p', 'NEW! You can skip one move per race:');
|
||||
|
||||
const puzzleRacer = () => h('strong', 'Puzzle Racer');
|
||||
|
||||
const waitingToStart = (noarg: TransNoArg) =>
|
||||
|
|
Loading…
Reference in New Issue