Finalize changes

This commit is contained in:
Craftplacer
2020-05-07 23:04:18 +02:00
parent 836efe3f7c
commit c025814f40
3 changed files with 14 additions and 9 deletions

View File

@ -90,7 +90,7 @@ namespace osu.Game
protected BackButton BackButton; protected BackButton BackButton;
protected SettingsPanel Settings; protected SettingsOverlay Settings;
private VolumeOverlay volume; private VolumeOverlay volume;
private OsuLogo osuLogo; private OsuLogo osuLogo;
@ -609,6 +609,9 @@ namespace osu.Game
loadComponentSingleFile(screenshotManager, Add); loadComponentSingleFile(screenshotManager, Add);
// dependency on notification overlay
loadComponentSingleFile(CreateUpdateManager(), Add, true);
// overlay elements // overlay elements
loadComponentSingleFile(beatmapListing = new BeatmapListingOverlay(), overlayContent.Add, true); loadComponentSingleFile(beatmapListing = new BeatmapListingOverlay(), overlayContent.Add, true);
loadComponentSingleFile(dashboard = new DashboardOverlay(), overlayContent.Add, true); loadComponentSingleFile(dashboard = new DashboardOverlay(), overlayContent.Add, true);
@ -641,7 +644,6 @@ namespace osu.Game
chatOverlay.State.ValueChanged += state => channelManager.HighPollRate.Value = state.NewValue == Visibility.Visible; chatOverlay.State.ValueChanged += state => channelManager.HighPollRate.Value = state.NewValue == Visibility.Visible;
Add(externalLinkOpener = new ExternalLinkOpener()); Add(externalLinkOpener = new ExternalLinkOpener());
Add(CreateUpdateManager()); // dependency on notification overlay
// side overlays which cancel each other. // side overlays which cancel each other.
var singleDisplaySideOverlays = new OverlayContainer[] { Settings, notifications }; var singleDisplaySideOverlays = new OverlayContainer[] { Settings, notifications };
@ -765,11 +767,17 @@ namespace osu.Game
private Task asyncLoadStream; private Task asyncLoadStream;
/// <summary>
/// Schedules loading the provided <paramref name="d"/> in a single file.
/// </summary>
/// <param name="d">The component to load.</param>
/// <param name="add">The method to invoke for adding the component.</param>
/// <param name="cache">Whether to cache the component as type <typeparamref name="T"/> into the game dependencies before any scheduling.</param>
private T loadComponentSingleFile<T>(T d, Action<T> add, bool cache = false) private T loadComponentSingleFile<T>(T d, Action<T> add, bool cache = false)
where T : Drawable where T : Drawable
{ {
if (cache) if (cache)
dependencies.Cache(d); dependencies.CacheAs(d);
if (d is OverlayContainer overlay) if (d is OverlayContainer overlay)
overlays.Add(overlay); overlays.Add(overlay);

View File

@ -11,13 +11,10 @@ namespace osu.Game.Overlays.Settings.Sections.General
{ {
public class UpdateSettings : SettingsSubsection public class UpdateSettings : SettingsSubsection
{ {
[Resolved(CanBeNull = true)]
private UpdateManager updateManager { get; set; }
protected override string Header => "Updates"; protected override string Header => "Updates";
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(Storage storage, OsuConfigManager config, OsuGameBase game) private void load(Storage storage, OsuConfigManager config, OsuGameBase game, UpdateManager updateManager)
{ {
Add(new SettingsEnumDropdown<ReleaseStream> Add(new SettingsEnumDropdown<ReleaseStream>
{ {
@ -28,7 +25,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
Add(new SettingsButton Add(new SettingsButton
{ {
Text = "Check for updates", Text = "Check for updates",
Action = () => updateManager?.CheckForUpdate(), Action = () => updateManager.CheckForUpdate(),
Enabled = { Value = game.IsDeployedBuild } Enabled = { Value = game.IsDeployedBuild }
}); });

View File

@ -33,7 +33,7 @@ namespace osu.Game.Updater
CheckForUpdate(); CheckForUpdate();
} }
public override void CheckForUpdate() => Schedule(() => Task.Run(checkForUpdateAsync)); public override void CheckForUpdate() => Schedule(() => Task.Run(() => checkForUpdateAsync()));
private async void checkForUpdateAsync() private async void checkForUpdateAsync()
{ {