Engine Class
AvatarEditorService
*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่
สรุป
วิธีการ
เหตุการณ์
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 |
ส่งค่ากลับ
()
PromptDeleteOutfit
PromptRenameOutfit
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
พารามิเตอร์