Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
ModuleGameSettings Class Reference

By inheriting of this class you define a settings module. More...

Inheritance diagram for ModuleGameSettings:
ScriptAndConfig SCR_AimSensitivitySettings SCR_AllFilterSetsStorage SCR_AudioSettings SCR_ControllerSettings SCR_DeployMenuSettings SCR_EditorPersistentData SCR_EditorSettings SCR_FieldOfViewSettings SCR_HintSettings SCR_InterfaceSettings SCR_InventoryHintSettings SCR_LoadingHints SCR_ManualCameraSettings SCR_RecentGames SCR_ScenarioSequenceProgress SCR_VideoSettings SCR_WorkshopAddonManagerPresetStorage SCR_WorkshopSettings

Detailed Description

By inheriting of this class you define a settings module.

// my settings module definition
class MyGameSettings: ModuleGameSettings
{
int speed;
}
// write my settings (ideally in setting menu?)
void ChangeMySettings()
{
// approach #1
GetGame().GetGameUserSettings().GetModule("MyGameSettings").Set("speed", Math.RandomInt(0, 100));
// approach #2
MyGameSettings settings = new MyGameSettings();
settings.speed = Math.RandomInt(0, 100);
BaseContainerTools.ReadFromInstance(settings, GetGame().GetGameUserSettings().GetModule("MyGameSettings"));
// notify system about change
GetGame().UserSettingsChanged(); // -> here is also OnSpeedChanged() called
GetGame().SaveUserSettings(); // this is also call automatically during game exit, call it manually only on very important cases (like leaving settings menu)
}
// register to receive notification about changes
void SomewhereInInit()
{
GetGame().OnUserSettingsChangedInvoker().Insert(OnSpeedChanged);
}
// read my settings
void OnSpeedChanged()
{
// approach #1
int speed;
GetGame().GetGameUserSettings().GetModule("MyGameSettings").Get("speed", speed);
Print("#1 Speed changed = " + speed);
// approach #2
MyGameSettings settings = new MyGameSettings();
BaseContainerTools.WriteToInstance(settings, GetGame().GetGameUserSettings().GetModule("MyGameSettings"));
Print("#2 Speed changed = " + settings.speed);
}
ArmaReforgerScripted GetGame()
Definition game.c:1398
Definition Math.c:13
By inheriting of this class you define a settings module.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
SCR_FieldOfViewSettings Attribute

Definition at line 54 of file ModuleGameSettings.c.


The documentation for this class was generated from the following file: