概要
方法
提示 Players.LocalPlayer 允许开发者阅读用户在库存和其他虚拟形象编辑器中的物品以及相关信息。
提示 Players.LocalPlayer 保存给定的 HumanoidDescription 为服装。
提示 Players.LocalPlayer 删除指定的服装。
提示 Players.LocalPlayer 重命名给定的服装。
提示 Players.LocalPlayer 根据给定的 HumanoidDescription 和 Enum.RigType 的 R6 或 R15 更新他们的虚拟形象。
提示 Players.LocalPlayer 收藏或取消收藏指定的资产或套装。
- PromptUpdateOutfit(outfitId : number,updatedOutfit : HumanoidDescription,rigType : Enum.HumanoidRigType):()
提示 Players.LocalPlayer 更新给定的服装。
如果需要,用于将默认服装应用到 HumanoidDescription 。
返回平台虚拟形象规则,例如缩放、默认衬衫和裤子数量、可穿戴资产数量。
一次获取列表中的物品的详细信息。
返回如果 Players.LocalPlayer 收藏了给定的包或素材。
返回一个 InventoryPages 对象,其中包含用户库存中拥有的物品信息,以指定的虚拟形象资产类型。
返回给定项目的物品详情。
返回给定服装的服装详情。
返回服装数据给 Players.LocalPlayer。
返回一个列表推荐的资产,基于给定的 Enum.AssetType 和资产ID。
返回给定包裹 ID 的推荐包列表。
返回包含给定搜索结果的 CatalogPages 对象。
活动
当用户回应 AvatarEditorService:PromptAllowInventoryReadAccess() 提示时发生火焰。
当提示保存服装操作完成时发生火灾。
当提示删除服装操作完成时发生火灾。
当提示重命名服装操作完成时发生火灾。
- PromptSaveAvatarCompleted(result : Enum.AvatarPromptResult,humanoidDescription : HumanoidDescription):RBXScriptSignal
当 AvatarEditorService:PromptSaveAvatar() 操作完成时发生火灾。
当 AvatarEditorService:PromptSetFavorite() 操作完成时发生火灾。
当 AvatarEditorService:PromptUpdateOutfit() 操作完成时发生火灾。
属性
方法
PromptAllowInventoryReadAccess
提示 Players.LocalPlayer 允许开发者阅读用户在库存和其他虚拟形象编辑器中的物品以及相关信息。提示需要由用户确认,以便开发者使用 AvatarEditorService:GetInventory()、AvatarEditorService:GetOutfits() 和 AvatarEditorService:GetFavorite()。权限在会话之间不会持续。
返回
PromptCreateOutfit
提示 Players.LocalPlayer 保存给定的 HumanoidDescription 为服装。不会产生。结果可以通过收听 AvatarEditorService.PromptCreateOutfitCompleted 事件来检索。
参数
玩家将被提示创建的 Outfit。
玩家确认提示时将为服装创建的 Enum.RigType 。
返回
PromptDeleteOutfit
提示 Players.LocalPlayer 删除指定的服装。不会产生。结果可以通过收听 AvatarEditorService.PromptDeleteOutfitCompleted 事件来检索。
参数
要删除的服装的 id。
返回
PromptRenameOutfit
提示 Players.LocalPlayer 重命名给定的服装。不会产生。结果可以通过听到 AvatarEditorService.PromptRenameOutfitCompleted 事件来检索。
参数
服装的outfitId用于重命名服装。
返回
PromptSaveAvatar
这个函数提示 Players.LocalPlayer 更新他们的虚拟形象,基于给定的 HumanoidDescription 和 Enum.RigType (R6 或 R15)。不会产生并且可以通过收听 PromptSaveAvatarCompleted 事件来获得结果。这与其他提示,例如提示购买,的工作方式相似。
参数
给出的 HumanoidDescription 被要求保存。
如果玩家确认提示,虚拟形象将被保存的 Enum.RigType 。
返回
PromptSetFavorite
该函数提示 Players.LocalPlayer 将指定的资产或套装添加到收藏或取消收藏。
参数
被要求收设为“最爱”的物品的 ItemId。
被要求收设为“最爱”的物品类型。
返回
PromptUpdateOutfit
提示 Players.LocalPlayer 更新给定的服装,使其具有给定的人形描述。
参数
要更新的服装的 id。
一个代表新服装数据的人形描述。
HumanoidRigType用于更新服装。
返回
CheckApplyDefaultClothing
返回一个新的 HumanoidDescription ,包括更新的衬衫和裤子属性,如果需要的话。返回 nil 如果默认服装不需要。
如果 HumanoidDescription 目前没有配备衬衫和裤子,身体颜色太相似,默认服装是必需的。
参数
用于检查是否需要默认服装的 HumanoidDescription。
返回
如果默认服装是必要的,返回 HumanoidDescription;否则返回 nil 。
ConformToAvatarRules
参数
返回
GetAvatarRules
该函数返回平台虚拟形象规则,例如缩放、默认衬衫和裤子、可穿戴资产数量等。
返回的表包括以下字段:
{"PlayerAvatarTypes": ["R6"],"Scales": {},"WearableAssetTypes": [{"MaxNumber": 0,"Id": 0,"Name": "string"}],"BodyColorsPalette": [{"BrickColorId": 0,"NexColor": "string","Name": "string"}],"BasicBodyColorsPalette": [{"BrickColorId": 0,"HexColor": "string","Name": "string"}],"MinimumDeltaEBodyColorDifference": 0,"ProportionsAndBodyTypeEnabledForUser": true,"DefaultClothingAssetLists": {"DefaultShirtAssetIds": [0],"DefaultPantAssetIds": [0]},"BundlesEnabledForUser": true,"EmotesEnabledForUser": true}
返回
包含平台虚拟形象规则的词典,例如缩放、默认衬衫和裤子、可穿戴资产数量等。请参阅上面的主要描述中的示例返回。
GetBatchItemDetails
一次获取列表中的物品的详细信息。比 AvatarEditorService:GetItemDetails 更高效,如果你需要获取列表中所有物品的详细信息。
参数
获取详细信息的物品ID列表。
提供的物品ID类型。
返回
返回一个包含以下字段的物品详细信息阵列:
{"AssetType" = "string","CreatorName" = "string","CreatorTargetId" = 0,"CreatorType" = "string","Description" = "string","FavoriteCount" = 0,"Genres" = ["All"],"Id" = 0,"ItemRestrictions" = ["Limited"],"ItemStatus": ["New"],"ItemType" = "string","LowestPrice" = 0,"Name" = "string","Price" = 0,"ProductId" = 0}
.
GetFavorite
此函数返回是否 Players.LocalPlayer 收到了指定的包或素材的偏好。
参数
指定资产或套装的 ID。
指定资产或套装的 Enum.AvatarItemType 。
返回
无论 LocalPlayer 是否收藏了给定的包或素材。
GetInventory
返回一个 InventoryPages 对象,其中包含用户库存中拥有的物品信息,用给定的 AvatarAssetTypes 。
返回的表包括以下字段:
[{"AssetId": 0,"AssetType" : "string","Created": "string","Name": "string",}]
参数
可以在玩家的道具中检查的 Enum.AvatarAssetType 。
返回
GetItemDetails
该函数返回给定项目的物品详情。它接受两个参数 - 第一个表示正在检索的项目ID,第二个表示其Enum.ItemType。
数据返回到格式:
{"IsForRent": true,"ExpectedSellerId": 0,"Owned": true,"IsPurchasable": true,"Id": 0,"ItemType": "Asset","AssetType": "Image","BundleType": "BodyParts","Name": "string","Description": "string","ProductId": 0,"Genres": ["All"],"BundledItems": [{"Owned": true,"Id": 0,"Name": "string","Type": "string"}],"ItemStatus": ["New"],"ItemRestrictions": ["ThirteenPlus"],"CreatorType": "User","CreatorTargetId": 0,"CreatorName": "string","Price": 0,"PremiumPricing": {"PremiumDiscountPercentage": 0,"PremiumPriceInRobux": 0},"LowestPrice": 0,"PriceStatus": "string","UnitsAvailableForConsumption": 0,"PurchaseCount": 0,"FavoriteCount": 0}
要查询有限或无限资产,请使用以下 itemRestrictions 值:
| itemRestrictions | 有限或无限 | | :--------------: | :-------------------: | | empty | 无限制 | | Collectible | 限于 UGC 有限 | | Limited | Roblox 限制唯一 | | LimitedUnique | Roblox 限制无限 |
参数
被检索的物品的ID。
指示正在获取详情的物品类型的枚值。
返回
包含回收的物品目信息的表。请参阅上面的示例表。
GetOutfitDetails
该函数返回给定服装的服装详情。它接受一个参数:服装ID。
数据返回以下格式:
{"Assets": [{"AssetType": {"Id": 31,"Name": "RightLeg"}"CurrentVersionId": 16447385805,"Id": 11584239464,"Name": "Anime Female - Right Leg"}],"BodyColors": {"HeadColor": Color3(204, 142, 105),"LeftArmColor": Color3(204, 142, 105),"LeftLegColor": Color3(204, 142, 105),"RightArmColor": Color3(204, 142, 105),"RightLegColor": Color3(204, 142, 105),"TorsoColor": Color3(204, 142, 105)},"Id": 14703770624,"IsEditable": true,"Name": "Your Costume","OutfitType": "Avatar","PlayerAvatarType": "R15","Scale": {"BodyType": 0,"Depth": 1,"Head": 1,"Height": 1,"Proportion": 0,"Width": 1},}
参数
被检索的服装详情的ID。
返回
包含回收的服装信息的表。请参阅上面的示例表。
GetOutfits
此函数返回服装数据给 Players.LocalPlayer。这将与 Players:GetHumanoidDescriptionFromOutfitId() 一起用于更新玩家角色到服装。访问此功能还取决于用户接受了 AvatarEditorService:PromptAllowInventoryReadAccess()。
返回的表包括以下字段:
[{"Id": 0,"Name": "string","IsEditable": true}]
<th>类输入</th><th>描述</th></tr></thead><tbody><tr><td>id</td><td>int</td><td /></tr><tr><td>名称</td><td>字符串</td><td /></tr><tr><td>可编辑</td><td>boolean</td><td /></tr></tbody>
名称 |
---|
参数
返回
GetRecommendedAssets
返回一个列表推荐的资产,基于给定的 Enum.AssetType 和资产ID。使用此来收集与提供的资产类似的资产列表。查看下面的代码示例以获取有关此函数的可能用途的更多信息。
数据以下格式:
[{"Item": {"AssetId": 0,"Name": "string","Price": 0,"PremiumPrice": 0,},"Creator": {"CreatorId": 0,"CreatorType": "string","Name": "string",},"Product": {"Id": 0,"PriceInRobux": 0,"IsForSale": true,"IsResellable": true,"IsLimited": true,"IsLimitedUnique": true,"TotalPrivateSales": 0,"OffsaleDeadline": "string","IsFree": true}}]
参数
要检索建议的资产类型。仅影响响应,当项目基于推荐不存在给定的 contextAssetId 时。
具有与提供的资产类型匹配的资产ID的资产,用于在检索建议时的上下文。
返回
基于给定的 Enum.AssetType 的建议列表。
代码示例
This will return a list of similar hats much like how similar assets are displayed when viewing the catalog page on the website. The contextAssetId is optional and if not provided it will return some popular items from that category.
local AvatarEditorService = game:GetService("AvatarEditorService")
local assets = AvatarEditorService:GetRecommendedAssets(Enum.AvatarAssetType.Hat, 9255093)
for _, asset in ipairs(assets) do
print(asset.Item.Name)
end
GetRecommendedBundles
该函数返回给定包 ID 的推荐包列表。
数据以下格式:
[{"Id": 0,"Name": "string","Description": "string","BundleType": "string","Items": [{"Owned": true,"Id": 0,"Name": "string","Type": "string"}],"Creator": {"Id": 0,"Name": "string","Type": "string"},"Product": {"Id": 0,"Type": "string","IsPublicDomain": true,"IsForSale": true,"PriceInRobux": 0,"PremiumPricing": {"PremiumDiscountPercentage": 0,"PremiumPriceInRobux": 0}}}]
参数
一列推荐的包裹列表。
返回
建议的包将返回的包 ID。
SearchCatalog
该函数返回包含给定搜索结果的 CatalogPages 对象。
返回的数据有格式:
[{"Id": 0,"ItemType": "Asset","AssetType": "Image","BundleType": "BodyParts","Name": "string","Description": "string","ProductId": 0,"Genres": ["All"],"BundledItems": [{"Owned": true,"Id": 0,"Name": "string","Type": "string"}],"ItemStatus": ["New"],"ItemRestrictions": ["ThirteenPlus"],"CreatorType": "User","CreatorTargetId": 0,"CreatorName": "string","Price": 0,"PremiumPricing": {"PremiumDiscountPercentage": 0,"PremiumPriceInRobux": 0},"LowestPrice": 0,"PriceStatus": "string","UnitsAvailableForConsumption": 0,"PurchaseCount": 0,"FavoriteCount": 0}]
参数
包含搜索使用的参数的对象。
返回
活动
PromptAllowInventoryReadAccessCompleted
当用户回应 AvatarEditorService:PromptAllowInventoryReadAccess() 提示时,此事件发生。它只能返回成功或拒绝权限enum状态,因为它不会执行任何可能失败的网络请求。
参数
提示的结果。
PromptCreateOutfitCompleted
此事件在提示保存服装操作完成时发生。它提供一个状态 enum 指示用户是否成功、失败或未获得权限。
参数
提示的结果。
PromptSaveAvatarCompleted
此事件在 AvatarEditorService:PromptSaveAvatar() 操作完成时触发。它提供一个状态 enum ,表示提示是否成功、失败或用户没有授予权限。
参数
提示的结果。
PromptSetFavoriteCompleted
当 AvatarEditorService:PromptSetFavorite() 操作完成时发生火灾。它提供一个状态 enum ,表示提示是否成功、失败或用户没有授予权限。
参数
提示的结果。
PromptUpdateOutfitCompleted
当 AvatarEditorService:PromptUpdateOutfit() 操作完成时发生火灾。它提供一个状态 enum ,表示提示是否成功、失败或用户没有授予权限。
参数
提示的结果。