Standardize and simplify settings menu settings access.

This commit is contained in:
Paul Chote
2025-12-12 15:08:04 +00:00
committed by Gustas Kažukauskas
parent 2e16ad47e5
commit ec75dcd9e9
9 changed files with 293 additions and 318 deletions

View File

@@ -35,11 +35,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly AutoSaveSettings autoSaveSettings;
[ObjectCreator.UseCtor]
public GameplaySettingsLogic(ModData modData, Action<string, string, Func<Widget, Func<bool>>, Func<Widget, Action>> registerPanel,
string panelID, string label)
public GameplaySettingsLogic(ModData modData, SettingsLogic settingsLogic, string panelID, string label)
{
autoSaveSettings = modData.GetSettings<AutoSaveSettings>();
registerPanel(panelID, label, InitPanel, ResetPanel);
settingsLogic.RegisterSettingsPanel(panelID, label, InitPanel, ResetPanel);
}
Func<bool> InitPanel(Widget panel)
@@ -79,7 +78,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
() =>
{
autoSaveSettings.AutoSaveInterval = o;
Game.Settings.Save();
autoSaveSettings.Save();
});
var deviceLabel = item.Get<LabelWidget>("LABEL");
@@ -100,7 +99,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
() =>
{
autoSaveSettings.AutoSaveMaxFileCount = o;
Game.Settings.Save();
autoSaveSettings.Save();
});
var deviceLabel = item.Get<LabelWidget>("LABEL");