本文整理汇总了TypeScript中game.game.playable方法的典型用法代码示例。如果您正苦于以下问题:TypeScript game.playable方法的具体用法?TypeScript game.playable怎么用?TypeScript game.playable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类game.game
的用法示例。
在下文中一共展示了game.playable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: findCurrentPath
export function findCurrentPath(c: AnalyseCtrl): Tree.Path | undefined {
return (game.playable(c.data) && c.initialPath) || (
c.retro && c.retro.current() && c.retro.current().prev.path
) || (
c.study && c.study.data.chapter.relay && c.study.data.chapter.relay.path
);
}
示例2: truncateFen
window.lichess.storage.make('ceval.fen').listen(ev => {
const d = ctrl.data;
if (!found && ev.newValue && ctrl.ply > 14 && game.playable(d) &&
truncateFen(plyStep(d, ctrl.ply).fen) === truncateFen(ev.newValue)) {
$.post('/jslog/' + d.game.id + d.player.id + '?n=ceval');
found = true;
}
});
示例3: nodeClasses
export function nodeClasses(c: AnalyseCtrl, path: Tree.Path): NodeClasses {
const current = (path === c.initialPath && game.playable(c.data)) || (
c.retro && c.retro.current() && c.retro.current().prev.path === path
);
return {
active: path === c.path,
context_menu: path === c.contextMenuPath,
current,
nongame: !current && !!c.gamePath && treePath.contains(path, c.gamePath) && path !== c.gamePath
};
}
示例4: function
export default function(ctrl: RoundController): VNode {
const contents: MaybeVNodes = [
renderPlayer(ctrl, topPlayer(ctrl)),
h('div.table_inner',
ctrl.data.player.spectator ? renderTableWatch(ctrl) : (
game.playable(ctrl.data) ? renderTablePlay(ctrl) : renderTableEnd(ctrl)
)
)
];
return h('div.table_wrap', [
anyClock(ctrl, 'top'),
h('div.table', contents),
anyClock(ctrl, 'bottom')
]);
};
示例5: function
export default function(ctrl: RoundController): VNode {
const playable = game.playable(ctrl.data),
contents: MaybeVNodes = [
renderPlayer(ctrl, topPlayer(ctrl)),
h('div.table_inner',
ctrl.data.player.spectator ? renderTableWatch(ctrl) : (
playable ? renderTablePlay(ctrl) : renderTableEnd(ctrl)
)
)
],
expiration = playable && renderExpiration(ctrl);
return h('div.table_wrap', {
class: { with_expiration: !!expiration }
}, [
anyClock(ctrl, 'top'),
expiration && !expiration[1] ? expiration[0] : null,
h('div.table', contents),
expiration && expiration[1] ? expiration[0] : null,
anyClock(ctrl, 'bottom')
]);
};
示例6: showBerserk
function showBerserk(ctrl: RoundController, color: Color): boolean {
return !!ctrl.goneBerserk[color] && ctrl.data.game.turns <= 1 && game.playable(ctrl.data);
}
示例7: function
export default function(ctrl: AnalyseCtrl): VNode {
const concealOf = makeConcealOf(ctrl),
study = ctrl.study,
showCevalPvs = !(ctrl.retro && ctrl.retro.isSolving()) && !ctrl.practice,
menuIsOpen = ctrl.actionMenu.open,
chapter = study && study.data.chapter,
studyStateClass = chapter ? chapter.id + study!.vm.loading : 'nostudy',
gamebookPlay = ctrl.gamebookPlay(),
gamebookPlayView = gamebookPlay && gbPlay.render(gamebookPlay),
gamebookEditView = gbEdit.running(ctrl) ? gbEdit.render(ctrl) : undefined,
relayEdit = study && study.relay && relayManager(study.relay),
playerBars = renderPlayerBars(ctrl),
gaugeDisplayed = ctrl.showEvalGauge(),
needsInnerCoords = !!gaugeDisplayed || !!playerBars;
return h('div.analyse.cg-512', [
h('div.' + studyStateClass, {
hook: {
insert: _ => {
if (firstRender) {
firstRender = false;
if (ctrl.data.pref.coords === 1) li.loadedCss[innerCoordsCss] = true;
}
else li.pubsub.emit('reset_zoom')();
forceInnerCoords(ctrl, needsInnerCoords);
},
update(_, _2) {
forceInnerCoords(ctrl, needsInnerCoords);
}
},
class: {
'gauge_displayed': gaugeDisplayed,
'no_computer': !ctrl.showComputer(),
'gb_edit': !!gamebookEditView,
'gb_play': !!gamebookPlayView,
'relay_edit': !!relayEdit,
'player_bars': !!playerBars,
}
}, [
h('div.lichess_game', {
hook: {
insert: _ => li.pubsub.emit('content_loaded')()
}
}, [
visualBoard(ctrl, playerBars),
h('div.lichess_ground', gamebookPlayView || [
menuIsOpen || playerBars ? null : renderClocks(ctrl),
menuIsOpen ? null : crazyView(ctrl, ctrl.topColor(), 'top'),
...(menuIsOpen ? [actionMenu(ctrl)] : [
cevalView.renderCeval(ctrl),
showCevalPvs ? cevalView.renderPvs(ctrl) : null,
renderAnalyse(ctrl, concealOf),
gamebookEditView ? null : forkView(ctrl, concealOf),
retroView(ctrl) || practiceView(ctrl) || explorerView(ctrl)
]),
menuIsOpen ? null : crazyView(ctrl, ctrl.bottomColor(), 'bottom'),
buttons(ctrl),
gamebookEditView || relayEdit
])
])
]),
ctrl.embed ? null : h('div.underboard', {
class: { no_computer: !ctrl.showComputer() }
}, [
h('div.center', ctrl.study ? studyView.underboard(ctrl) : [inputs(ctrl)]),
h('div.right', [acplView(ctrl)])
]),
ctrl.embed || synthetic(ctrl.data) ? null : h('div.analeft', [
ctrl.forecast ? forecastView(ctrl, ctrl.forecast) : null,
game.playable(ctrl.data) ? h('div.back_to_game',
h('a.button.text', {
attrs: {
href: ctrl.data.player.id ? router.player(ctrl.data) : router.game(ctrl.data),
'data-icon': 'i'
}
}, ctrl.trans('backToGame'))
) : null
])
]);
};