Lớp công cụ
AvatarEditorService
*Nội dung này được dịch bằng AI (Beta) và có thể có lỗi. Để xem trang này bằng tiếng Anh, hãy nhấp vào đây.
Tóm Tắt
Phương Pháp
Sự Kiện
PromptCreateOutfitCompleted(result: Enum.AvatarPromptResult,failureType: Variant):RBXScriptSignal |
PromptSaveAvatarCompleted(result: Enum.AvatarPromptResult,humanoidDescription: HumanoidDescription):RBXScriptSignal |
Tài Liệu Tham Khảo API
Phương Pháp
CheckApplyDefaultClothing
CheckApplyDefaultClothingAsync
AvatarEditorService:CheckApplyDefaultClothingAsync(humanoidDescription:HumanoidDescription):HumanoidDescription
Tham Số
Lợi Nhuận
ConformToAvatarRules
ConformToAvatarRulesAsync
AvatarEditorService:ConformToAvatarRulesAsync(humanoidDescription:HumanoidDescription):HumanoidDescription
Tham Số
Lợi Nhuận
GetAccessoryType
Tham Số
Lợi Nhuận
GetAvatarRules
GetBatchItemDetails
GetBatchItemDetailsAsync
Tham Số
Lợi Nhuận
GetBundlesByAssetIdAsync
Lợi Nhuận
GetFavorite
GetFavoriteAsync
Tham Số
Lợi Nhuận
GetHeadShapesAsync
Lợi Nhuận
Mẫu mã
Lấy các hình dạng đầu đã sở hữu
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
Tham Số
Lợi Nhuận
Mẫu mã
Tìm kiếm các mặt hàng sắp hết hạn
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 sẽ hết hạn trong %d giờ", item.Name, hoursLeft))
end
end
endGetItemDetails
GetItemDetailsAsync
Tham Số
Lợi Nhuận
Mẫu mã
Kiểm tra Thời gian Hết Hạn Mặt Hàng
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 .. " sẽ hết hạn trong vòng chưa đầy 24 giờ!")
end
endGetOutfitDetails
GetOutfitDetailsAsync
Tham Số
Lợi Nhuận
GetOutfits
GetOutfitsAsync
AvatarEditorService:GetOutfitsAsync(
Tham Số
| Giá Trị Mặc Định: "All" |
| Giá Trị Mặc Định: "All" |
Lợi Nhuận
GetRecommendedAssets
GetRecommendedAssetsAsync
AvatarEditorService:GetRecommendedAssetsAsync(
Tham Số
| Giá Trị Mặc Định: 0 |
Lợi Nhuận
Mẫu mã
Nhận Đề Xuất Mũ
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():()
Lợi Nhuận
()
PromptCreateOutfit
AvatarEditorService:PromptCreateOutfit(
outfit:HumanoidDescription, rigType:Enum.HumanoidRigType, outfitOptions:Dictionary, outfitType:Variant
):()
Tham Số
| Giá Trị Mặc Định: "nil" |
outfitType:Variant |
Lợi Nhuận
()
PromptDeleteOutfit
PromptRenameOutfit
PromptSaveAvatar
AvatarEditorService:PromptSaveAvatar(
):()
Tham Số
Lợi Nhuận
()
PromptSetFavorite
AvatarEditorService:PromptSetFavorite(
):()
Tham Số
Lợi Nhuận
()
PromptUpdateOutfit
AvatarEditorService:PromptUpdateOutfit(
):()
Tham Số
Lợi Nhuận
()
SearchCatalog
SearchCatalogAsync
Tham Số
Lợi Nhuận
Mẫu mã
Tìm kiếm Items với Tùy chọn Có Thời Gian
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 ngày cho %d R$", item.Name, days, option.Price))
end
end
endSự Kiện
PromptAllowInventoryReadAccessCompleted
AvatarEditorService.PromptAllowInventoryReadAccessCompleted(result:Enum.AvatarPromptResult):RBXScriptSignal
Tham Số
PromptCreateOutfitCompleted
AvatarEditorService.PromptCreateOutfitCompleted(
Tham Số
failureType:Variant |
PromptDeleteOutfitCompleted
Tham Số
PromptRenameOutfitCompleted
Tham Số
PromptSaveAvatarCompleted
AvatarEditorService.PromptSaveAvatarCompleted(
Tham Số
PromptSetFavoriteCompleted
Tham Số
PromptUpdateOutfitCompleted
Tham Số