UserGameSettings
*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。
ユーザーゲーム設定は、UserSettings シングルトン内で見つかった単一クラスです。ユーザーがカメラとキャラクターを制御したい方法に関するさまざまな永続設定を保持します。
このオブジェクトにアクセスするには、LocalScript を介して:
UserSettings():GetService("UserGameSettings")
このオブジェクトは、サーバーでは目的がないため、クライアント専用で使用することを目的としています。Roblox Studio でテストするときに自分の設定も反映されます。
コードサンプル
A basic example that shows how you can listen to changes in the user's settings. With this code pasted into a LocalScript running in the StarterPlayerScripts, you can change settings in Roblox's game menu, and see their values appear in the output as detected changes.
local gameSettings = UserSettings().GameSettings
local function onGameSettingChanged(nameOfSetting)
-- Fetch the value of this setting through a pcall to make sure we can retrieve it.
-- Sometimes the event fires with properties that LocalScripts can't access.
local canGetSetting, setting = pcall(function()
return gameSettings[nameOfSetting]
end)
if canGetSetting then
print("Your " .. nameOfSetting .. " has changed to: " .. tostring(setting))
end
end
gameSettings.Changed:Connect(onGameSettingChanged)
概要
プロパティ
現在、デスクトップでクライアントが使用しているカメラ移動モード。
クライアントがデスクトップで使用しているコントロールの種類。
クライアントがマウスロックスイッチモードを使用できるかどうかを切り替えます。
ゲームパッドを使用するときのカメラの感度を説明します。
ゲームのクライアントのボリュームを表す 0 から 1 の浮動
クライアントのカメラ感度を表す浮動値 0 から 4
クライアントのキャラクターが回転する方法を制御します。
クライアントによって設定されたグラフィック品質レベル。
モバイルデバイス上でクライアントが使用しているカメラタイプ。
モバイルデバイスでクライアントが使用するコントロールの種類。
方法
カメラの Y-反転値を返します。
オンボーディングが完了したかどうかをチェックします。
ユーザーの Roblox ウィンドウがフルスクリーンモードである場合、真を返します。
クライアントのゲームセッションが Roblox Studio にある場合、真を返します。
呼び出された場合、Roblox はメニューオプションを切り替えて、ユーザーのカメラの縦軸を反転させます。
呼び出された場合、Roblox はメニューオプションを切り替えて、ゲームパッドでカメラの感度を制御します。
オンボーディングを完了して設定します。
イベント
ユーザーのフルスクリーンモードが変更された場合に発火します。
ユーザーのクライアントがスタジオモードとゲームモードの間で切り替わるときに発射されます。これは、セッションが開始するときに Roblox Studio で定期的に発射されます。
プロパティ
AllTutorialsDisabled
CameraMode
ChatVisible
ComputerCameraMovementMode
ComputerMovementMode
Fullscreen
GamepadCameraSensitivity
GraphicsOptimizationMode
GraphicsQualityLevel
HasEverUsedVR
MasterVolume
MasterVolumeStudio
MaxQualityEnabled
MouseSensitivity
OnboardingsCompleted
PartyVoiceVolume
RCCProfilerRecordFrameRate
RCCProfilerRecordTimeFrame
RotationType
SavedQualityLevel
StartMaximized
StartScreenPosition
StartScreenSize
TouchCameraMovementMode
TouchMovementMode
UsedCoreGuiIsVisibleToggle
UsedCustomGuiIsVisibleToggle
UsedHideHudShortcut
VREnabled
VRRotationIntensity
VRSmoothRotationEnabled
VignetteEnabled
方法
イベント
FullscreenChanged
パラメータ
コードサンプル
local gameSettings = UserSettings().GameSettings
local function checkFullScreenMode()
local inFullscreen = gameSettings:InFullScreen()
if inFullscreen then
print("Full Screen mode enabled!")
else
print("Full Screen mode disabled!")
end
end
checkFullScreenMode()
gameSettings.FullscreenChanged:Connect(checkFullScreenMode)