Klasa silnika
StudioDeviceSimulatorService
*Ta zawartość została przetłumaczona przy użyciu narzędzi AI (w wersji beta) i może zawierać błędy. Aby wyświetlić tę stronę w języku angielskim, kliknij tutaj.
Podsumowanie
Metody
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):() |
Zdarzenia
Materiały referencyjne dotyczące interfejsów API
Metody
CreateDeviceAsync
Parametry
Zwroty
Przykłady kodu
Przykład urządzenia
local id = Simulator:CreateDeviceAsync({
Name = "Mój niestandardowy tablet",
Width = 2560,
Height = 1600,
PixelDensity = 300,
DeviceForm = Enum.DeviceForm.Tablet,
})GetDeviceInfoAsync
Parametry
Zwroty
GetDeviceListAsync
GetOrientationAsync
Zwroty
GetScalingModeAsync
RemoveDeviceAsync
SetDeviceAsync
SetOrientationAsync
Parametry
Zwroty
()
SetPixelDensityAsync
SetResolutionAsync
SetScalingModeAsync
Parametry
Zwroty
()
StopSimulationAsync
StudioDeviceSimulatorService:StopSimulationAsync():()
Zwroty
()
UpdateDeviceAsync
Parametry
Zwroty
()
Przykłady kodu
Przykład aktualizacji urządzenia
Simulator:UpdateDeviceAsync(id, {
Name = "Moja własna tabletka",
Width = 2732,
Height = 2048,
PixelDensity = 264,
DeviceForm = Enum.DeviceForm.Tablet,
})Zdarzenia
ConfigurationChanged
Przykłady kodu
Przykład zmiany konfiguracji
Simulator.ConfigurationChanged:Connect(function()
local deviceId = Simulator:GetDeviceAsync()
if deviceId ~= "domyślny" then
local res = Simulator:GetResolutionAsync()
print(string.format("Aktywny: %s @ %dx%d", deviceId, res.X, res.Y))
end
end)