mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 13:13:22 +08:00
Change some order and assert for positive visibility before scheduling an operation in changelog overlay
This commit is contained in:
parent
c6bf755e68
commit
b9291cb116
@ -5,12 +5,14 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
@ -79,6 +81,8 @@ namespace osu.Game.Overlays
|
|||||||
ArgumentNullException.ThrowIfNull(updateStream);
|
ArgumentNullException.ThrowIfNull(updateStream);
|
||||||
ArgumentNullException.ThrowIfNull(version);
|
ArgumentNullException.ThrowIfNull(version);
|
||||||
|
|
||||||
|
Show();
|
||||||
|
|
||||||
performAfterFetch(() =>
|
performAfterFetch(() =>
|
||||||
{
|
{
|
||||||
var build = builds.Find(b => b.Version == version && b.UpdateStream.Name == updateStream)
|
var build = builds.Find(b => b.Version == version && b.UpdateStream.Name == updateStream)
|
||||||
@ -87,8 +91,6 @@ namespace osu.Game.Overlays
|
|||||||
if (build != null)
|
if (build != null)
|
||||||
ShowBuild(build);
|
ShowBuild(build);
|
||||||
});
|
});
|
||||||
|
|
||||||
Show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||||
@ -125,11 +127,16 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private Task initialFetchTask;
|
private Task initialFetchTask;
|
||||||
|
|
||||||
private void performAfterFetch(Action action) => Schedule(() =>
|
private void performAfterFetch(Action action)
|
||||||
|
{
|
||||||
|
Debug.Assert(State.Value == Visibility.Visible);
|
||||||
|
|
||||||
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
fetchListing()?.ContinueWith(_ =>
|
fetchListing()?.ContinueWith(_ =>
|
||||||
Schedule(action), TaskContinuationOptions.OnlyOnRanToCompletion);
|
Schedule(action), TaskContinuationOptions.OnlyOnRanToCompletion);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private Task fetchListing()
|
private Task fetchListing()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user