void ToggleSetting(GameSetting setting) { if (!setting.CanBeChangedInGame && IsInGame) { Dynamic.PlayErrorSound(); return; } setting.ToggleValue(); if (IsInGame) { save.SetSettings(settings); } else { GameSettingsLoader.WriteSettingsToFile(settings); } var selectedMenu = ((object)Dynamic._selectedMenuCollection).AsDynamic(); var menuEntry = new MenuEntry(((IList)selectedMenu.Entries)[selectedMenu.SelectedIndex]); if (!setting.CanBeChangedInGame && IsInGame) { menuEntry.BaseDrawColor = MenuEntry.UnAvailableColor; } setting.UpdateMenuEntry(menuEntry); }
void OnDefaultsSelected(GameSettingCategoryInfo[] menusToClear, bool isSubmenu) { // Clear the root menu if (!IsInGame && !isSubmenu) { settings = new SettingCollection(); } else { foreach (var category in menusToClear) { foreach (var settingsFunc in category.SettingsPerCategory) { var setting = settingsFunc(settings); if (IsInGame && !setting.CanBeChangedInGame) { continue; } setting.SetDefault(); } } } if (IsInGame) { save.SetSettings(settings); } else { GameSettingsLoader.WriteSettingsToFile(settings); } ResetMenu(); if (isSubmenu) { Dynamic.GoToPreviousMenuCollection(); } }