當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript game.playable方法代碼示例

本文整理匯總了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
  );
}
開發者ID:luanlv,項目名稱:lila,代碼行數:7,代碼來源:treeView.ts

示例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;
   }
 });
開發者ID:lexisvar,項目名稱:lila,代碼行數:8,代碼來源:cevalSub.ts

示例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
  };
}
開發者ID:lexisvar,項目名稱:lila,代碼行數:11,代碼來源:treeView.ts

示例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')
  ]);
};
開發者ID:lexisvar,項目名稱:lila,代碼行數:15,代碼來源:table.ts

示例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')
  ]);
};
開發者ID:luanlv,項目名稱:lila,代碼行數:21,代碼來源:table.ts

示例6: showBerserk

function showBerserk(ctrl: RoundController, color: Color): boolean {
  return !!ctrl.goneBerserk[color] && ctrl.data.game.turns <= 1 && game.playable(ctrl.data);
}
開發者ID:luanlv,項目名稱:lila,代碼行數:3,代碼來源:clockView.ts

示例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
    ])
  ]);
};
開發者ID:luanlv,項目名稱:lila,代碼行數:79,代碼來源:view.ts


注:本文中的game.game.playable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。