Clase de motor
StudioDeviceSimulatorService
*Este contenido se traduce usando la IA (Beta) y puede contener errores. Para ver esta página en inglés, haz clic en aquí.
Resumen
Métodos
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):() |
Eventos
Referencia API
Métodos
CreateDeviceAsync
Parámetros
Devuelve
Muestras de código
Ejemplo de Crear Dispositivo
local id = Simulator:CreateDeviceAsync({
Name = "Mi Tableta Personalizada",
Width = 2560,
Height = 1600,
PixelDensity = 300,
DeviceForm = Enum.DeviceForm.Tablet,
})GetDeviceInfoAsync
Parámetros
Devuelve
GetDeviceListAsync
GetOrientationAsync
Devuelve
GetScalingModeAsync
Devuelve
RemoveDeviceAsync
SetDeviceAsync
SetOrientationAsync
Parámetros
Devuelve
()
SetPixelDensityAsync
SetResolutionAsync
SetScalingModeAsync
Parámetros
Devuelve
()
StopSimulationAsync
StudioDeviceSimulatorService:StopSimulationAsync():()
Devuelve
()
UpdateDeviceAsync
Parámetros
Devuelve
()
Muestras de código
Ejemplo de actualización de dispositivo
Simulator:UpdateDeviceAsync(id, {
Name = "Mi Tableta Personalizada",
Width = 2732,
Height = 2048,
PixelDensity = 264,
DeviceForm = Enum.DeviceForm.Tablet,
})Eventos
ConfigurationChanged
Muestras de código
Ejemplo de cambio de configuración
Simulator.ConfigurationChanged:Connect(function()
local deviceId = Simulator:GetDeviceAsync()
if deviceId ~= "default" then
local res = Simulator:GetResolutionAsync()
print(string.format("Activo: %s @ %dx%d", deviceId, res.X, res.Y))
end
end)