Merge branch 'master' into blueprint-container-selected-items-bind

This commit is contained in:
Bartłomiej Dach 2022-03-11 00:37:45 +01:00 committed by GitHub
commit 398af246a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 23 deletions

View File

@ -118,7 +118,7 @@ namespace osu.Game.Tests.Online
[Test]
public void TestBeatmapDownloadingFlow()
{
AddAssert("ensure beatmap unavailable", () => !beatmaps.IsAvailableLocally(testBeatmapSet));
AddUntilStep("ensure beatmap unavailable", () => !beatmaps.IsAvailableLocally(testBeatmapSet));
addAvailabilityCheckStep("state not downloaded", BeatmapAvailability.NotDownloaded);
AddStep("start downloading", () => beatmapDownloader.Download(testBeatmapSet));
@ -132,7 +132,7 @@ namespace osu.Game.Tests.Online
AddStep("allow importing", () => beatmaps.AllowImport.SetResult(true));
AddUntilStep("wait for import", () => beatmaps.CurrentImport != null);
AddAssert("ensure beatmap available", () => beatmaps.IsAvailableLocally(testBeatmapSet));
AddUntilStep("ensure beatmap available", () => beatmaps.IsAvailableLocally(testBeatmapSet));
addAvailabilityCheckStep("state is locally available", BeatmapAvailability.LocallyAvailable);
}

View File

@ -162,7 +162,9 @@ namespace osu.Game.Overlays
Expanded.BindValueChanged(v =>
{
content.ClearTransforms();
// clearing transforms can break autosizing, see: https://github.com/ppy/osu-framework/issues/5064
if (v.NewValue != v.OldValue)
content.ClearTransforms();
if (v.NewValue)
content.AutoSizeAxes = Axes.Y;

View File

@ -10,6 +10,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Logging;
using osu.Framework.Screens;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Rooms;
@ -171,11 +172,25 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
private void onMatchStarted() => Scheduler.Add(() =>
{
if (!this.IsCurrentScreen())
return;
loadingDisplay.Hide();
base.StartGameplay();
});
private void onResultsReady() => resultsReady.SetResult(true);
private void onResultsReady()
{
// Schedule is required to ensure that `TaskCompletionSource.SetResult` is not called more than once.
// A scenario where this can occur is if this instance is not immediately disposed (ie. async disposal queue).
Schedule(() =>
{
if (!this.IsCurrentScreen())
return;
resultsReady.SetResult(true);
});
}
protected override async Task PrepareScoreForResultsAsync(Score score)
{

View File

@ -152,7 +152,6 @@ namespace osu.Game.Screens.Select
public OsuSpriteText VersionLabel { get; private set; }
public OsuSpriteText TitleLabel { get; private set; }
public OsuSpriteText ArtistLabel { get; private set; }
public BeatmapSetOnlineStatusPill StatusPill { get; private set; }
public FillFlowContainer MapperContainer { get; private set; }
private Container difficultyColourBar;
@ -169,6 +168,12 @@ namespace osu.Game.Screens.Select
[Resolved]
private IBindable<IReadOnlyList<Mod>> mods { get; set; }
[Resolved]
private BeatmapDifficultyCache difficultyCache { get; set; }
[Resolved]
private OsuColour colours { get; set; }
private ModSettingChangeTracker settingChangeTracker;
public WedgeInfoText(WorkingBeatmap working, RulesetInfo userRuleset)
@ -181,7 +186,7 @@ namespace osu.Game.Screens.Select
private IBindable<StarDifficulty?> starDifficulty;
[BackgroundDependencyLoader]
private void load(OsuColour colours, LocalisationManager localisation, BeatmapDifficultyCache difficultyCache)
private void load(LocalisationManager localisation)
{
var beatmapInfo = working.BeatmapInfo;
var metadata = beatmapInfo.Metadata;
@ -255,7 +260,7 @@ namespace osu.Game.Screens.Select
Shear = -wedged_container_shear,
Alpha = 0f,
},
StatusPill = new BeatmapSetOnlineStatusPill
new BeatmapSetOnlineStatusPill
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.TopRight,
@ -264,6 +269,7 @@ namespace osu.Game.Screens.Select
TextSize = 11,
TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 },
Status = beatmapInfo.Status,
Alpha = string.IsNullOrEmpty(beatmapInfo.DifficultyName) ? 0 : 1
}
}
},
@ -311,22 +317,6 @@ namespace osu.Game.Screens.Select
titleBinding.BindValueChanged(_ => setMetadata(metadata.Source));
artistBinding.BindValueChanged(_ => setMetadata(metadata.Source), true);
starRatingDisplay.DisplayedStars.BindValueChanged(s =>
{
difficultyColourBar.Colour = colours.ForStarDifficulty(s.NewValue);
}, true);
starDifficulty = difficultyCache.GetBindableDifficulty(beatmapInfo, (cancellationSource = new CancellationTokenSource()).Token);
starDifficulty.BindValueChanged(s =>
{
starRatingDisplay.FadeIn(transition_duration);
starRatingDisplay.Current.Value = s.NewValue ?? default;
});
// no difficulty means it can't have a status to show
if (string.IsNullOrEmpty(beatmapInfo.DifficultyName))
StatusPill.Hide();
addInfoLabels();
}
@ -334,6 +324,23 @@ namespace osu.Game.Screens.Select
{
base.LoadComplete();
starRatingDisplay.DisplayedStars.BindValueChanged(s =>
{
difficultyColourBar.Colour = colours.ForStarDifficulty(s.NewValue);
}, true);
starDifficulty = difficultyCache.GetBindableDifficulty(working.BeatmapInfo, (cancellationSource = new CancellationTokenSource()).Token);
starDifficulty.BindValueChanged(s =>
{
starRatingDisplay.Current.Value = s.NewValue ?? default;
// Don't roll the counter on initial display (but still allow it to roll on applying mods etc.)
if (!starRatingDisplay.IsPresent)
starRatingDisplay.FinishTransforms(true);
starRatingDisplay.FadeIn(transition_duration);
});
mods.BindValueChanged(m =>
{
settingChangeTracker?.Dispose();