UserSettings

사용되지 않는 항목 표시

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.

만들 수 없음

사용자 설정은 모든 게임에서 지속되는 기본 사용자 설정을 저장하는 데 사용되는 단일 개체입니다. UserSettings is a singleton object that is used to house basic user settings, which persist across all games.현재 그것은 단지 UserGameSettings 개체만 저장합니다.

이 개체에 대한 참조를 검색하려면 UserSettings() 함수를 호출하여 반환합니다.

코드 샘플

A basic sample of how the IsUserFeatureEnabled function is used by Roblox to control certain features.

IsUserFeatureEnabled Sample

if UserSettings():IsUserFeatureEnabled("UserNoCameraClickToMove") then
print("'ClickToMove' should no longer be loaded from the CameraScript!")
else
print("'ClickToMove' is still loaded from the CameraScript!")
end

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)

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)

요약

메서드

  • 지정된 사용자 기능이 활성화되면 참으로 반환합니다. 사용자 기능이 존재하지 않으면 오류가 발생합니다.

  • Reset():()

    사용자 설정의 저장된 상태를 지우고 기본값을 복원합니다.

메서드ServiceProvider에서 상속되었습니다
  • 병렬 쓰기

    지정된 className에 의해 이미 생성된 경우 지정된 서비스를 반환하고 유효하지 않은 이름에 대한 오류를 발생시킵니다.

  • 요청한 클래스 이름으로 서비스를 반환하고, 존재하지 않으면 생성합니다.

이벤트

이벤트ServiceProvider에서 상속되었습니다

속성

메서드

IsUserFeatureEnabled

지정된 사용자 기능이 활성화되면 참으로 반환합니다. 사용자 기능이 존재하지 않으면 오류가 발생합니다.

이 함수는 "사용자"로 시작하는 FFlag 목록에 대해 확인합니다.함수는 Roblox가 생성한 스크립트에서 사용되도록 되어 있으며, GlobalSettings:GetFFlag()와 유사하게 기능합니다.

매개 변수

name: string
기본값: ""

반환

코드 샘플

A basic sample of how the IsUserFeatureEnabled function is used by Roblox to control certain features.

IsUserFeatureEnabled Sample

if UserSettings():IsUserFeatureEnabled("UserNoCameraClickToMove") then
print("'ClickToMove' should no longer be loaded from the CameraScript!")
else
print("'ClickToMove' is still loaded from the CameraScript!")
end

Reset

()

사용자 설정의 저장된 상태를 지우고 해당 값을 기본값으로 다시 복원합니다.이 함수는 UserGameSettings 클래스의 모든 속성을 복원할 수 있는 권한이 없기 때문에 LocalScript에서 올바르게 실행되지 않습니다.


반환

()

이벤트