AvatarEditorService

显示已弃用

*此内容使用人工智能(Beta)翻译,可能包含错误。若要查看英文页面,请点按 此处

无法创建
服务
未复制

AvatarEditorService 是一个服务来支持开发者虚拟形象编辑器。它提供方法来修改玩家的平台虚拟形象、请求信息关于用户的道具、并请求信息关于目录。

有关虚拟形象编辑器的更多信息,请参阅虚拟形象编辑器服务

节流阀

AvatarEditorService 上的以下端口有经验级别的限制:

对于每个体验,这个限制可以让您每秒发送最多 100 个请求到这些 AvatarEditorService 端点,无论是服务器数量或用户数量。超过这些限制会返回一个 429 Too Many Requests 错误。

如果您发现您的体验需要调整此限制,您可以提交一个 功能请求

概要

方法

属性

方法

GetAccessoryType

参数

avatarAssetType: Enum.AvatarAssetType

返回

PromptAllowInventoryReadAccess

void

提示 Players.LocalPlayer 允许开发人员读取用户在其库存和其他虚拟形象编辑器相关信息。提示需要由用户确认才能使用 AvatarEditorService:GetInventory()AvatarEditorService:GetOutfits() 和 <


返回

void

PromptCreateOutfit

void

提示 Players.LocalPlayer 保存给定的 HumanoidDescription 作为服装。不会生成。结果可以通过听取 AvatarEditorService.PromptCreateOutfitCompleted 事件来获取。

参数

玩家将被提示创建的Outfit

枚列表.RigType 是服装将被创建的 if 玩家确认提示。


返回

void

PromptDeleteOutfit

void

提示 Players.LocalPlayer 删除所提供的服装。不会产生。结果可以通过听取 AvatarEditorService.PromptDeleteOutfitCompleted 事件来恢复。

参数

outfitId: number

服装的服装ID。


返回

void

PromptRenameOutfit

void

提示 Players.LocalPlayer 重命名所指定的服装。不会产生。结果可以通过听取 AvatarEditorService.PromptRenameOutfitCompleted 事件来获取。

参数

outfitId: number

服装的服装ID。


返回

void

PromptSaveAvatar

void

此函数提示 Players.LocalPlayer 更新他们的头像,根据所提供的 HumanoidDescriptionEnum.RigType (R6 或 R15) 来更新他们的头像。不会生成结果,可以通过听取提示保存头像完成后获得。这与其他提示,例如提示购买工作的方

参数

humanoidDescription: HumanoidDescription

提示保存HumanoidDescription

头像确认提示后,玩家将保存的Enum.RigType


返回

void

PromptSetFavorite

void

此功能提示 Players.LocalPlayer 收藏或取消收藏指定资产或套装。

参数

itemId: number

提示的物品I设为“最爱” 的物品。

要求提升到设为“最爱”藏的物品类型。

shouldFavorite: bool

返回

void

PromptUpdateOutfit

void

提示 Players.LocalPlayer 更新所提供的服装以反映所提供的人形描述。

参数

outfitId: number

服装的outfitId更新。

updatedOutfit: HumanoidDescription

一个人形描述,用于表示新的服装数据。

人形RigType 更新服装。


返回

void

CheckApplyDefaultClothing

暂停

如果需要,会更新 Shirt 和 Pants 属性,以反映 Shirt 和 Pants 的更新。如果不需要,则返回 nil 。

默认服装是否有人形描述尚未装备上衣和裤子,以及身体颜色过于相似,否则。

参数

humanoidDescription: HumanoidDescription

人形描述检查是否需要默认服装。


返回

如果需要默认服装,返回一个人形描述。否则返回零。

ConformToAvatarRules

暂停

参数

humanoidDescription: HumanoidDescription

返回

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 更有效率,如果您需要获取列表中的所有项目详情。

参数

itemIds: Array

获取详细信息的物品 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 已经收藏了指定的包裹或资产。

参数

itemId: number

指定资产或包套装的 id。

指定资产或套装的 Enum.AvatarItemType


返回

LocalPlayer 是否收藏了提供的包裹或资产。

GetInventory

暂停

返回一个 InventoryPages 对象,包含用户存储的用户拥有物品的信息。用户存储的用户拥有物品为 AvatarAssetTypes

返回的表包括以下字段:


[
{
"AssetId": 0,
"AssetType" : "string",
"Created": "string",
"Name": "string",
}
]

参数

assetTypes: Array

枚数.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 | Unlimited | | Collectible | UGC Limited | | Limited | Roblox Limited Unique |

参数

itemId: number

正在检索其详细信息的物品的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
},
}

参数

outfitId: number

正在检索详细信息的服装ID。


返回

包含从回收的服装信息的表。见上面的示例表。

GetOutfits

暂停

此函数为 Players.LocalPlayer 返回装扮数据。这将与 Players:GetHumanoidDescriptionFromOutfitId() 使用,用于更新玩家角色到装扮。与此相关的权限也取决于 AvatarEditorService:PromptAllowInventoryReadAccess() 被接受用户。

返回的表包括以下字段:


[
{
"Id": 0,
"Name": "string",
"IsEditable": true
}
]

<tbody>
<tr>
<td>身份证</td>
<td>int</td>
<td />
</tr>
<tr>
<td>名称</td>
<td>字符串</td>
<td />
</tr>
<tr>
<td>可编辑</td>
<td>boolean</td>
<td />
</tr>
</tbody>
名称类输入描述

参数

outfitSource: Enum.OutfitSource
默认值:"All"
outfitType: Enum.OutfitType
默认值:"All"

返回

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: number

一个资产的 id 与提交建议时使用的资产类型匹配。

默认值:0

返回

一个基于给出的 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.

Getting a Hat Recommendation

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
}
}
}
]

参数

bundleId: number

一列推荐的包裹。


返回

将返回指定的礼包 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
}
]

参数

searchParameters: CatalogSearchParams

一个包含搜索参数的对象。


返回

活动

PromptAllowInventoryReadAccessCompleted

AvatarEditorService:PromptAllowInventoryReadAccess() 提示被用户回应时,此事件会触发。它只能返回成功或权限被拒绝的 enum 状态,因为它不会执行任何可能导致失败的网络请求。

参数

提示的结果。


PromptCreateOutfitCompleted

此事件发生在提示保存服装操作完成后。它给出一个状态 enum 表示是否成功、失败或被用户授权。

参数

提示的结果。

failureType: Variant

PromptDeleteOutfitCompleted

提示删除服装操作完成时触发。它给出一个状态 enum 表示是否成功、是否失败或是否被用户授权。

参数

提示的结果。


PromptRenameOutfitCompleted

提示重命名服装操作完成时触发。它给出一个状态 enum 表示是否成功、是否失败或是否被用户授权。

参数

提示的结果。


PromptSaveAvatarCompleted

这个事件发生 when the AvatarEditorService:PromptSaveAvatar() 操作完成时。它给出一个状态 enum 表示是否成功、失败或被用户授权。

参数

提示的结果。

humanoidDescription: HumanoidDescription

PromptSetFavoriteCompleted

触发Class.AvatarEditorService:PromptSetFavorite()操作完成时。它给出一个状态enum,表示是否成功、失败或由用户授权。

参数

提示的结果。


PromptUpdateOutfitCompleted

触发Class.AvatarEditorService:PromptUpdateOutfit()操作完成时。它给出一个状态enum,表示是否成功、是否失败或是否被用户授权。

参数

提示的结果。