Studio Device Simulator Service
*Este conteúdo é traduzido por IA (Beta) e pode conter erros. Para ver a página em inglês, clique aqui.
Resumo
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
Referência API
Métodos
Create Device Async
Parâmetros
Devolução
Amostras de código
Exemplo de Criar Dispositivo
local Simulator = game:GetService("StudioDeviceSimulatorService")
local id = Simulator:CreateDeviceAsync({
Name = "Meu Tablet Personalizado",
Width = 2560,
Height = 1600,
PixelDensity = 300,
DeviceForm = Enum.DeviceForm.Tablet,
})
print(id)Get Device Info Async
Parâmetros
Devolução
Get Device List Async
Get Orientation Async
Devolução
Get Scaling Mode Async
Devolução
Remove Device Async
Set Device Async
Set Orientation Async
Parâmetros
Devolução
()
Set Pixel Density Async
Set Resolution Async
Set Scaling Mode Async
Parâmetros
Devolução
()
Stop Simulation Async
Studio Device Simulator Service: Stop Simulation Async():()
Devolução
()
Update Device Async
Parâmetros
Devolução
()
Amostras de código
Exemplo de Atualização de Dispositivo
local Simulator = game:GetService("StudioDeviceSimulatorService")
local id = "CUSTOM_DEVICE_ID" -- O id retornado por CreateDeviceAsync
Simulator:UpdateDeviceAsync(id, {
Name = "Meu Tablet Personalizado",
Width = 2732,
Height = 2048,
PixelDensity = 264,
DeviceForm = Enum.DeviceForm.Tablet,
})Eventos
Configuration Changed
Amostras de código
Exemplo de alteração de configuração
local Simulator = game:GetService("StudioDeviceSimulatorService")
Simulator.ConfigurationChanged:Connect(function()
local deviceId = Simulator:GetDeviceAsync()
if deviceId ~= "default" then
local res = Simulator:GetResolutionAsync()
print(string.format("Ativo: %s @ %dx%d", deviceId, res.X, res.Y))
end
end)