mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Reduce unnecessary container nesting and adjust empty state opacity slightly
This commit is contained in:
parent
2ee0db0ebf
commit
8917ab78f4
@ -894,10 +894,8 @@ namespace osu.Game.Screens.Select
|
||||
// child items (difficulties) are still visible.
|
||||
item.Header.X = offsetX(dist, visibleHalfHeight) - (parent?.X ?? 0);
|
||||
|
||||
// We are applying a multiplicative alpha (which is internally done by nesting an
|
||||
// additional container and setting that container's alpha) such that we can
|
||||
// layer alpha transformations on top.
|
||||
item.SetMultiplicativeAlpha(Math.Clamp(1.75f - 1.5f * dist, 0, 1));
|
||||
// We are applying alpha to the header here such that we can layer alpha transformations on top.
|
||||
item.Header.Alpha = Math.Clamp(1.75f - 1.5f * dist, 0, 1);
|
||||
}
|
||||
|
||||
private enum PendingScrollOperation
|
||||
|
@ -21,8 +21,6 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
{
|
||||
public class CarouselHeader : Container
|
||||
{
|
||||
public Container BorderContainer;
|
||||
|
||||
public readonly Bindable<CarouselItemState> State = new Bindable<CarouselItemState>(CarouselItemState.NotSelected);
|
||||
|
||||
private readonly HoverLayer hoverLayer;
|
||||
@ -37,17 +35,14 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = DrawableCarouselItem.MAX_HEIGHT;
|
||||
|
||||
InternalChild = BorderContainer = new Container
|
||||
Masking = true;
|
||||
CornerRadius = corner_radius;
|
||||
BorderColour = new Color4(221, 255, 255, 255);
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
CornerRadius = corner_radius,
|
||||
BorderColour = new Color4(221, 255, 255, 255),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Content,
|
||||
hoverLayer = new HoverLayer()
|
||||
}
|
||||
Content,
|
||||
hoverLayer = new HoverLayer()
|
||||
};
|
||||
}
|
||||
|
||||
@ -66,21 +61,21 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
case CarouselItemState.NotSelected:
|
||||
hoverLayer.InsetForBorder = false;
|
||||
|
||||
BorderContainer.BorderThickness = 0;
|
||||
BorderContainer.EdgeEffect = new EdgeEffectParameters
|
||||
BorderThickness = 0;
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Offset = new Vector2(1),
|
||||
Radius = 10,
|
||||
Colour = Color4.Black.Opacity(100),
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
};
|
||||
break;
|
||||
|
||||
case CarouselItemState.Selected:
|
||||
hoverLayer.InsetForBorder = true;
|
||||
|
||||
BorderContainer.BorderThickness = border_thickness;
|
||||
BorderContainer.EdgeEffect = new EdgeEffectParameters
|
||||
BorderThickness = border_thickness;
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Type = EdgeEffectType.Glow,
|
||||
Colour = new Color4(130, 204, 255, 150),
|
||||
|
@ -85,8 +85,6 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
};
|
||||
}
|
||||
|
||||
public void SetMultiplicativeAlpha(float alpha) => Header.BorderContainer.Alpha = alpha;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
Loading…
Reference in New Issue
Block a user