创意工坊

1. UGCMatchingType

greenworks.UGCMatchingType

Represents Steam SDK EUGCMatchingUGCType, matching UGC types for queries.

  • Items

  • ItemsMtx

  • ItemsReadyToUse

  • Collections

  • Artwork

  • Videos

  • Screenshots

  • AllGuides

  • WebGuides

  • IntegratedGuides

  • UsableInGame

  • ControllerBindings

2. UGCQueryType

greenworks.UGCQueryType

Represents Steam SDK EUGCQuery, combination of sorting and filtering for queries across all UGC.

  • RankedByVote

  • RankedByPublicationDate

  • AcceptedForGameRankedByAcceptanceDate

  • RankedByTrend

  • FavoritedByFriendsRankedByPublicationDate

  • CreatedByFriendsRankedByPublicationDate

  • RankedByNumTimesReported

  • CreatedByFollowedUsersRankedByPublicationDate

  • NotYetRated

  • RankedByTotalVotesAsc

  • RankedByVotesUp

  • RankedByTextSearch

3. SteamUGCDetails

Represents Steam SDK SteamUGCDetails_t(return by greenworks.ugcGetItems), details for a single published file/UGC

  • acceptForUse Boolean: Whether is flaged as accepted in Steam workshop.

  • banned Boolean: Whether is banned

  • tagsTruncated Boolean: Whether the list of tags is too long to be returned in provided buffer.

  • fileType Integer: Type of the file

  • result Integer: Result of the operation.

    • 1: Success

    • Others: Fail

  • visibility Integer: the visiblility of the file

    • 0: Public

    • 1: FriendsOnly

    • 2: Private

  • score Double: Calculated score

  • file String: Represents uint64, file handle

  • fileName String: Cloud file name of the primary file

  • fileSize Integer: Size of the primary file

  • previewFile String: Represents uint64, handle of preview file

  • previewFileSize Integer: Size of preview file

  • steamIDOwner String: Represents uint64, Steam ID of user who created the file.

  • consumerAppID Integer: ID of app that consumes the file

  • creatorAppID Integer: ID of app that created the file

  • publishedFileId String: Represents uint64, the file ID

  • title String: Title of the file

  • description String: Description of the file

  • URL String:

  • tags String: List of tags, separated by comma.

  • timeAddedToUserList Integer: Time when user added this file to list.

  • timeCreated Integer: Time when the file was created

  • timeUpdated Integer: Time when the file is last updated.

  • votesDown Integer: Number of votes down

  • votesUp Integer: Number of votes up

4. UserUGCList

greenworks.UserUGCList

Represents Steam SDK EUserUGCList, different lists of published UGC for a user.

  • Published

  • VotedOn

  • VotedUp

  • VotedDown

  • WillVoteLater

  • Favorited

  • Subscribed

  • UsedOrPlayer

  • Followed

5. UserUGCListSortOrder

greenworks.UserUGCListSortOrder

Represents Steam SDK EUserUGCListSortOrder, sort order for user published UGC lists

  • CreationOrderDesc

  • CreationOrderAsc

  • TitleAsc

  • LastUpdatedDesc

  • SubscriptionDateDesc

  • VoteScoreDesc

  • ForModeration

6. UGCItemState

greenworks.UGCItemState

Represents Steam SDK EItemState, local state of a workshop item (combinable flags)

  • None

  • Subscribed

  • LegacyItem

  • Installed

  • NeedsUpdate

  • Downloading

  • DownloadPending

  • Methods

7. 共享文件

greenworks.fileShare(file_path, success_callback, [error_callback])

  • file_path String

  • success_calback Function(file_handle)

    • file_handle String: 表示可以与用户和功能共享的文件句柄。

  • error_callback Function(err)

8. 发布工坊文件

greenworks.publishWorkshopFile([options, ] file_path, image_path, title, description, success_callback, [error_callback])

  • options Object

    • app_id Integer: 将使用此工坊文件的游戏ID

    • tags Array of String: 工坊文件的标签

  • file_path String

  • image_path String

  • title String

  • description String

  • success_callback Function(publish_file_handle)

    • publish_file_handle String: Represents uint64, the published file handle

  • error_callback Function(err)

将 file_path 路径的文件发布到steam。 在这么做之前,file_pathimage_path 路径下的文件需要存在于SteamCloud上(使用 writeTextToFile 或者是 saveFilesToCloud API)并且需要共享(使用 Greenworks.fileShare API)。

image_path 参数是空字符串的话则表示不向工坊发送图片文件。

9. 更新已发布的工坊文件

greenworks.updatePublishedWorkshopFile([options, ] published_file_handle, file_path, image_path, title, description, success_callback, [error_callback])

  • options Object

    • tags Array of String: 工坊文件的标签。若要删除所有现有标记,请传递带有空字符串 [''] 的数组

  • published_file_handle String: 发布的文件句柄

  • file_path String

  • image_path String

  • title String

  • description String

  • success_callback Function()

  • error_callback Function(err)

