エンジンクラス
AvatarEditorService
*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。
概要
方法
イベント
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
パラメータ