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