Studio Device Simulator Service
概要
方法
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):() |
APIリファレンス
方法
Create Device Async
パラメータ
戻り値
コードサンプル
デバイス作成の例
local Simulator = game:GetService("StudioDeviceSimulatorService")
local id = Simulator:CreateDeviceAsync({
Name = "私のカスタムタブレット",
Width = 2560,
Height = 1600,
PixelDensity = 300,
DeviceForm = Enum.DeviceForm.Tablet,
})
print(id)Get Device Info Async
パラメータ
戻り値
Get Device List Async
Get Orientation Async
Get Scaling Mode Async
Remove Device Async
Set Device Async
Set Orientation Async
パラメータ
戻り値
()
Set Pixel Density Async
Set Resolution Async
Set Scaling Mode Async
パラメータ
戻り値
()
Stop Simulation Async
Studio Device Simulator Service: Stop Simulation Async():()
戻り値
()
Update Device Async
パラメータ
戻り値
()
コードサンプル
デバイス更新の例
local Simulator = game:GetService("StudioDeviceSimulatorService")
local id = "CUSTOM_DEVICE_ID" -- CreateDeviceAsyncによって返されるid
Simulator:UpdateDeviceAsync(id, {
Name = "私のカスタムタブレット",
Width = 2732,
Height = 2048,
PixelDensity = 264,
DeviceForm = Enum.DeviceForm.Tablet,
})イベント
Configuration Changed
コードサンプル
設定変更の例
local Simulator = game:GetService("StudioDeviceSimulatorService")
Simulator.ConfigurationChanged:Connect(function()
local deviceId = Simulator:GetDeviceAsync()
if deviceId ~= "default" then
local res = Simulator:GetResolutionAsync()
print(string.format("アクティブ: %s @ %dx%d", deviceId, res.X, res.Y))
end
end)