Kelas Engine
StudioDeviceSimulatorService
*Konten ini diterjemahkan menggunakan AI (Beta) dan mungkin mengandung kesalahan. Untuk melihat halaman ini dalam bahasa Inggris, klik di sini.
Rangkuman
Metode
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):() |
Referensi API
Metode
CreateDeviceAsync
Parameter
Memberikan nilai
Contoh Kode
Contoh Membuat Perangkat
local id = Simulator:CreateDeviceAsync({
Name = "Tablet Kustom Saya",
Width = 2560,
Height = 1600,
PixelDensity = 300,
DeviceForm = Enum.DeviceForm.Tablet,
})GetDeviceInfoAsync
Parameter
Memberikan nilai
GetDeviceListAsync
GetOrientationAsync
Memberikan nilai
GetPixelDensityAsync
GetScalingModeAsync
Memberikan nilai
RemoveDeviceAsync
SetDeviceAsync
SetOrientationAsync
Parameter
Memberikan nilai
()
SetPixelDensityAsync
SetResolutionAsync
SetScalingModeAsync
Parameter
Memberikan nilai
()
StopSimulationAsync
StudioDeviceSimulatorService:StopSimulationAsync():()
Memberikan nilai
()
UpdateDeviceAsync
Parameter
Memberikan nilai
()
Contoh Kode
Contoh Pembaruan Perangkat
Simulator:UpdateDeviceAsync(id, {
Name = "Tablet Kustom Saya",
Width = 2732,
Height = 2048,
PixelDensity = 264,
DeviceForm = Enum.DeviceForm.Tablet,
})Acara
ConfigurationChanged
Contoh Kode
Contoh perubahan konfigurasi
Simulator.ConfigurationChanged:Connect(function()
local deviceId = Simulator:GetDeviceAsync()
if deviceId ~= "default" then
local res = Simulator:GetResolutionAsync()
print(string.format("Aktif: %s @ %dx%d", deviceId, res.X, res.Y))
end
end)