本文整理匯總了TypeScript中nvui/command.commands.piece.apply方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript commands.piece.apply方法的具體用法?TypeScript commands.piece.apply怎麽用?TypeScript commands.piece.apply使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nvui/command.commands.piece
的用法示例。
在下文中一共展示了commands.piece.apply方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: onCommand
function onCommand(ctrl: AnalyseController, notify: (txt: string) => void, c: string, style: Style) {
const pieces = ctrl.chessground.state.pieces;
notify(
commands.piece.apply(c, pieces, style) ||
commands.scan.apply(c, pieces) ||
`Invalid command: ${c}`
);
}
示例2: onCommand
function onCommand(ctrl: RoundController, notify: (txt: string) => void, c: string, style: Style) {
if (c == 'c' || c == 'clock') notify($('.nvui .botc').text() + ', ' + $('.nvui .topc').text());
else if (c == 'l' || c == 'last') notify($('.lastMove').text());
else if (c == 'abort') $('.nvui button.abort').click();
else if (c == 'resign') $('.nvui button.resign-confirm').click();
else if (c == 'draw') $('.nvui button.draw-yes').click();
else if (c == 'takeback') $('.nvui button.takeback-yes').click();
else {
const pieces = ctrl.chessground.state.pieces;
notify(
commands.piece.apply(c, pieces, style) ||
commands.scan.apply(c, pieces) ||
`Invalid command: ${c}`
);
}
}