Studio Device Simulator Service
*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
Create Device Async
Parametry
Zwroty
Przykłady kodu
Przykład urządzenia
local Simulator = game:GetService("StudioDeviceSimulatorService")
local id = Simulator:CreateDeviceAsync({
Name = "Mój niestandardowy tablet",
Width = 2560,
Height = 1600,
PixelDensity = 300,
DeviceForm = Enum.DeviceForm.Tablet,
})
print(id)Get Device Info Async
Parametry
Zwroty
Get Device List Async
Get Orientation Async
Zwroty
Get Scaling Mode Async
Remove Device Async
Set Device Async
Set Orientation Async
Parametry
Zwroty
()
Set Pixel Density Async
Set Resolution Async
Set Scaling Mode Async
Parametry
Zwroty
()
Stop Simulation Async
Studio Device Simulator Service: Stop Simulation Async():()
Zwroty
()
Update Device Async
Parametry
Zwroty
()
Przykłady kodu
Przykład aktualizacji urządzenia
local Simulator = game:GetService("StudioDeviceSimulatorService")
local id = "CUSTOM_DEVICE_ID" -- Id zwrócony przez CreateDeviceAsync
Simulator:UpdateDeviceAsync(id, {
Name = "Mój niestandardowy tablet",
Width = 2732,
Height = 2048,
PixelDensity = 264,
DeviceForm = Enum.DeviceForm.Tablet,
})Zdarzenia
Configuration Changed
Przykłady kodu
Przykład zmiany konfiguracji
local Simulator = game:GetService("StudioDeviceSimulatorService")
Simulator.ConfigurationChanged:Connect(function()
local deviceId = Simulator:GetDeviceAsync()
if deviceId ~= "default" then
local res = Simulator:GetResolutionAsync()
print(string.format("Aktywny: %s @ %dx%d", deviceId, res.X, res.Y))
end
end)