AvatarEditorService

顯示已棄用項目

*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡

無法建立
服務
未複製

AvatarEditorService 是支持開發者虛擬人偶編輯器的服務。它提供方法來修改玩家的平台頭像、請求使用者的庫存資訊,以及請求目錄資訊。

有關虛擬人偶編輯器的更多資訊,請參閱虛擬人偶編輯器服務

限制速度

下列在 AvatarEditorService 上的終端點有經驗等級限制:

對於每個體驗,此限制允許您每秒發送最多 100 個請求到這些 AvatarEditorService 終端點,無論是服務器數量或使用者數量。超出這些限制會返回 429 Too Many Requests 錯誤。

如果您發現您的體驗需要調整此限制,您可以提交 功能請求

概要

方法

屬性

方法

GetAccessoryType

參數

avatarAssetType: Enum.AvatarAssetType
預設值:""

返回

PromptAllowInventoryReadAccess

()

提示 Players.LocalPlayer 允許開發人員閱讀使用者在庫存中和其他虛擬人偶編輯器相關資訊的物品。提示需要由用戶確認,以便開發人員使用 AvatarEditorService:GetInventory()AvatarEditorService:GetOutfits()AvatarEditorService:GetFavorite()。許可在會話之間不會持續。


返回

()

PromptCreateOutfit

()

提示 Players.LocalPlayer 將給定的 HumanoidDescription 儲存為服裝。不會產生。結果可以通過聆聽 AvatarEditorService.PromptCreateOutfitCompleted 事件來恢復。

參數

玩家將被要求創建的 Outfit

預設值:""

如果玩家確認提示,服裝將為其創建的 Enum.RigType

預設值:""

返回

()

PromptDeleteOutfit

()

提示 Players.LocalPlayer 刪除指定服裝。不會產生。結果可以通過聆聽 AvatarEditorService.PromptDeleteOutfitCompleted 事件來恢復。

參數

outfitId: number

要刪除的服裝ID。

預設值:""

返回

()

PromptRenameOutfit

()

提示 Players.LocalPlayer 重命名指定服裝。不會產生。結果可以通過聆聽 AvatarEditorService.PromptRenameOutfitCompleted 事件來恢復。

參數

outfitId: number

要重命名的服裝的outfitId。

預設值:""

返回

()

PromptSaveAvatar

()

此功能會提示 Players.LocalPlayer 更新他們的虛擬人偶,以基於指定的 HumanoidDescriptionEnum.RigType (R6 或 R15) 來更新。不會產生並可以聆聽「提示儲存虛擬人偶完成」事件來獲得結果。這與其他提示,例如「提醒購買」的工作方式相似。

參數

humanoidDescription: HumanoidDescription

指定的 HumanoidDescription 正在被提示儲存。

預設值:""

如果玩家確認提示,則將儲存給虛擬人偶的 Enum.RigType

預設值:""

返回

()

PromptSetFavorite

()

此功能會提示 Players.LocalPlayer 將給定的資產或組合包設為最愛或最不喜歡。

參數

itemId: number

被要求加入收藏的項目的項目ID。

預設值:""

被要求加入收藏的項目類型。

預設值:""
shouldFavorite: boolean
預設值:""

返回

()

PromptUpdateOutfit

()

提示 Players.LocalPlayer 更新給定的服裝,使用給定的人形描述。

參數

outfitId: number

要更新的服裝ID。

預設值:""
updatedOutfit: HumanoidDescription

代表新服裝資料的人形描述。

預設值:""

HumanoidRigType用於更新服裝。

預設值:""

返回

()

CheckApplyDefaultClothing

暫停

返回新的 HumanoidDescription 與襯衫和褲子屬性更新,如有需要。返回 nil 如果預設服裝不需要。

如果人形描述目前沒有配備襯衫和褲子,並且身體顏色過於相似,預設服裝是必要的。

參數

humanoidDescription: HumanoidDescription

人形描述來檢查是否需要預設服裝。

預設值:""

返回

如果預設服裝是必要的,返回 HumanoidDescription;否則返回 nil

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

指定資產或組合的識別符。

預設值:""

指定資產或組合的 Enum.AvatarItemType

預設值:""

返回

無論 LocalPlayer 是否喜歡給定的包或資產。

GetInventory

暫停

返回 InventoryPages 一個具有給定 AvatarAssetTypes 的用戶庫存中擁有物品資訊的對象。

返回的表包括以下欄位:


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

參數

assetTypes: Array

可以在玩家的庫存中檢查的 Enum.AvatarAssetType

預設值:""

返回

GetItemDetails

暫停

此功能返回指定項目的項目詳情。它接受兩個參數 - 第一個指示正在擷取的項目ID,第二個指示其Enum.AvatarItemType

數據以下列格式返回:


{
"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 有限獨家 |

參數

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

<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>
名稱

參數

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 時的回應。

預設值:""
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

此事件在 AvatarEditorService:PromptSaveAvatar() 操作完成時發生。它會提供狀態 enum 指示是否提示成功、失敗或未由使用者授予許可。

參數

提示的結果。

humanoidDescription: HumanoidDescription

PromptSetFavoriteCompleted

AvatarEditorService:PromptSetFavorite()完成時發生火災。它會提供狀態 enum 指示是否提示成功、失敗或未由使用者授予許可。

參數

提示的結果。


PromptUpdateOutfitCompleted

AvatarEditorService:PromptUpdateOutfit()完成時發生火災。它會提供狀態 enum 指示是否提示成功、失敗或未由使用者授予許可。

參數

提示的結果。