reduced complexity

This commit is contained in:
Denrage 2021-05-05 17:51:29 +02:00
parent 5049e2fbf9
commit 88506a51dd
1 changed files with 34 additions and 41 deletions

View File

@ -233,15 +233,35 @@ private void load(LocalisationManager localisation, BeatmapDifficultyCache diffi
},
}
},
topRightMetadataContainer = new Container
new FillFlowContainer
{
Name = "Topright-aligned metadata",
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Direction = FillDirection.Vertical,
Padding = new MarginPadding { Top = 14, Right = shear_width / 2 },
AutoSizeAxes = Axes.Both,
Shear = wedged_container_shear,
Child = createTopRightMetadataContainer(beatmapInfo, starDifficulty.Value ?? new StarDifficulty())
Children = new Drawable[]
{
starRatingContainer = new Container
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Shear = -wedged_container_shear,
Margin = new MarginPadding { Bottom = 5 }
},
StatusPill = new BeatmapSetOnlineStatusPill
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Shear = -wedged_container_shear,
TextSize = 11,
TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 },
Status = beatmapInfo.Status,
}
}
},
new FillFlowContainer
{
@ -299,51 +319,24 @@ private void updateDifficulty(ValueChangedEvent<StarDifficulty?> valueChanged)
{
var difficulty = valueChanged.NewValue ?? new StarDifficulty();
topRightMetadataContainer.Child.FadeOut(250);
topRightMetadataContainer.Child.Expire();
topRightMetadataContainer.Child = createTopRightMetadataContainer(beatmap.BeatmapInfo, difficulty);
if (starRatingContainer.Children.Count > 0)
{
starRatingContainer.Child.FadeOut(250);
starRatingContainer.Child.Expire();
}
difficultyColourBarContainer.Child.Expire();
difficultyColourBarContainer.Child = createDifficultyColourBar(difficulty);
}
starRatingContainer.Child = difficulty.Stars > 0 ? new StarRatingDisplay(difficulty) : Empty();
private DifficultyColourBar createDifficultyColourBar(StarDifficulty difficulty)
=> new DifficultyColourBar(difficulty)
if (difficultyColourBarContainer.Children.Count > 0)
{
difficultyColourBarContainer.Child.Expire();
}
difficultyColourBarContainer.Child = new DifficultyColourBar(difficulty)
{
RelativeSizeAxes = Axes.Y,
Width = 20,
};
private FillFlowContainer createTopRightMetadataContainer(BeatmapInfo beatmapInfo, StarDifficulty difficulty)
{
var container = new FillFlowContainer
{
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both,
};
if (difficulty.Stars > 0)
{
container.Add(new StarRatingDisplay(difficulty)
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Shear = -wedged_container_shear,
Margin = new MarginPadding { Bottom = 5 }
});
}
container.Add(StatusPill = new BeatmapSetOnlineStatusPill
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Shear = -wedged_container_shear,
TextSize = 11,
TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 },
Status = beatmapInfo.Status,
});
return container;
}
private void refreshModInformation(ValueChangedEvent<IReadOnlyList<Mod>> modsChangedEvent)