Game.GameplaySettings
Assembly:
Assembly-CSharp (typical runtime assembly for game classes)
Namespace:
Game.Settings
Type:
class
Base:
Setting
Summary:
GameplaySettings represents the user-editable gameplay-related settings stored under "Settings" (see the FileLocation attribute). It contains camera/edge-scrolling options, visual toggles and tutorial controls, provides default values, and applies relevant values to the runtime camera controller when applied. This class is intended to be used by the game's settings UI and settings persistence system.
Fields
-
public const string kName
Constant string with value "Gameplay". Commonly used as an identifier or file name for this settings block in the settings system. -
private CameraController m_CameraController
Cached reference to the gameplay CameraController instance. Used by Apply() to propagate camera-related settings (edgeScrolling, edgeScrollingSensitivity) to the live camera controller.
Properties
-
public bool edgeScrolling { get; set; }
Enable/disable edge-scrolling for the gameplay camera. Controlled by settings UI. -
public float edgeScrollingSensitivity { get; set; }
Sensitivity for edge-scrolling. This property has UI metadata: - [SettingsUISlider(min = 0.1f, max = 5f, step = 0.1f, unit = "custom")] — presented as a slider with the given range and step.
- [SettingsUICustomFormat(fractionDigits = 1)] — formatted to one decimal place.
-
[SettingsUIHideByCondition(typeof(GameplaySettings), "edgeScrolling", true)] — UI visibility of this control is conditional on the value of the edgeScrolling property (the attribute controls when the slider is shown/hidden in the settings UI).
-
public bool dayNightVisual { get; set; }
Toggle for day/night visual effects. -
public bool pausedAfterLoading { get; set; }
If true, the game remains paused after loading a save. -
public bool showTutorials { get; set; }
Whether tutorial prompts are shown. -
public bool resetTutorials { set }
A write-only property decorated for UI use: - [SettingsUIButton] — appears as a button in the settings UI.
- [SettingsUIConfirmation(null, null)] — triggers a confirmation dialog when pressed. Setting this property (i.e., pressing the button) invokes SharedSettings.instance.userState.ResetTutorials() to reset tutorial state.
Constructors
public GameplaySettings()
Default constructor. Calls SetDefaults() to initialize the instance with sensible defaults.
Methods
public override void SetDefaults()
Initializes fields to default values:- edgeScrolling = true
- edgeScrollingSensitivity = 1f
- dayNightVisual = true
- pausedAfterLoading = false
-
showTutorials = true
-
public override void Apply()
Applies the settings to runtime systems: - Ensures m_CameraController is obtained (calls TryGetGameplayCameraController(ref m_CameraController) when the cached reference is null).
- If a camera controller instance is available, sets its edgeScrolling and edgeScrollingSensitivity properties to match the stored settings.
- Calls base.Apply() to allow the base Setting implementation to perform any additional persistence or notification behavior.
Notes: - The class is annotated with [FileLocation("Settings")] which marks where the serialized settings are stored/loaded by the game's asset/settings database. - TryGetGameplayCameraController(...) is called to lazily obtain the camera controller; that helper is not defined in this file and is expected to be available from the environment or base classes.
Usage Example
// Create and configure gameplay settings, then apply them so the camera receives updates.
GameplaySettings settings = new GameplaySettings();
settings.edgeScrolling = true;
settings.edgeScrollingSensitivity = 1.5f;
settings.showTutorials = false;
// Persist/apply the settings to runtime systems (camera, etc.)
settings.Apply();
// The "Reset Tutorials" button in the UI will invoke the setter for resetTutorials,
// which calls SharedSettings.instance.userState.ResetTutorials().