1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 10:22:56 +08:00

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 SettingsPanel Settings;
protected SettingsOverlay Settings;
private VolumeOverlay volume;
private OsuLogo osuLogo;
@ -609,6 +609,9 @@ namespace osu.Game
loadComponentSingleFile(screenshotManager, Add);
// dependency on notification overlay
loadComponentSingleFile(CreateUpdateManager(), Add, true);
// overlay elements
loadComponentSingleFile(beatmapListing = new BeatmapListingOverlay(), 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;
Add(externalLinkOpener = new ExternalLinkOpener());
Add(CreateUpdateManager()); // dependency on notification overlay
// side overlays which cancel each other.
var singleDisplaySideOverlays = new OverlayContainer[] { Settings, notifications };
@ -765,11 +767,17 @@ namespace osu.Game
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)
where T : Drawable
{
if (cache)
dependencies.Cache(d);
dependencies.CacheAs(d);
if (d is OverlayContainer overlay)
overlays.Add(overlay);

View File

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

View File

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