本文整理匯總了TypeScript中game/view/status.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: 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;
}
示例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 = 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;
}
示例3: renderResult
function renderResult(ctrl: AnalyseCtrl): VNode[] {
let result: string | undefined;
if (ctrl.data.game.status.id >= 30) switch (ctrl.data.game.winner) {
case 'white':
result = '1-0';
break;
case 'black':
result = '0-1';
break;
default:
result = '½-½';
}
const tags: VNode[] = [];
if (result) {
tags.push(h('div.result', result));
const winner = getPlayer(ctrl.data, ctrl.data.game.winner!);
tags.push(h('div.status', [
statusView(ctrl),
winner ? ', ' + ctrl.trans(winner.color == 'white' ? 'whiteIsVictorious' : 'blackIsVictorious') : null
]));
}
return tags;
}
示例4: status
export function status(ctrl: RoundController) {
const s = viewStatus(ctrl);
if (s == 'playingRightNow') window.LichessSpeech!.step(ctrl.stepAt(ctrl.ply), false);
else {
withSpeech(speech => speech.say(s, false));
const w = ctrl.data.game.winner;
if (w) withSpeech(speech => speech.say(ctrl.trans.noarg(w + 'IsVictorious'), false));
}
}