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


TypeScript Enums.values函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。