mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:17:23 +08:00
Merge pull request #22390 from Joehuu/fix-changelog-depth
Fix changelog overlay potentially showing up behind mod select overlay
This commit is contained in:
commit
d56f528a3d
@ -5,12 +5,14 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Online.API.Requests;
|
||||
@ -22,8 +24,6 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
public partial class ChangelogOverlay : OnlineOverlay<ChangelogHeader>
|
||||
{
|
||||
public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks;
|
||||
|
||||
public readonly Bindable<APIChangelogBuild> Current = new Bindable<APIChangelogBuild>();
|
||||
|
||||
private List<APIChangelogBuild> builds;
|
||||
@ -81,6 +81,8 @@ namespace osu.Game.Overlays
|
||||
ArgumentNullException.ThrowIfNull(updateStream);
|
||||
ArgumentNullException.ThrowIfNull(version);
|
||||
|
||||
Show();
|
||||
|
||||
performAfterFetch(() =>
|
||||
{
|
||||
var build = builds.Find(b => b.Version == version && b.UpdateStream.Name == updateStream)
|
||||
@ -89,8 +91,6 @@ namespace osu.Game.Overlays
|
||||
if (build != null)
|
||||
ShowBuild(build);
|
||||
});
|
||||
|
||||
Show();
|
||||
}
|
||||
|
||||
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||
@ -127,11 +127,16 @@ namespace osu.Game.Overlays
|
||||
|
||||
private Task initialFetchTask;
|
||||
|
||||
private void performAfterFetch(Action action) => Schedule(() =>
|
||||
private void performAfterFetch(Action action)
|
||||
{
|
||||
fetchListing()?.ContinueWith(_ =>
|
||||
Schedule(action), TaskContinuationOptions.OnlyOnRanToCompletion);
|
||||
});
|
||||
Debug.Assert(State.Value == Visibility.Visible);
|
||||
|
||||
Schedule(() =>
|
||||
{
|
||||
fetchListing()?.ContinueWith(_ =>
|
||||
Schedule(action), TaskContinuationOptions.OnlyOnRanToCompletion);
|
||||
});
|
||||
}
|
||||
|
||||
private Task fetchListing()
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ namespace osu.Game.Overlays.Settings
|
||||
Text = game.Name,
|
||||
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold),
|
||||
},
|
||||
new BuildDisplay(game.Version, DebugUtils.IsDebugBuild)
|
||||
new BuildDisplay(game.Version)
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
@ -81,15 +81,13 @@ namespace osu.Game.Overlays.Settings
|
||||
private partial class BuildDisplay : OsuAnimatedButton
|
||||
{
|
||||
private readonly string version;
|
||||
private readonly bool isDebug;
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
public BuildDisplay(string version, bool isDebug)
|
||||
public BuildDisplay(string version)
|
||||
{
|
||||
this.version = version;
|
||||
this.isDebug = isDebug;
|
||||
|
||||
Content.RelativeSizeAxes = Axes.Y;
|
||||
Content.AutoSizeAxes = AutoSizeAxes = Axes.X;
|
||||
@ -99,8 +97,7 @@ namespace osu.Game.Overlays.Settings
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(ChangelogOverlay changelog)
|
||||
{
|
||||
if (!isDebug)
|
||||
Action = () => changelog?.ShowBuild(OsuGameBase.CLIENT_STREAM_NAME, version);
|
||||
Action = () => changelog?.ShowBuild(OsuGameBase.CLIENT_STREAM_NAME, version);
|
||||
|
||||
Add(new OsuSpriteText
|
||||
{
|
||||
@ -110,7 +107,7 @@ namespace osu.Game.Overlays.Settings
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Padding = new MarginPadding(5),
|
||||
Colour = isDebug ? colours.Red : Color4.White,
|
||||
Colour = DebugUtils.IsDebugBuild ? colours.Red : Color4.White,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user