概要
方法
活動
PromptCreateOutfitCompleted(result: Enum.AvatarPromptResult,failureType: Variant):RBXScriptSignal |
PromptSaveAvatarCompleted(result: Enum.AvatarPromptResult,humanoidDescription: HumanoidDescription):RBXScriptSignal |
API 參考
方法
CheckApplyDefaultClothing
CheckApplyDefaultClothingAsync
AvatarEditorService:CheckApplyDefaultClothingAsync(humanoidDescription:HumanoidDescription):HumanoidDescription
參數
ConformToAvatarRules
ConformToAvatarRulesAsync
AvatarEditorService:ConformToAvatarRulesAsync(humanoidDescription:HumanoidDescription):HumanoidDescription
參數
GetAccessoryType
參數
GetAvatarRules
GetBatchItemDetails
GetBatchItemDetailsAsync
參數
返回
GetBundlesByAssetIdAsync
GetFavorite
GetFavoriteAsync
參數
返回
GetHeadShapesAsync
返回
範例程式碼
獲取擁有的頭型
TEST
local AvatarEditorService = game:GetService("AvatarEditorService")
AvatarEditorService:PromptAllowInventoryReadAccess()
local result = AvatarEditorService.PromptAllowInventoryReadAccessCompleted:Wait()
if result == Enum.AvatarPromptResult.Success then
local shapes = AvatarEditorService:GetHeadShapesAsync()
for i, shape in ipairs(shapes) do
print(i, shape)
end
endGetInventory
GetInventoryAsync
參數
範例程式碼
尋找即將過期的物品
local AvatarEditorService = game:GetService("AvatarEditorService")
local pages = AvatarEditorService:GetInventoryAsync({ Enum.AvatarAssetType.Hat })
local currentPage = pages:GetCurrentPage()
for _, item in currentPage do
if item.ExpirationTime then
local secondsLeft = item.ExpirationTime.UnixTimestamp - DateTime.now().UnixTimestamp
local hoursLeft = math.floor(secondsLeft / 3600)
if hoursLeft < 24 then
warn(string.format("%s 在 %d 小時內過期", item.Name, hoursLeft))
end
end
endGetItemDetails
GetItemDetailsAsync
參數
範例程式碼
檢查物品過期
local AvatarEditorService = game:GetService("AvatarEditorService")
local details = AvatarEditorService:GetItemDetailsAsync(105589844216517, Enum.AvatarItemType.Asset)
if details.ExpirationTime then
local secondsLeft = details.ExpirationTime.UnixTimestamp - DateTime.now().UnixTimestamp
local hoursLeft = math.floor(secondsLeft / 3600)
if hoursLeft < 24 then
warn(details.Name .. " 在24小時內過期!")
end
endGetOutfitDetails
GetOutfitDetailsAsync
GetOutfits
GetOutfitsAsync
AvatarEditorService:GetOutfitsAsync(
參數
| 預設值:"All" |
| 預設值:"All" |
GetRecommendedAssets
GetRecommendedAssetsAsync
AvatarEditorService:GetRecommendedAssetsAsync(
參數
| 預設值:0 |
返回
範例程式碼
獲取帽子推薦
local AvatarEditorService = game:GetService("AvatarEditorService")
local assets = AvatarEditorService:GetRecommendedAssetsAsync(Enum.AvatarAssetType.Hat, 9255093)
for _, asset in ipairs(assets) do
print(asset.Item.Name)
endGetRecommendedBundles
GetRecommendedBundlesAsync
PromptAllowInventoryReadAccess
AvatarEditorService:PromptAllowInventoryReadAccess():()
返回
()
PromptCreateOutfit
AvatarEditorService:PromptCreateOutfit(
outfit:HumanoidDescription, rigType:Enum.HumanoidRigType, outfitOptions:Dictionary, outfitType:Variant
):()
參數
| 預設值:"nil" |
outfitType:Variant |
返回
()
PromptSaveAvatar
AvatarEditorService:PromptSaveAvatar(
):()
參數
返回
()
PromptSetFavorite
AvatarEditorService:PromptSetFavorite(
):()
參數
返回
()
PromptUpdateOutfit
AvatarEditorService:PromptUpdateOutfit(
):()
參數
返回
()
SearchCatalog
SearchCatalogAsync
參數
範例程式碼
搜索具有時間選項的物品
local AvatarEditorService = game:GetService("AvatarEditorService")
local params = CatalogSearchParams.new()
params.SalesTypeFilter = Enum.SalesTypeFilter.TimedOptions
params.Limit = 10
local pages = AvatarEditorService:SearchCatalogAsync(params)
local results = pages:GetCurrentPage()
for _, item in results do
if item.TimedOptions then
for _, option in item.TimedOptions do
local days = option.Duration / 86400
print(string.format("%s: %d 天的 %d R$", item.Name, days, option.Price))
end
end
end活動
PromptAllowInventoryReadAccessCompleted
AvatarEditorService.PromptAllowInventoryReadAccessCompleted(result:Enum.AvatarPromptResult):RBXScriptSignal
參數
PromptCreateOutfitCompleted
AvatarEditorService.PromptCreateOutfitCompleted(
參數
failureType:Variant |
PromptDeleteOutfitCompleted
參數
PromptRenameOutfitCompleted
參數
PromptSaveAvatarCompleted
AvatarEditorService.PromptSaveAvatarCompleted(
參數
PromptSetFavoriteCompleted
參數
PromptUpdateOutfitCompleted
參數