mirror of
https://github.com/ppy/osu
synced 2025-01-09 15:49:32 +00:00
Refactor HoverSampleDebounceComponent
to inherit Component
This commit is contained in:
parent
f27bf3ca20
commit
5a76c1ab9c
@ -5,7 +5,7 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Configuration;
|
||||
using osuTK;
|
||||
@ -15,7 +15,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// <summary>
|
||||
/// Handles debouncing hover sounds at a global level to ensure the effects are not overwhelming.
|
||||
/// </summary>
|
||||
public abstract partial class HoverSampleDebounceComponent : CompositeDrawable
|
||||
public abstract partial class HoverSampleDebounceComponent : Component
|
||||
{
|
||||
private Bindable<double?> lastPlaybackTime;
|
||||
|
||||
|
@ -46,7 +46,8 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Content,
|
||||
hoverLayer = new HoverLayer()
|
||||
hoverLayer = new HoverLayer(),
|
||||
new HeaderSounds(),
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -91,10 +92,8 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
}
|
||||
}
|
||||
|
||||
public partial class HoverLayer : HoverSampleDebounceComponent
|
||||
public partial class HoverLayer : CompositeDrawable
|
||||
{
|
||||
private Sample? sampleHover;
|
||||
|
||||
private Box box = null!;
|
||||
|
||||
public HoverLayer()
|
||||
@ -103,7 +102,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuColour colours)
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
InternalChild = box = new Box
|
||||
{
|
||||
@ -112,8 +111,6 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
Blending = BlendingParameters.Additive,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
};
|
||||
|
||||
sampleHover = audio.Samples.Get("UI/default-hover");
|
||||
}
|
||||
|
||||
public bool InsetForBorder
|
||||
@ -147,6 +144,17 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
box.FadeOut(1000, Easing.OutQuint);
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
}
|
||||
|
||||
private partial class HeaderSounds : HoverSampleDebounceComponent
|
||||
{
|
||||
private Sample? sampleHover;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
sampleHover = audio.Samples.Get("UI/default-hover");
|
||||
}
|
||||
|
||||
public override void PlayHoverSample()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user