本文整理汇总了TypeScript中game.game.getPlayer方法的典型用法代码示例。如果您正苦于以下问题:TypeScript game.getPlayer方法的具体用法?TypeScript game.getPlayer怎么用?TypeScript game.getPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类game.game
的用法示例。
在下文中一共展示了game.getPlayer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: renderResult
function renderResult(ctrl: RoundController) {
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', gameView.status(ctrl)),
winner ? h('div', ctrl.trans.noarg(winner.color + 'IsVictorious')) : null
])
]);
}
return;
}
示例2: renderPlayer
function renderPlayer(data: AnalyseData, color: Color): VNode {
const p = game.getPlayer(data, color);
if (p.user) return h('a.user_link.ulpt', {
attrs: { href: '/@/' + p.user.username }
}, [
h('span', p.user.username),
renderRatingDiff(p.ratingDiff)
]);
return h('span', p.name || (p.ai ? 'Stockfish level ' + p.ai : 'Anonymous'));
}
示例3: renderPlayer
function renderPlayer(ctrl: AnalyseCtrl, color: Color): VNode {
const p = game.getPlayer(ctrl.data, color);
if (p.user) return h('a.user_link.ulpt', {
attrs: { href: '/@/' + p.user.username }
}, [
h('span', p.user.username),
renderRatingDiff(p.ratingDiff)
]);
return h('span',
p.name ||
(p.ai && 'Stockfish level ' + p.ai) ||
(ctrl.study && findTag(ctrl.study.data.chapter.tags, color)) ||
'Anonymous');
}
示例4: 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 = game.getPlayer(ctrl.data, ctrl.data.game.winner!);
tags.push(h('div.status', [
gameView.status(ctrl),
winner ? ', ' + ctrl.trans(winner.color == 'white' ? 'whiteIsVictorious' : 'blackIsVictorious') : null
]));
}
return tags;
}