本文整理汇总了TypeScript中utilities/enum/Enums.values函数的典型用法代码示例。如果您正苦于以下问题:TypeScript values函数的具体用法?TypeScript values怎么用?TypeScript values使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了values函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: tuple
.setRefreshMethod(() => ({
defaultOption: ItemQuality.Random,
options: Enums.values(ItemQuality)
.map(quality => tuple(quality, Translation.generator(ItemQuality[quality])))
.collect(Collectors.toArray)
.values()
.map(([id, t]) => tuple(id, (option: Button) => option.setText(t))),
}))))
开发者ID:WaywardGame,项目名称:developertools,代码行数:8,代码来源:AddItemToInventory.ts
示例2: tuple
.setRefreshMethod(() => ({
defaultOption: ParticleType.Blood,
options: Enums.values(ParticleType)
.map(particle => tuple(particle, Translation.generator(ParticleType[particle])))
.collect(Collectors.toArray)
.sort(([, t1], [, t2]) => Text.toString(t1).localeCompare(Text.toString(t2)))
.values()
.map(([id, t]) => tuple(id, (option: Button) => option.setText(t))),
})))
开发者ID:WaywardGame,项目名称:developertools,代码行数:9,代码来源:GeneralPanel.ts
示例3: tuple
.setRefreshMethod(() => ({
defaultOption: this.tile ? TileHelpers.getType(this.tile) : TerrainType.Dirt,
options: Enums.values(TerrainType)
.filter(terrain => terrain)
.map(terrain => tuple(terrain, new Translation(Dictionary.Terrain, terrain).inContext(TextContext.Title)))
.collect(Collectors.toArray)
.sort(([, t1], [, t2]) => Text.toString(t1).localeCompare(Text.toString(t2)))
.values()
.map(([id, t]) => tuple(id, (option: Button) => option.setText(t))),
}))
开发者ID:WaywardGame,项目名称:developertools,代码行数:10,代码来源:Terrain.ts
示例4: pipe
.setRefreshMethod(() => ({
defaultOption: ItemType.None,
options: pipe(tuple(ItemType.None, Translation.nameOf(Dictionary.Item, ItemType.None, false).inContext(TextContext.Title)))
.include(Enums.values(ItemType)
.filter(item => item)
.map(item => tuple(item, Translation.nameOf(Dictionary.Item, item, false).inContext(TextContext.Title)))
.collect(Collectors.toArray)
.sort(([, t1], [, t2]) => Text.toString(t1).localeCompare(Text.toString(t2)))
.values())
.map(([id, t]) => tuple(id, (option: Button) => option.setText(t))),
}))
开发者ID:WaywardGame,项目名称:developertools,代码行数:11,代码来源:AddItemToInventory.ts
示例5: tuple
.setRefreshMethod(() => ({
defaultOption: "none",
options: ([
["none", option => option.setText(translation(DebugToolsTranslation.None))],
] as IDropdownOption[]).values().include(Enums.values(SkillType)
.map(skill => tuple(SkillType[skill], Translation.generator(SkillType[skill])))
.collect(Collectors.toArray)
.sort(([, t1], [, t2]) => Text.toString(t1).localeCompare(Text.toString(t2)))
.values()
.map(([id, t]) => tuple(id, (option: Button) => option.setText(t)))),
}))
开发者ID:WaywardGame,项目名称:developertools,代码行数:11,代码来源:Player.ts
示例6: tuple
.setRefreshMethod(() => ({
defaultOption: "nochange",
options: ([
["nochange", option => option.setText(translation(DebugToolsTranslation.PaintNoChange))],
["remove", option => option.setText(translation(DebugToolsTranslation.PaintRemove))],
] as IDropdownOption<"nochange" | "remove" | keyof typeof NPCType>[]).values().include(Enums.values(NPCType)
.map(npc => tuple(NPCType[npc] as keyof typeof NPCType, Translation.generator(NPCType[npc])))
.collect(Collectors.toArray)
.sort(([, t1], [, t2]) => Text.toString(t1).localeCompare(Text.toString(t2)))
.values()
.map(([id, t]) => tuple(id, (option: Button) => option.setText(t)))),
}))
开发者ID:WaywardGame,项目名称:developertools,代码行数:12,代码来源:NPC.ts
示例7: updateSelectionOverlay
/**
* Selection overlay tilemapping
* @param tile The tile to update
* @param tilePosition The position of this tile
* @param updateNeighbors Whether to update the tile's neighbours. Defaults to `true`. This method calls itself to update its neighbours,
* but doesn't update neighbours in the recursive call.
*/
function updateSelectionOverlay(tile: ITile, tilePosition: IVector2, updateNeighbors = true) {
let neighborTiles: INeighborTiles | undefined;
let connections: NeighborPosition[] | undefined;
const isTilePainted = TileHelpers.Overlay.remove(tile, Overlays.isPaint);
// if this tile is painted (has the selection overlay), we tilemap this tile based on its neighbours
if (isTilePainted) {
neighborTiles = getNeighborTiles(tilePosition);
connections = getPaintOverlayConnections(neighborTiles);
const mappedTile: ISubTileMap = {
[SubTilePosition.TopLeft]: paintTileMap[SubTilePosition.TopLeft][getId(SubTilePosition.TopLeft, ...connections)],
[SubTilePosition.TopRight]: paintTileMap[SubTilePosition.TopRight][getId(SubTilePosition.TopRight, ...connections)],
[SubTilePosition.BottomLeft]: paintTileMap[SubTilePosition.BottomLeft][getId(SubTilePosition.BottomLeft, ...connections)],
[SubTilePosition.BottomRight]: paintTileMap[SubTilePosition.BottomRight][getId(SubTilePosition.BottomRight, ...connections)],
};
for (const subTilePosition of Enums.values(SubTilePosition)) {
const offset = subTilePositionMap[subTilePosition];
if (mappedTile[subTilePosition] === 4) {
TileHelpers.Overlay.add(tile, {
type: SelectionOverlay.debugTools.overlayPaint,
size: 8,
offsetX: 20,
offsetY: 4,
spriteOffsetX: offset.x / 16,
spriteOffsetY: offset.y / 16,
});
continue;
}
TileHelpers.Overlay.add(tile, {
type: SelectionOverlay.debugTools.overlayPaint,
size: 8,
offsetX: mappedTile[subTilePosition] * 16 + offset.x,
offsetY: offset.y,
spriteOffsetX: offset.x / 16,
spriteOffsetY: offset.y / 16,
});
}
}
if (!updateNeighbors) return;
neighborTiles = neighborTiles || getNeighborTiles(tilePosition);
connections = connections || getPaintOverlayConnections(neighborTiles);
for (const [neighborPosition, neighborTile] of Objects.values(neighborTiles)) {
updateSelectionOverlay(neighborTile, neighborPosition, false);
}
}
开发者ID:WaywardGame,项目名称:developertools,代码行数:60,代码来源:SelectionOverlay.ts
示例8:
.setHandler(action => {
const itemTypes = Enums.values(ItemType);
for (const itemType of itemTypes) {
const desc = itemDescriptions[itemType];
if (desc && desc.recipe && desc.craftable !== false && !game.crafted[itemType]) {
game.crafted[itemType] = {
newUnlock: true,
unlockTime: Date.now(),
};
}
}
game.updateTablesAndWeight();
});
开发者ID:WaywardGame,项目名称:developertools,代码行数:15,代码来源:UnlockRecipes.ts
注:本文中的utilities/enum/Enums.values函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论