Add scores container

This commit is contained in:
EVAST9919
2017-11-11 03:46:06 +03:00
parent 6def49d6a4
commit 3261af5200
6 changed files with 261 additions and 14 deletions

View File

@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
{
protected readonly FillFlowContainer<OsuSpriteText> Stats;
private readonly FillFlowContainer metadata;
private readonly ModContainer modContainer;
private readonly ScoreModsContainer modsContainer;
protected readonly Score Score;
protected DrawableScore(Score score)
@ -61,7 +61,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
Depth = -1,
},
},
modContainer = new ModContainer
modsContainer = new ScoreModsContainer
{
AutoSizeAxes = Axes.Y,
Anchor = Anchor.CentreRight,
@ -119,21 +119,11 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
});
foreach (Mod mod in Score.Mods)
modContainer.Add(new ModIcon(mod)
modsContainer.Add(new ModIcon(mod)
{
AutoSizeAxes = Axes.Both,
Scale = new Vector2(0.5f),
});
}
private class ModContainer : 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);
}
}
}
}

View File

@ -0,0 +1,21 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
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);
}
}
}