DI the scrolling info rather than pass by ctor

This commit is contained in:
smoogipoo
2018-06-08 20:13:24 +09:00
parent 0fb4e6b41b
commit ca5103615d
14 changed files with 146 additions and 118 deletions

View File

@ -18,19 +18,16 @@ namespace osu.Game.Rulesets.Mania.UI.Components
{
public ManiaAction Action;
private readonly ScrollingDirection direction;
private Box background;
private Box backgroundOverlay;
public ColumnBackground(ScrollingDirection direction)
{
this.direction = direction;
}
private ScrollingInfo scrollingInfo;
[BackgroundDependencyLoader]
private void load()
private void load(ScrollingInfo scrollingInfo)
{
this.scrollingInfo = scrollingInfo;
InternalChildren = new[]
{
background = new Box
@ -44,8 +41,8 @@ namespace osu.Game.Rulesets.Mania.UI.Components
Name = "Background Gradient Overlay",
RelativeSizeAxes = Axes.Both,
Height = 0.5f,
Anchor = direction == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft,
Origin = direction == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft,
Anchor = scrollingInfo.Direction == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft,
Origin = scrollingInfo.Direction == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft,
Blending = BlendingMode.Additive,
Alpha = 0
}
@ -84,8 +81,8 @@ namespace osu.Game.Rulesets.Mania.UI.Components
var dimPoint = AccentColour.Opacity(0);
backgroundOverlay.Colour = ColourInfo.GradientVertical(
direction == ScrollingDirection.Up ? brightPoint : dimPoint,
direction == ScrollingDirection.Up ? dimPoint : brightPoint);
scrollingInfo.Direction == ScrollingDirection.Up ? brightPoint : dimPoint,
scrollingInfo.Direction == ScrollingDirection.Up ? dimPoint : brightPoint);
}
public bool OnPressed(ManiaAction action)