Classe de moteur
StudioDeviceSimulatorService
*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
CreateDeviceAsync(config: Dictionary):string |
GetDeviceInfoAsync(deviceId: string):Dictionary |
RemoveDeviceAsync(deviceId: string):() |
SetDeviceAsync(deviceId: string):() |
SetOrientationAsync(orientation: Enum.ScreenOrientation):() |
SetPixelDensityAsync(density: number):() |
SetResolutionAsync(width: number,height: number):() |
StopSimulationAsync():() |
UpdateDeviceAsync(deviceId: string,config: Dictionary):() |
Événements
Référence API
Méthodes
CreateDeviceAsync
Paramètres
Retours
Échantillons de code
Exemple de création de périphérique
local id = Simulator:CreateDeviceAsync({
Name = "Mon Tableau Personnalisé",
Width = 2560,
Height = 1600,
PixelDensity = 300,
DeviceForm = Enum.DeviceForm.Tablet,
})GetDeviceInfoAsync
Paramètres
Retours
GetDeviceListAsync
GetOrientationAsync
Retours
GetScalingModeAsync
RemoveDeviceAsync
SetDeviceAsync
SetOrientationAsync
Paramètres
Retours
()
SetPixelDensityAsync
SetResolutionAsync
SetScalingModeAsync
Paramètres
Retours
()
StopSimulationAsync
StudioDeviceSimulatorService:StopSimulationAsync():()
Retours
()
UpdateDeviceAsync
Paramètres
Retours
()
Échantillons de code
Exemple de mise à jour de l'appareil
Simulator:UpdateDeviceAsync(id, {
Name = "Mon Tablette Personnalisée",
Width = 2732,
Height = 2048,
PixelDensity = 264,
DeviceForm = Enum.DeviceForm.Tablet,
})Événements
ConfigurationChanged
Échantillons de code
Exemple de configuration changée
Simulator.ConfigurationChanged:Connect(function()
local deviceId = Simulator:GetDeviceAsync()
if deviceId ~= "default" then
local res = Simulator:GetResolutionAsync()
print(string.format("Actif : %s @ %dx%d", deviceId, res.X, res.Y))
end
end)