Class GameplaySettings
The singleton for handling gameplay settings. These are designed to be highly configurable with a provider approach.
public static class GameplaySettings
- Inheritance
-
GameplaySettings
- Inherited Members
Fields
FILE_PATH
private const string FILE_PATH = "gameplay.json"
Field Value
Options
The loaded options with a key-value pairing where both are strings. They are then parsed when requested.
public static readonly Dictionary<string, string> Options
Field Value
Methods
GetBool(string)
Gets the option cast to a boolssss
public static bool GetBool(string key)
Parameters
key
string
Returns
GetFloat(string)
Gets the option cast to a float
public static float GetFloat(string key)
Parameters
key
string
Returns
GetString(string)
Gets the option as a string (which is how it is stored so no casting occurs)
public static string GetString(string key)
Parameters
key
string
Returns
HasKey(string)
Determines whether a key is present in the settings. Generally as long as you did everything right, this should eval true.
public static bool HasKey(string key)
Parameters
key
stringthe key to check for
Returns
- bool
true if the key is present. False if not
Load()
public static void Load()
SaveSettings()
public static void SaveSettings()
SetBool(string, bool)
Sets an option with the given bool value
public static void SetBool(string key, bool value)
Parameters
SetFloat(string, float)
Sets an option with the given float value
public static void SetFloat(string key, float value)
Parameters
SetString(string, string)
Sets an option with the given string value
public static void SetString(string key, string value)
Parameters
Events
OptionsChanged
An event that triggers whenever the options have changed. Listen to this to allow response to changes in the settings (which can be done from the pause menu!!!!)
public static event Action OptionsChanged