Refactor modsContainer on profile scores

This commit is contained in:
Joehu 2019-09-12 14:01:12 -07:00
parent 77ac186cf8
commit 2a8fa2f593
2 changed files with 5 additions and 25 deletions

View File

@ -12,12 +12,13 @@
using osu.Game.Scoring;
using osu.Game.Beatmaps;
using osu.Framework.Localisation;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Overlays.Profile.Sections.Ranks
{
public abstract class DrawableProfileScore : DrawableProfileRow
{
private readonly ScoreModsContainer modsContainer;
private readonly FillFlowContainer modsContainer;
protected readonly ScoreInfo Score;
protected DrawableProfileScore(ScoreInfo score)
@ -28,12 +29,12 @@ protected DrawableProfileScore(ScoreInfo score)
Height = 60;
Children = new Drawable[]
{
modsContainer = new ScoreModsContainer
modsContainer = new FillFlowContainer
{
AutoSizeAxes = Axes.Y,
AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Width = 60,
Spacing = new Vector2(1),
Margin = new MarginPadding { Right = 160 }
}
};

View File

@ -1,21 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osuTK;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.UI;
using System.Collections.Generic;
using System.Linq;
namespace osu.Game.Overlays.Profile.Sections.Ranks
{
public class ScoreModsContainer : FlowContainer<ModIcon>
{
protected override IEnumerable<Vector2> ComputeLayoutPositions()
{
int count = FlowingChildren.Count();
for (int i = 0; i < count; i++)
yield return new Vector2(DrawWidth * i * (count == 1 ? 0 : 1f / (count - 1)), 0);
}
}
}