Classe de moteur
AvatarEditorService
*Ce contenu est traduit en utilisant l'IA (Beta) et peut contenir des erreurs. Pour consulter cette page en anglais, clique ici.
Résumé
Méthodes
Événements
PromptCreateOutfitCompleted(result: Enum.AvatarPromptResult,failureType: Variant):RBXScriptSignal |
PromptSaveAvatarCompleted(result: Enum.AvatarPromptResult,humanoidDescription: HumanoidDescription):RBXScriptSignal |
Référence API
Méthodes
CheckApplyDefaultClothing
CheckApplyDefaultClothingAsync
AvatarEditorService:CheckApplyDefaultClothingAsync(humanoidDescription:HumanoidDescription):HumanoidDescription
Paramètres
Retours
ConformToAvatarRules
ConformToAvatarRulesAsync
AvatarEditorService:ConformToAvatarRulesAsync(humanoidDescription:HumanoidDescription):HumanoidDescription
Paramètres
Retours
GetAccessoryType
Paramètres
Retours
GetAvatarRules
GetBatchItemDetails
GetBatchItemDetailsAsync
Paramètres
Retours
GetBundlesByAssetIdAsync
Retours
GetFavorite
GetFavoriteAsync
Paramètres
Retours
GetHeadShapesAsync
Retours
Échantillons de code
Obtention des formes de tête possédées
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
Paramètres
Retours
Échantillons de code
Recherche d'articles expirants
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 expire dans %d heures", item.Name, hoursLeft))
end
end
endGetItemDetails
GetItemDetailsAsync
Paramètres
Retours
Échantillons de code
Vérification de l'expiration des articles
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 .. " expire dans moins de 24 heures !")
end
endGetOutfitDetails
GetOutfitDetailsAsync
Paramètres
Retours
GetOutfits
GetOutfitsAsync
AvatarEditorService:GetOutfitsAsync(
Paramètres
| Valeur par défaut : "All" |
| Valeur par défaut : "All" |
Retours
GetRecommendedAssets
GetRecommendedAssetsAsync
AvatarEditorService:GetRecommendedAssetsAsync(
Paramètres
| Valeur par défaut : 0 |
Retours
Échantillons de code
Obtenir une recommandation de chapeau
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():()
Retours
()
PromptCreateOutfit
AvatarEditorService:PromptCreateOutfit(
outfit:HumanoidDescription, rigType:Enum.HumanoidRigType, outfitOptions:Dictionary, outfitType:Variant
):()
Paramètres
| Valeur par défaut : "nil" |
outfitType:Variant |
Retours
()
PromptDeleteOutfit
PromptRenameOutfit
PromptSaveAvatar
AvatarEditorService:PromptSaveAvatar(
):()
Paramètres
Retours
()
PromptSetFavorite
AvatarEditorService:PromptSetFavorite(
):()
Paramètres
Retours
()
PromptUpdateOutfit
AvatarEditorService:PromptUpdateOutfit(
):()
Paramètres
Retours
()
SearchCatalog
SearchCatalogAsync
Paramètres
Retours
Échantillons de code
Recherche d'articles avec des options de temps
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 jours pour %d R$", item.Name, days, option.Price))
end
end
endÉvénements
PromptAllowInventoryReadAccessCompleted
AvatarEditorService.PromptAllowInventoryReadAccessCompleted(result:Enum.AvatarPromptResult):RBXScriptSignal
Paramètres
PromptCreateOutfitCompleted
AvatarEditorService.PromptCreateOutfitCompleted(
Paramètres
failureType:Variant |
PromptDeleteOutfitCompleted
Paramètres
PromptRenameOutfitCompleted
Paramètres
PromptSaveAvatarCompleted
AvatarEditorService.PromptSaveAvatarCompleted(
Paramètres
PromptSetFavoriteCompleted
Paramètres
PromptUpdateOutfitCompleted
Paramètres