AvatarEditorService

顯示已棄用項目

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

無法建立
服務
未複製

AvatarEditorService 是一個服務來支援開發者的虛擬人偶編輯器。它提供方法來修改玩家的平台虛擬人偶,請求對用戶的道具欄資訊,並請求目錄資訊。

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

Throttling

AvatarEditorService 上的下列端口有經驗級限制:

對於每個體驗,這個限制可以發送每秒最多 100 個請求到這些 AvatarEditorService 端點,無論是服務器數量或用戶數量。超過這些限制會返回一個 429 Too Many Requests 錯誤。

如果您發現您的體驗需要這個限制,您可以提交一個 功能請求

概要

方法

屬性

方法

GetAccessoryType

參數

avatarAssetType: Enum.AvatarAssetType

返回

PromptAllowInventoryReadAccess

void

提示 Players.LocalPlayer 以允許開發人員閱取使用者的道具欄和其他虛擬人偶編輯器相關資訊。提示需要由使用者確認才能使用 AvatarEditorService:GetInventory()


返回

void

PromptCreateOutfit

void

提示 Players.LocalPlayer 儲存所提供的 HumanoidDescription 作為服裝。不會產生。結果可以通過聆聽 AvatarEditorService.PromptCreateOutfitCompleted 事件來取回。

參數

玩家將被提示建立的 Outfit

枚號 型錄 是指服裝將在玩家確認提示後創建。


返回

void

PromptDeleteOutfit

void

提示 Players.LocalPlayer 刪除所提供的服裝。不會產生。結果可以通過聆聽 AvatarEditorService.PromptDeleteOutfitCompleted 事件來取回。

參數

outfitId: number

服裝的服裝ID。


返回

void

PromptRenameOutfit

void

提示 Players.LocalPlayer 重新命名所提供的服裝。 不會產生。 結果可以通過聆聽 AvatarEditorService.PromptRenameOutfitCompleted 事件來取回。

參數

outfitId: number

服裝的 outfitId 要重新命名。


返回

void

PromptSaveAvatar

void

此功能提示 Players.LocalPlayer 更新他們的虛擬人偶基於所提供的 HumanoidDescriptionEnum.RigType (R6 或 R15)。不會產生結果並且可以通過聆聽提示儲存完成事件來取得結果。這與其他提示,

參數

humanoidDescription: HumanoidDescription

正在提示您儲存 HumanoidDescription

玩家確認提示時,虛擬人偶會儲存的 Enum.RigType


返回

void

PromptSetFavorite

void

此功能提示 Players.LocalPlayer 要喜歡或取消喜歡指定資產或組合包。

參數

itemId: number

要求您喜歡的項目的 ItemId。

要求類型的設為最愛目。

shouldFavorite: bool

返回

void

PromptUpdateOutfit

void

提示 Players.LocalPlayer 更新指定服裝以反映指定人形描述。

參數

outfitId: number

服裝的 outfitId 以更新。

updatedOutfit: HumanoidDescription

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

人形RigType 以更新服裝。


返回

void

CheckApplyDefaultClothing

暫停

如有必要,會返回新的 HumanoidDescription 以 Shirt 和 Pants 屬性更新。如果沒有預設服裝,則會返回零。

如果人形描述沒有上衣和褲子,則需要預設服裝,因為身體顏色太相似。

參數

humanoidDescription: HumanoidDescription

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


返回

如果需要預設服裝,則返回人形描述。否則返回零。

ConformToAvatarRules

暫停

參數

humanoidDescription: HumanoidDescription

返回

GetAvatarRules

暫停

此功能返回平台 Avatar 規則,例如縮放、預設上衣和褲子、可穿戴的資產數量等。

返回的表包括以下字段:


{
"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 個對象,包含用戶存取用戶道具欄中所有擁有物品的資訊。

返回的表包括以下字段:


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

參數

assetTypes: Array

玩家的道具欄中可以檢查到的 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 無限 | | 1> LimitedUnique1> | Roblox 無限 | | 4> Collectible

參數

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

此事件發生當 Class.AvatarEditorService:PromptSaveAvatar() 操作完成時。它讓狀態 Ennum.AvatarPromptResult|enuム 指示是否成功、失敗或沒有給予權限給予用戶。

參數

提示的結果。

humanoidDescription: HumanoidDescription

PromptSetFavoriteCompleted

在 Class.AvatarEditorService:PromptSetFavorite() 操作完成時發射。它會提供狀態 Ennum.AvatarPromptResult|enuム,表示是否成功、失敗或沒有給予權限。

參數

提示的結果。


PromptUpdateOutfitCompleted

AvatarEditorService:PromptUpdateOutfit() 操作完成時發射。它讓狀態 enum 表示是否成功、失敗或沒有給予權限。

參數

提示的結果。