Fix beatmap wedge mutating transforms incorrectly

This commit is contained in:
Dan Balasescu 2022-03-10 17:54:31 +09:00
parent db5c2c15dc
commit 671d614c92

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,18 @@ 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.FadeIn(transition_duration);
starRatingDisplay.Current.Value = s.NewValue ?? default;
});
mods.BindValueChanged(m =>
{
settingChangeTracker?.Dispose();