概要
方法
提示 Players.LocalPlayer 允許開發人員閱讀使用者在庫存中和其他虛擬人偶編輯器相關資訊的物品。
提示 Players.LocalPlayer 儲存指定的 HumanoidDescription 作為服裝。
提示 Players.LocalPlayer 刪除指定的服裝。
提示 Players.LocalPlayer 重命名指定服裝。
提示 Players.LocalPlayer 更新他們的虛擬人偶,以 R6 或 R15 的給定 HumanoidDescription 和 Enum.RigType 進行更新。
提示 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) 來更新。不會產生並可以聆聽「提示儲存虛擬人偶完成」事件來獲得結果。這與其他提示,例如「提醒購買」的工作方式相似。
參數
指定的 HumanoidDescription 正在被提示儲存。
如果玩家確認提示,則將儲存給虛擬人偶的 Enum.RigType 。
返回
PromptSetFavorite
此功能會提示 Players.LocalPlayer 將給定的資產或組合包設為最愛或最不喜歡。
參數
被要求加入收藏的項目的項目ID。
被要求加入收藏的項目類型。
返回
PromptUpdateOutfit
提示 Players.LocalPlayer 更新給定的服裝,使用給定的人形描述。
參數
要更新的服裝ID。
代表新服裝資料的人形描述。
HumanoidRigType用於更新服裝。
返回
CheckApplyDefaultClothing
返回新的 HumanoidDescription 與襯衫和褲子屬性更新,如有需要。返回 nil 如果預設服裝不需要。
如果人形描述目前沒有配備襯衫和褲子,並且身體顏色過於相似,預設服裝是必要的。
參數
人形描述來檢查是否需要預設服裝。
返回
如果預設服裝是必要的,返回 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 已將指定的包或資產設為偏好。
參數
指定資產或組合的識別符。
指定資產或組合的 Enum.AvatarItemType 。
返回
無論 LocalPlayer 是否喜歡給定的包或資產。
GetInventory
返回 InventoryPages 一個具有給定 AvatarAssetTypes 的用戶庫存中擁有物品資訊的對象。
返回的表包括以下欄位:
[{"AssetId": 0,"AssetType" : "string","Created": "string","Name": "string",}]
參數
可以在玩家的庫存中檢查的 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 有限獨家 |
參數
被擷取詳情的項目的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 指示是否提示成功、失敗或未由使用者授予許可。
參數
提示的結果。