AvatarEditorService

顯示已棄用項目

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

無法建立
服務
未複製

AvatarEditorService 是一個支援開發者虛擬角色編輯器的服務。它提供了修改玩家平台虛擬角色的方法,請求有關用戶的庫存資訊,以及請求有關目錄的資訊。

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

限制

以下 AvatarEditorService 的端點有體驗級別的限制:

對於每個體驗,此限制允許您每秒向這些 AvatarEditorService 端點發送最多 100 個請求,而不管服務器數量或用戶數量。超過這些限制將返回 429 請求過多 錯誤。

概要

方法

屬性

方法

CheckApplyDefaultClothing

暫停

返回一個更新了衫和褲子屬性的新的 HumanoidDescription(如果需要)。如果不需要預設服裝,則返回 nil

如果 HumanoidDescription 當前沒有配備衫和褲子且身體顏色太過相似,則需要預設服裝。

參數

humanoidDescription: HumanoidDescription

要檢查是否需要預設服裝的 HumanoidDescription。


返回

如果需要預設服裝,則返回 HumanoidDescription。否則返回 nil

ConformToAvatarRules

暫停

參數

humanoidDescription: HumanoidDescription

返回

GetAccessoryType

參數

avatarAssetType: Enum.AvatarAssetType

返回

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


返回

本地玩家是否已將給定的包或資產加入最愛。

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無限
CollectibleUGC 有限
LimitedRoblox 有限
LimitedUniqueRoblox 有限獨特

參數

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
}
]
名稱類型描述
idint
namestring
isEditableboolean

參數

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

具有與所提供的 assetType 匹配的類型的資產 ID,在檢索建議時用作上下文。

預設值:0

返回

基於給定的 Enum.AssetType 的推薦列表。

範例程式碼

這將返回一個類似帽子的列表,就像在網站的目錄頁面上查看類似資產時展示的那樣。contextAssetId 是可選的,如果未提供,將返回該類別的一些熱門商品。

獲取帽子推薦

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。

PromptAllowInventoryReadAccess

()

提示 Players.LocalPlayer 允許開發者閱讀用戶在庫存中的項目和其他與虛擬角色編輯器相關的資訊。用戶需要確認提示,開發者才能使用 AvatarEditorService:GetInventory(), AvatarEditorService:GetOutfits()AvatarEditorService:GetFavorite()。權限不會在會話之間持續。


返回

()

PromptCreateOutfit

()

提示 Players.LocalPlayer 將給定的 HumanoidDescription 保存為服裝。此操作不會暫停。可以通過監聽 AvatarEditorService.PromptCreateOutfitCompleted 事件來檢索結果。

參數

玩家將被提示創建的服裝。

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


返回

()

PromptDeleteOutfit

()

提示 Players.LocalPlayer 刪除給定的服裝。此操作不會暫停。可以通過監聽 AvatarEditorService.PromptDeleteOutfitCompleted 事件來檢索結果。

參數

outfitId: number

要刪除的服裝 ID。


返回

()

PromptRenameOutfit

()

提示 Players.LocalPlayer 重命名給定的服裝。此操作不會暫停。可以通過監聽 AvatarEditorService.PromptRenameOutfitCompleted 事件來檢索結果。

參數

outfitId: number

要重命名的服裝 ID。


返回

()

PromptSaveAvatar

()

此函數提示 Players.LocalPlayer 根據給定的 HumanoidDescriptionEnum.RigType (R6 或 R15) 更新其虛擬角色。此操作不會暫停,可以通過監聽 PromptSaveAvatarCompleted 事件來獲取結果。這類似於其他提示,例如 PromptPurchase 的工作方式。

參數

humanoidDescription: HumanoidDescription

要提示保存的 HumanoidDescription

如果玩家確認提示,則將為虛擬角色保存的 Enum.RigType


返回

()

PromptSetFavorite

()

此函數提示 Players.LocalPlayer 將給定的資產或包加入最愛或取消最愛。

參數

itemId: number

正在提示加入最愛的項目 ItemId。

正在提示加入最愛的項目類型。

shouldFavorite: boolean

返回

()

PromptUpdateOutfit

()

提示 Players.LocalPlayer 使用給定的 HumanoidDescription 更新給定的服裝。

參數

outfitId: number

要更新的服裝 ID。

updatedOutfit: HumanoidDescription

代表新服裝數據的 HumanoidDescription。

要更新到的 HumanoidRigType。


返回

()

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() 提示時觸發。它僅能返回 Success 或 PermissionDenied enum 狀態,因為它不會執行任何可能失敗的網路請求。

參數

提示的結果。


PromptCreateOutfitCompleted

此事件在 PromptSaveOutfit 操作完成時觸發。它給出了 enum 狀態,指示提示是否成功、失敗或用戶未授予權限。

參數

提示的結果。

failureType: Variant

PromptDeleteOutfitCompleted

當 PromptDeleteOutfit 操作完成時觸發。它給出了 enum 狀態,指示提示是否成功、失敗或用戶未授予權限。

參數

提示的結果。


PromptRenameOutfitCompleted

當 PromptRenameOutfit 操作完成時觸發。它給出了 enum 狀態,指示提示是否成功、失敗或用戶未授予權限。

參數

提示的結果。


PromptSaveAvatarCompleted

此事件在 AvatarEditorService:PromptSaveAvatar() 操作完成時觸發。給出了 enum 狀態,指示提示是否成功、失敗或用戶未授予權限。

參數

提示的結果。

humanoidDescription: HumanoidDescription

PromptSetFavoriteCompleted

AvatarEditorService:PromptSetFavorite() 操作完成時觸發。它給出了 enum 狀態,指示提示是否成功、失敗或用戶未授予權限。

參數

提示的結果。


PromptUpdateOutfitCompleted

AvatarEditorService:PromptUpdateOutfit() 操作完成時觸發。它給出了 enum 狀態,指示提示是否成功、失敗或用戶未授予權限。

參數

提示的結果。