Engine-klasse
StudioDeviceSimulatorService
*Deze inhoud is vertaald met behulp van AI (bèta) en kan fouten bevatten. Klik hier om deze pagina in het Engels te bekijken.
Samenvatting
Methoden
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):() |
Evenementen
API-referentie
Methoden
CreateDeviceAsync
Parameters
Teruggaves
Codevoorbeelden
Voorbeeld van een apparaat maken
local id = Simulator:CreateDeviceAsync({
Name = "Mijn Aangepaste Tablet",
Width = 2560,
Height = 1600,
PixelDensity = 300,
DeviceForm = Enum.DeviceForm.Tablet,
})GetDeviceInfoAsync
Parameters
Teruggaves
GetDeviceListAsync
GetOrientationAsync
Teruggaves
GetScalingModeAsync
Teruggaves
RemoveDeviceAsync
SetDeviceAsync
SetOrientationAsync
Parameters
Teruggaves
()
SetPixelDensityAsync
SetResolutionAsync
SetScalingModeAsync
Parameters
Teruggaves
()
StopSimulationAsync
StudioDeviceSimulatorService:StopSimulationAsync():()
Teruggaves
()
UpdateDeviceAsync
Parameters
Teruggaves
()
Codevoorbeelden
Voorbeeld van Update Device
Simulator:UpdateDeviceAsync(id, {
Name = "Mijn Aangepaste Tablet",
Width = 2732,
Height = 2048,
PixelDensity = 264,
DeviceForm = Enum.DeviceForm.Tablet,
})Evenementen
ConfigurationChanged
Codevoorbeelden
Voorbeeld van gewijzigde configuratie
Simulator.ConfigurationChanged:Connect(function()
local deviceId = Simulator:GetDeviceAsync()
if deviceId ~= "default" then
local res = Simulator:GetResolutionAsync()
print(string.format("Actief: %s @ %dx%d", deviceId, res.X, res.Y))
end
end)