本文整理汇总了TypeScript中game/status.finished函数的典型用法代码示例。如果您正苦于以下问题:TypeScript finished函数的具体用法?TypeScript finished怎么用?TypeScript finished使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了finished函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: followUp
export function followUp(ctrl: RoundController): VNode {
const d = ctrl.data,
noarg = ctrl.trans.noarg,
rematchable = !d.game.rematch && (status.finished(d) || status.aborted(d)) && !d.tournament && !d.simul && !d.game.boosted,
newable = (status.finished(d) || status.aborted(d)) && (
d.game.source === 'lobby' ||
d.game.source === 'pool'),
rematchZone = ctrl.challengeRematched ? [
h('div.suggestion.text', {
hook: onSuggestionHook,
attrs: { 'data-icon': 'j' }
}, noarg('rematchOfferSent'))
] : (rematchable || d.game.rematch ? rematchButtons(ctrl) : [
h('button.button.rematch.white',
{ class: { disabled: true } },
[h('span', noarg('rematch'))]
)
]);
return h('div.follow_up', [
...rematchZone,
d.tournament ? h('a.button', {
attrs: {href: '/tournament/' + d.tournament.id}
}, noarg('viewTournament')) : null,
newable ? h('a.button', {
attrs: { href: d.game.source === 'pool' ? poolUrl(d.clock!, d.opponent.user) : '/?hook_like=' + d.game.id },
}, noarg('newOpponent')) : null,
analysisButton(ctrl)
]);
}
示例2: renderResult
export function renderResult(ctrl: RoundController): VNode | undefined {
let result;
if (status.finished(ctrl.data)) switch (ctrl.data.game.winner) {
case 'white':
result = '1-0';
break;
case 'black':
result = '0-1';
break;
default:
result = '½-½';
}
if (result || status.aborted(ctrl.data)) {
const winner = ctrl.data.game.winner;
return h('div.result-wrap', [
h('p.result', result || ''),
h('p.status', {
hook: util.onInsert(() => {
if (ctrl.autoScroll) ctrl.autoScroll();
else setTimeout(() => ctrl.autoScroll(), 200);
})
}, [
viewStatus(ctrl),
winner ? ' • ' + ctrl.trans.noarg(winner + 'IsVictorious') : ''
])
]);
}
return;
}
示例3: renderResult
export function renderResult(ctrl: RoundController): VNode | undefined {
let result;
if (status.finished(ctrl.data)) switch (ctrl.data.game.winner) {
case 'white':
result = '1-0';
break;
case 'black':
result = '0-1';
break;
default:
result = '½-½';
}
if (result || status.aborted(ctrl.data)) {
const winner = game.getPlayer(ctrl.data, ctrl.data.game.winner);
return h('div.result_wrap', [
result ? h('p.result', result) : null,
h('p.status', {
hook: {
insert: _ => {
if (ctrl.autoScroll) ctrl.autoScroll();
else setTimeout(() => ctrl.autoScroll(), 200);
}
}
}, [
h('div', viewStatus(ctrl)),
winner ? h('div', ctrl.trans.noarg(winner.color + 'IsVictorious')) : null
])
]);
}
return;
}
示例4: whosTurn
function whosTurn(ctrl: RoundController, color: Color, position: Position) {
const d = ctrl.data;
if (status.finished(d) || status.aborted(d)) return;
return h('div.rclock.rclock-turn.rclock-' + position, [
d.game.player === color ? h('div.rclock-turn__text',
d.player.spectator ? ctrl.trans(d.game.player + 'Plays') : ctrl.trans(
d.game.player === d.player.color ? 'yourTurn' : 'waitingForOpponent'
)
) : null
]);
}
示例5: whosTurn
function whosTurn(ctrl: RoundController, color: Color) {
var d = ctrl.data;
if (status.finished(d) || status.aborted(d)) return;
return h('div.whos_turn',
d.game.player === color ? (
d.player.spectator ? ctrl.trans(d.game.player + 'Plays') : ctrl.trans(
d.game.player === d.player.color ? 'yourTurn' : 'waitingForOpponent'
)
) : ''
);
}
示例6: set
export function set(ctrl: RoundController, text?: string) {
if (ctrl.data.player.spectator) return;
if (!text) {
if (finished(ctrl.data)) {
text = ctrl.trans('gameOver');
} else if (isPlayerTurn(ctrl.data)) {
text = ctrl.trans('yourTurn');
if (!document.hasFocus()) startTicker();
} else {
text = ctrl.trans('waitingForOpponent');
resetTicker();
}
}
document.title = text + " - " + initialTitle;
}