You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.4 KiB

  1. using CustomUI.Settings;
  2. using IPA.Config;
  3. using VRUI;
  4. namespace BSIPA_ModList.UI
  5. {
  6. internal static class SettingsViewController
  7. {
  8. private static SubMenu menu;
  9. private static BoolViewController autoUpdate;
  10. private static BoolViewController autoCheck;
  11. public static VRUIViewController Create()
  12. {
  13. menu = SettingsUI.CreateSubMenu("ModListSettings", false);
  14. autoCheck = menu.AddBool("Auto Update Check", "If enabled, automatically checks for updates on game start.");
  15. autoUpdate = menu.AddBool("Auto Update", "If enabled, automatically installs updates after checking for them.");
  16. autoCheck.applyImmediately = true;
  17. autoCheck.GetValue += () => SelfConfig.SelfConfigRef.Value.Updates.AutoCheckUpdates;
  18. autoCheck.SetValue += val =>
  19. {
  20. SelfConfig.SelfConfigRef.Value.Updates.AutoCheckUpdates = val;
  21. SelfConfig.LoaderConfig.Store(SelfConfig.SelfConfigRef.Value);
  22. };
  23. autoUpdate.applyImmediately = true;
  24. autoUpdate.GetValue += () => SelfConfig.SelfConfigRef.Value.Updates.AutoUpdate;
  25. autoUpdate.SetValue += val =>
  26. {
  27. SelfConfig.SelfConfigRef.Value.Updates.AutoUpdate = val;
  28. SelfConfig.LoaderConfig.Store(SelfConfig.SelfConfigRef.Value);
  29. };
  30. return menu.viewController;
  31. }
  32. }
  33. }