Browse Source

Added settings view to mod list

pull/46/head
Anairkoen Schno 5 years ago
parent
commit
ee6f95c26a
4 changed files with 46 additions and 4 deletions
  1. +1
    -0
      BSIPA-ModList/BSIPA-ModList.csproj
  2. +2
    -3
      BSIPA-ModList/DownloadController.cs
  3. +4
    -1
      BSIPA-ModList/UI/ModListFlowCoordinator.cs
  4. +39
    -0
      BSIPA-ModList/UI/SettingsViewController.cs

+ 1
- 0
BSIPA-ModList/BSIPA-ModList.csproj View File

@ -73,6 +73,7 @@
<Compile Include="UI\ButtonUI.cs" /> <Compile Include="UI\ButtonUI.cs" />
<Compile Include="UI\DownloadProgressCell.cs" /> <Compile Include="UI\DownloadProgressCell.cs" />
<Compile Include="UI\ModListFlowCoordinator.cs" /> <Compile Include="UI\ModListFlowCoordinator.cs" />
<Compile Include="UI\SettingsViewController.cs" />
<Compile Include="UI\ViewControllers\BackButtonNavigationController.cs" /> <Compile Include="UI\ViewControllers\BackButtonNavigationController.cs" />
<Compile Include="UI\ViewControllers\DownloadProgressViewController.cs" /> <Compile Include="UI\ViewControllers\DownloadProgressViewController.cs" />
<Compile Include="UI\FloatingNotification.cs" /> <Compile Include="UI\FloatingNotification.cs" />


+ 2
- 3
BSIPA-ModList/DownloadController.cs View File

@ -146,11 +146,10 @@ namespace BSIPA_ModList
OnDownloaderListChanged?.Invoke(); OnDownloaderListChanged?.Invoke();
if (SelfConfig.SelfConfigRef.Value.Updates.AutoUpdate)
StartDownloads();
if (downloads.Count == 0) if (downloads.Count == 0)
OnAllDownloadsCompleted(); OnAllDownloadsCompleted();
else if (SelfConfig.SelfConfigRef.Value.Updates.AutoUpdate)
StartDownloads();
} }
public void StartDownloads() public void StartDownloads()


+ 4
- 1
BSIPA-ModList/UI/ModListFlowCoordinator.cs View File

@ -15,6 +15,7 @@ namespace BSIPA_ModList.UI
private BackButtonNavigationController navigationController; private BackButtonNavigationController navigationController;
private ModListController modList; private ModListController modList;
private DownloadProgressViewController downloads; private DownloadProgressViewController downloads;
private VRUIViewController settings;
#pragma warning disable CS0618 #pragma warning disable CS0618
protected override void DidActivate(bool firstActivation, ActivationType activationType) protected override void DidActivate(bool firstActivation, ActivationType activationType)
@ -29,12 +30,14 @@ namespace BSIPA_ModList.UI
modList = BeatSaberUI.CreateViewController<ModListController>(); modList = BeatSaberUI.CreateViewController<ModListController>();
modList.Init(this, PluginManager.AllPlugins, PluginLoader.ignoredPlugins, PluginManager.Plugins); modList.Init(this, PluginManager.AllPlugins, PluginLoader.ignoredPlugins, PluginManager.Plugins);
settings = SettingsViewController.Create();
downloads = BeatSaberUI.CreateViewController<DownloadProgressViewController>(); downloads = BeatSaberUI.CreateViewController<DownloadProgressViewController>();
PushViewControllerToNavigationController(navigationController, modList); PushViewControllerToNavigationController(navigationController, modList);
} }
ProvideInitialViewControllers(navigationController, rightViewController: downloads);
ProvideInitialViewControllers(navigationController, settings, downloads);
} }
#pragma warning restore #pragma warning restore


+ 39
- 0
BSIPA-ModList/UI/SettingsViewController.cs View File

@ -0,0 +1,39 @@
using CustomUI.Settings;
using IPA.Config;
using VRUI;
namespace BSIPA_ModList.UI
{
internal static class SettingsViewController
{
private static SubMenu menu;
private static BoolViewController autoUpdate;
private static BoolViewController autoCheck;
public static VRUIViewController Create()
{
menu = SettingsUI.CreateSubMenu("ModListSettings", false);
autoCheck = menu.AddBool("Auto Update Check", "If enabled, automatically checks for updates on game start.");
autoUpdate = menu.AddBool("Auto Update", "If enabled, automatically installs updates after checking for them.");
autoCheck.applyImmediately = true;
autoCheck.GetValue += () => SelfConfig.SelfConfigRef.Value.Updates.AutoCheckUpdates;
autoCheck.SetValue += val =>
{
SelfConfig.SelfConfigRef.Value.Updates.AutoCheckUpdates = val;
SelfConfig.LoaderConfig.Store(SelfConfig.SelfConfigRef.Value);
};
autoUpdate.applyImmediately = true;
autoUpdate.GetValue += () => SelfConfig.SelfConfigRef.Value.Updates.AutoUpdate;
autoUpdate.SetValue += val =>
{
SelfConfig.SelfConfigRef.Value.Updates.AutoUpdate = val;
SelfConfig.LoaderConfig.Store(SelfConfig.SelfConfigRef.Value);
};
return menu.viewController;
}
}
}

Loading…
Cancel
Save