当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript camelot-unchained.utils类代码示例

本文整理汇总了TypeScript中@csegames/camelot-unchained.utils的典型用法代码示例。如果您正苦于以下问题:TypeScript utils类的具体用法?TypeScript utils怎么用?TypeScript utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了utils类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: webAPIServerToPatcherServer

 reducer: (s, a) => {
   if (a.server.name === 'localhost') return {};
   const servers = utils.clone(s.servers);
   servers[a.server.name] = utils.merge(servers[a.server.name], webAPIServerToPatcherServer(a.server));
   return {
     servers,
   };
 },
开发者ID:codecorsair,项目名称:Camelot-Unchained,代码行数:8,代码来源:controller.ts

示例2: updateCharacterCounts

 reducer: (s, a) => {
   const characters = utils.clone(s.characters);
   delete characters[a.id];
   const servers = updateCharacterCounts(utils.clone(s.servers), characters);
   return {
     characters,
     servers,
   };
 },
开发者ID:codecorsair,项目名称:Camelot-Unchained,代码行数:9,代码来源:controller.ts

示例3:

 reducer: (s, a) => {
   const servers = utils.clone(s.servers);
   servers[a.id].available = false;
   return {
     servers,
   };
 },
开发者ID:codecorsair,项目名称:Camelot-Unchained,代码行数:7,代码来源:controller.ts

示例4: shouldShowItem

export function shouldShowItem(item: InventoryItem.Fragment, activeFilters: ActiveFilters, searchValue: string) {
  const hasFilter = hasActiveFilterButtons(activeFilters);
  const hasSearch = hasFilterText(searchValue);
  const itemName = getItemDefinitionName(item);

    // Active filters compared to item gearSlots
  const doActiveFiltersIncludeItem = _.findIndex(_.values(activeFilters), (filter) => {
    return inventoryFilterButtons[filter.name].filter(item);
  }) > -1;

    // Search text compared to itemName
  const doesSearchValueIncludeItem = utils.doesSearchInclude(searchValue, itemName);

    // Do active filters and search include item?
  if (hasFilter && hasSearch) {
    return doActiveFiltersIncludeItem && doesSearchValueIncludeItem;

      // Do active filters include item?
  } else if (hasFilter && !hasSearch) {
    return doActiveFiltersIncludeItem;

    // Does search value include item?
  } else if (!hasFilter && hasSearch) {
    return doesSearchValueIncludeItem;

    // If there are no filters or searchValue, every item should be shown.
  } else {
    return true;
  }
}
开发者ID:codecorsair,项目名称:Camelot-Unchained,代码行数:30,代码来源:utils.ts

示例5: dispatch

    events.on(characterUpdatedEvent, (characterJSON: string) => {
      const character = utils.tryParseJSON<webAPI.SimpleCharacter>(characterJSON, client.debug);
      if (character !== null) {
        if (controllerState && isEqual(controllerState.characters[character.id], character)) {
          // No need to update character if already equal to what we have in state.
          return;
        }

        // Update character
        dispatch(characterUpdate(character));
      }
    });
开发者ID:codecorsair,项目名称:Camelot-Unchained,代码行数:12,代码来源:controller.ts

示例6: getContainerColor

export function getContainerColor(item: InventoryItem.Fragment, alpha?: number) {
  if (item && item.containerColor) {
    const { containerColor } = item;
    if (containerColor) {
      return `rgba(${containerColor.r}, ${containerColor.g}, ${containerColor.b}, ${alpha || 1})`;
    } else {
      return utils.lightenColor(colors.filterBackgroundColor, 5);
    }
  }

  if (!item) {
    console.error('You provided an undefined item to getContainerColor() function');
  }
}
开发者ID:codecorsair,项目名称:Camelot-Unchained,代码行数:14,代码来源:utils.ts


注:本文中的@csegames/camelot-unchained.utils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。