mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Move more overhead from ctor to BDL
This commit is contained in:
@ -26,25 +26,28 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
|
|
||||||
public readonly CarouselItem Item;
|
public readonly CarouselItem Item;
|
||||||
|
|
||||||
private readonly Container nestedContainer;
|
private Container nestedContainer;
|
||||||
private readonly Container borderContainer;
|
private Container borderContainer;
|
||||||
|
|
||||||
private readonly Box hoverLayer;
|
private Box hoverLayer;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => nestedContainer;
|
protected override Container<Drawable> Content => nestedContainer;
|
||||||
|
|
||||||
protected DrawableCarouselItem(CarouselItem item)
|
protected DrawableCarouselItem(CarouselItem item)
|
||||||
{
|
{
|
||||||
Item = item;
|
Item = item;
|
||||||
Item.Filtered.ValueChanged += _ => Schedule(ApplyState);
|
|
||||||
Item.State.ValueChanged += _ => Schedule(ApplyState);
|
|
||||||
|
|
||||||
Height = MAX_HEIGHT;
|
Height = MAX_HEIGHT;
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
|
|
||||||
Alpha = 0;
|
Alpha = 0;
|
||||||
|
}
|
||||||
|
|
||||||
AddInternal(borderContainer = new Container
|
private SampleChannel sampleHover;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(AudioManager audio, OsuColour colours)
|
||||||
|
{
|
||||||
|
InternalChild = borderContainer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
@ -63,14 +66,8 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
Blending = BlendingMode.Additive,
|
Blending = BlendingMode.Additive,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
}
|
|
||||||
|
|
||||||
private SampleChannel sampleHover;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(AudioManager audio, OsuColour colours)
|
|
||||||
{
|
|
||||||
sampleHover = audio.Sample.Get($@"SongSelect/song-ping-variation-{RNG.Next(1, 5)}");
|
sampleHover = audio.Sample.Get($@"SongSelect/song-ping-variation-{RNG.Next(1, 5)}");
|
||||||
hoverLayer.Colour = colours.Blue.Opacity(0.1f);
|
hoverLayer.Colour = colours.Blue.Opacity(0.1f);
|
||||||
}
|
}
|
||||||
@ -94,7 +91,10 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
ApplyState();
|
ApplyState();
|
||||||
|
Item.Filtered.ValueChanged += _ => Schedule(ApplyState);
|
||||||
|
Item.State.ValueChanged += _ => Schedule(ApplyState);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void ApplyState()
|
protected virtual void ApplyState()
|
||||||
|
Reference in New Issue
Block a user