file_path/image_path/title/description 这些字段如果是空字符串则代表不更新对应字段。

10. 发布到工坊

greenworks.ugcPublish(file_path, title, description, image_path, success_callback, [error_callback], [progress_callback])

  • file_path String

  • title String

  • description String

  • image_path String

  • success_callback Function(published_file_handle)

    • published_file_handle String: 发布的文件句柄

  • error_callback Function(err)

  • progress_callback Function(progress_msg)

    • progress_msg String: 发布过程的当前进度: 文件保存到Steam Cloud完成文件共享完成

将用户生成的内容发布到Steam工坊,

11. 发布更新

greenworks.ugcPublishUpdate(published_file_handle, file_path, title, description, image_path, success_callback, [error_callback], [progress_callback])

  • published_file_handle String: 发布的文件句柄

  • file_path String

  • title String

  • description String

  • image_path String

  • success_callback Function()

  • error_callback Function(err)

  • progress_callback Function(progress_msg)

  • progress_msg String: 发布过程的当前进度: 文件保存到Steam Cloud完成文件共享完成

更新已发布的工坊文件。

12. 获取所有文件

greenworks.ugcGetItems([options, ] ugc_matching_type, ugc_query_type, success_callback, [error_callback])

  • options Object

    • app_id Integer: 将使用此工坊文件的游戏ID

    • page_num Integer: 要接收结果的页码,第一次调用时应从1开始,每页最大50条数据

  • ugc_matching_type greenworks.UGCMatchingType

  • ugc_query_type greenworks.UGCQueryType

  • success_callback Function(items)

    • items SteamUGCDetails 创意工坊文件详细信息对象数组

  • error_callback Function(err)

13. 获取用户文件

greenworks.ugcGetUserItems([options, ] ugc_matching_type, ugc_list_sort_order, ugc_list, success_callback, [error_callback])

  • options Object

    • app_id Integer: 将使用此工坊文件的游戏ID

    • page_num Integer: 要接收结果的页码,第一次调用时应从1开始,每页最大50条数据

  • ugc_matching_type greenworks.UGCMatchingType

  • ugc_list_sort_order greenworks.UserUGCListSortOrder

  • ugc_list greenworks.UserUGCList

  • success_callback Function(items)

    • items SteamUGCDetails 创意工坊文件详细信息对象数组

  • error_callback Function(err)

14. 下载文件

greenworks.ugcDownloadItem(download_file_handle, download_dir, success_callback, [error_callback])

  • download_file_handle String: 要下载的文件句柄

  • download_dir String: 在本地计算机上保存下载文件的文件路径

  • success_callback Function()

  • error_callback Function(err)

15. 同步文件

greenworks.ugcSynchronizeItems([options, ] sync_dir, success_callback, [error_callback])

  • options Object

    • app_id Integer: 将使用此工坊文件的游戏ID

    • page_num Integer: 要接收结果的页码,第一次调用时应从1开始,每页最大50条数据

  • sync_dir String: 下载同步工坊文件的目录。

  • success_callback Function(items)

    • items SteamUGCDetails 创意工坊文件详细信息对象数组

    • isUpdated Boolean: 是否在此函数调用的过程中更新文件

  • error_callback Function(err)

将用户的工坊文件 (UserUGCList.Subscribed, UserMatchingType.Items) 下载/同步到本地的 sync_dir 目录(仅当文件的上次更新时间与Steam Cloud不同或本地不存在工坊文件时才更新)。

16. 取消订阅

greenworks.ugcUnsubscribe(published_file_handle, success_callback, [error_callback])

  • published_file_handle String: 想要取消订阅的文件句柄(SteamUGCDetails.publishedFileId).

  • success_callback Function()

  • error_callback Function(err)

17. 显示工坊对话框

greenworks.ugcShowOverlay([published_file_id])

  • published_file_id String: 已发布文件的id

显示Steam工坊页面或指定工坊文件的Steam对话框。

18. 获取文件状态

greenworks.ugcGetItemState(published_file_id)

  • published_file_id String: 已发布文件的id

拉取指定工坊文件的 greenworks.UGCItemState 值。

19. 获取文件安装信息

greenworks.ugcGetItemInstallInfo(published_file_id)

  • published_file_id String: 已发布文件的id

如果工坊文件的状态包括 greenworks.UGCItemState.Installed,则拉取工坊文件的安装信息。 如果无法获取信息,则返回 undefined ;否则返回包含以下属性的 对象

  • sizeOnDisk String: 返回创意工坊物品的字节大小

  • folder String: 硬盘上项目文件夹的绝对路径,如果状态为 LegacyItem 则指向文件本身

  • timestamp Integer:返回工坊文件的上次更新的时间