UserGameSettings

顯示已棄用項目

*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡

無法建立
使用者設定
未複製

使用者遊戲設定是一個在 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.

UserGameSettings Listener

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)

概要

屬性

方法

活動

屬性

AllTutorialsDisabled

Roblox 指令碼安全性
平行讀取
Roblox 指令碼安全性
平行讀取

ChatVisible

Roblox 指令碼安全性
平行讀取

ComputerCameraMovementMode

平行讀取

目前桌面上客戶使用的相機移動模式。

ComputerMovementMode

平行讀取

客戶端在桌面上使用的控件類型。

ControlMode

平行讀取

切換客戶端是否可以使用滑鼠鎖定切換模式。

Fullscreen

Roblox 指令碼安全性
平行讀取

GamepadCameraSensitivity

平行讀取

描述使用遊戲手柄時攝影機的靈敏度。

GraphicsOptimizationMode

Roblox 指令碼安全性
平行讀取

GraphicsQualityLevel

Roblox 指令碼安全性
平行讀取

HasEverUsedVR

Roblox 指令碼安全性
平行讀取

MasterVolume

Roblox 指令碼安全性
平行讀取

一個 漂浮 在 0 和 1 之間代表遊戲客戶的音量。

MasterVolumeStudio

Roblox 指令碼安全性
平行讀取

MaxQualityEnabled

Roblox 指令碼安全性
平行讀取

MouseSensitivity

平行讀取

介於 0 和 4 之間的漂浮代表客戶的相機靈敏度。

OnboardingsCompleted

Roblox 指令碼安全性
平行讀取

PartyVoiceVolume

Roblox 指令碼安全性
平行讀取

RCCProfilerRecordFrameRate

平行讀取

RCCProfilerRecordTimeFrame

平行讀取

RotationType

平行讀取

控制客戶端角色的旋轉方式。

SavedQualityLevel

平行讀取

客戶設定的圖形品質等級。

StartMaximized

未複製
無法建立指令碼
Roblox 指令碼安全性
平行讀取

StartScreenPosition

未複製
無法建立指令碼
Roblox 指令碼安全性
平行讀取

StartScreenSize

未複製
無法建立指令碼
Roblox 指令碼安全性
平行讀取

TouchCameraMovementMode

平行讀取

客戶在使用移動裝置時使用的相機類型。

TouchMovementMode

平行讀取

客戶端在移動設裝置上使用的控件類型。

UsedCoreGuiIsVisibleToggle

Roblox 指令碼安全性
平行讀取

UsedCustomGuiIsVisibleToggle

Roblox 指令碼安全性
平行讀取

UsedHideHudShortcut

Roblox 指令碼安全性
平行讀取

VREnabled

Roblox 指令碼安全性
平行讀取

VRRotationIntensity

Roblox 指令碼安全性
平行讀取

VRSmoothRotationEnabled

Roblox 指令碼安全性
平行讀取

VignetteEnabled

Roblox 指令碼安全性
平行讀取

方法

GetCameraYInvertValue

返回相攝影機的 Y 反轉值。


返回

GetOnboardingCompleted

檢查是否已完成指定的培訓,這有助於避免再次顯示培訓動畫。

如果 onboardingId 不是接受的 ID 之一,就會發生錯誤。

整合過程是單向的。這意味著,作為開發人員,您可以強制整合過程完成,但無法重置它。

也見:

參數

onboardingId: string

要查詢的入門 ID。

預設值:""

返回

特定的入門是否已完成。

InFullScreen

如果使用者的 Roblox 窗口處於全螢幕模式,返回真值。


返回

InStudioMode

如果客戶端的遊戲會話在 Roblox Studio 中,返回真值。


返回

SetCameraYInvertVisible

()

如果呼叫,Roblox 將切換選單選項以反轉使用者的相機軸。


返回

()

SetGamepadCameraSensitivityVisible

()

如果呼叫,Roblox 將切換選單選項來控制遊戲板的相機靈敏度。


返回

()

SetOnboardingCompleted

()

將給定的培訓設為完成,因此下次玩家玩 遊玩時不會再顯示給用戶。

目前,此功能只接受 動態拇指,用於持續跟蹤玩家是否已完成動態拇指控制方案的教學。如果 onboardingId 不是接受的 ID 之一,就會發生錯誤。

整合過程是單向的。這意味著,作為開發人員,您可以強制整合過程完成,但無法重置它。

也見:

參數

onboardingId: string

設為完成的搭載ID。

預設值:""

返回

()

活動

FullscreenChanged

如果使用者的全螢幕模式變更,就會發生火災。事件只會在能夠切換全螢幕模式的桌面設備上發射。遊戲會永遠在手機和主機上的全螢幕模式。

參數

isFullscreen: boolean

範例程式碼

A LocalScript that demonstrates how you can detect whether a game is in full screen or not.

Full Screen Mode Detection

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)

StudioModeChanged

當使用者的客戶端切換到工作室模式和遊戲模式時,發射。在 Roblox Studio 開始會話時,會定期發射。

參數

isStudioMode: boolean