创意工坊
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
-
acceptForUseBoolean: Whether is flaged as accepted in Steam workshop. -
bannedBoolean: Whether is banned -
tagsTruncatedBoolean: Whether the list of tags is too long to be returned in provided buffer. -
fileTypeInteger: Type of the file -
resultInteger: Result of the operation.-
1: Success -
Others: Fail
-
-
visibilityInteger: the visiblility of the file-
0: Public -
1: FriendsOnly -
2: Private
-
-
scoreDouble: Calculated score -
fileString: Represents uint64, file handle -
fileNameString: Cloud file name of the primary file -
fileSizeInteger: Size of the primary file -
previewFileString: Represents uint64, handle of preview file -
previewFileSizeInteger: Size of preview file -
steamIDOwnerString: Represents uint64, Steam ID of user who created the file. -
consumerAppIDInteger: ID of app that consumes the file -
creatorAppIDInteger: ID of app that created the file -
publishedFileIdString: Represents uint64, the file ID -
titleString: Title of the file -
descriptionString: Description of the file -
URLString: -
tagsString: List of tags, separated by comma. -
timeAddedToUserListInteger: Time when user added this file to list. -
timeCreatedInteger: Time when the file was created -
timeUpdatedInteger: Time when the file is last updated. -
votesDownInteger: Number of votes down -
votesUpInteger: 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_pathString -
success_calbackFunction(file_handle)-
file_handleString: 表示可以与用户和功能共享的文件句柄。
-
-
error_callbackFunction(err)
8. 发布工坊文件
greenworks.publishWorkshopFile([options, ] file_path, image_path, title, description, success_callback, [error_callback])
-
optionsObject-
app_idInteger: 将使用此工坊文件的游戏ID -
tagsArray of String: 工坊文件的标签
-
-
file_pathString -
image_pathString -
titleString -
descriptionString -
success_callbackFunction(publish_file_handle)-
publish_file_handleString: Represents uint64, the published file handle
-
-
error_callbackFunction(err)
将 file_path 路径的文件发布到steam。 在这么做之前,file_path 和 image_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])
-
optionsObject-
tagsArray of String: 工坊文件的标签。若要删除所有现有标记,请传递带有空字符串['']的数组
-
-
published_file_handleString: 发布的文件句柄 -
file_pathString -
image_pathString -
titleString -
descriptionString -
success_callbackFunction() -
error_callbackFunction(err)
file_path/image_path/title/description 这些字段如果是空字符串则代表不更新对应字段。
10. 发布到工坊
greenworks.ugcPublish(file_path, title, description, image_path, success_callback, [error_callback], [progress_callback])
-
file_pathString -
titleString -
descriptionString -
image_pathString -
success_callbackFunction(published_file_handle)-
published_file_handleString: 发布的文件句柄
-
-
error_callbackFunction(err) -
progress_callbackFunction(progress_msg)-
progress_msgString: 发布过程的当前进度:文件保存到Steam Cloud完成,文件共享完成。
-
将用户生成的内容发布到Steam工坊,
11. 发布更新
greenworks.ugcPublishUpdate(published_file_handle, file_path, title, description, image_path, success_callback, [error_callback], [progress_callback])
-
published_file_handleString: 发布的文件句柄 -
file_pathString -
titleString -
descriptionString -
image_pathString -
success_callbackFunction() -
error_callbackFunction(err) -
progress_callbackFunction(progress_msg) -
progress_msgString: 发布过程的当前进度:文件保存到Steam Cloud完成,文件共享完成。
更新已发布的工坊文件。
12. 获取所有文件
greenworks.ugcGetItems([options, ] ugc_matching_type, ugc_query_type, success_callback, [error_callback])
-
optionsObject-
app_idInteger: 将使用此工坊文件的游戏ID -
page_numInteger: 要接收结果的页码,第一次调用时应从1开始,每页最大50条数据
-
-
ugc_matching_typegreenworks.UGCMatchingType -
ugc_query_typegreenworks.UGCQueryType -
success_callbackFunction(items)-
itemsSteamUGCDetails创意工坊文件详细信息对象数组
-
-
error_callbackFunction(err)
13. 获取用户文件
greenworks.ugcGetUserItems([options, ] ugc_matching_type, ugc_list_sort_order, ugc_list, success_callback, [error_callback])
-
optionsObject-
app_idInteger: 将使用此工坊文件的游戏ID -
page_numInteger: 要接收结果的页码,第一次调用时应从1开始,每页最大50条数据
-
-
ugc_matching_typegreenworks.UGCMatchingType -
ugc_list_sort_ordergreenworks.UserUGCListSortOrder -
ugc_listgreenworks.UserUGCList -
success_callbackFunction(items)-
itemsSteamUGCDetails创意工坊文件详细信息对象数组
-
-
error_callbackFunction(err)
14. 下载文件
greenworks.ugcDownloadItem(download_file_handle, download_dir, success_callback, [error_callback])
-
download_file_handleString: 要下载的文件句柄 -
download_dirString: 在本地计算机上保存下载文件的文件路径 -
success_callbackFunction() -
error_callbackFunction(err)
15. 同步文件
greenworks.ugcSynchronizeItems([options, ] sync_dir, success_callback, [error_callback])
-
optionsObject-
app_idInteger: 将使用此工坊文件的游戏ID -
page_numInteger: 要接收结果的页码,第一次调用时应从1开始,每页最大50条数据
-
-
sync_dirString: 下载同步工坊文件的目录。 -
success_callbackFunction(items)-
itemsSteamUGCDetails创意工坊文件详细信息对象数组 -
isUpdatedBoolean: 是否在此函数调用的过程中更新文件
-
-
error_callbackFunction(err)
将用户的工坊文件 (UserUGCList.Subscribed, UserMatchingType.Items) 下载/同步到本地的 sync_dir 目录(仅当文件的上次更新时间与Steam Cloud不同或本地不存在工坊文件时才更新)。
16. 取消订阅
greenworks.ugcUnsubscribe(published_file_handle, success_callback, [error_callback])
-
published_file_handleString: 想要取消订阅的文件句柄(SteamUGCDetails.publishedFileId). -
success_callbackFunction() -
error_callbackFunction(err)
17. 显示工坊对话框
greenworks.ugcShowOverlay([published_file_id])
-
published_file_idString: 已发布文件的id
显示Steam工坊页面或指定工坊文件的Steam对话框。
18. 获取文件状态
greenworks.ugcGetItemState(published_file_id)
-
published_file_idString: 已发布文件的id
拉取指定工坊文件的 greenworks.UGCItemState 值。
19. 获取文件安装信息
greenworks.ugcGetItemInstallInfo(published_file_id)
-
published_file_idString: 已发布文件的id
如果工坊文件的状态包括 greenworks.UGCItemState.Installed,则拉取工坊文件的安装信息。 如果无法获取信息,则返回 undefined ;否则返回包含以下属性的 对象:
-
sizeOnDiskString: 返回创意工坊物品的字节大小 -
folderString: 硬盘上项目文件夹的绝对路径,如果状态为LegacyItem则指向文件本身 -
timestampInteger:返回工坊文件的上次更新的时间