mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Add panel appearance sounds
This commit is contained in:
@ -4,6 +4,8 @@
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
@ -21,13 +23,19 @@ namespace osu.Game.Screens.Ranking.Expanded
|
||||
{
|
||||
private readonly APIUser user;
|
||||
|
||||
private Sample appearanceSample;
|
||||
|
||||
private readonly bool playAppearanceSound;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ExpandedPanelTopContent"/>.
|
||||
/// </summary>
|
||||
/// <param name="user">The <see cref="APIUser"/> to display.</param>
|
||||
public ExpandedPanelTopContent(APIUser user)
|
||||
/// <param name="playAppearanceSound">Whether the appearance sample should play</param>
|
||||
public ExpandedPanelTopContent(APIUser user, bool playAppearanceSound = false)
|
||||
{
|
||||
this.user = user;
|
||||
this.playAppearanceSound = playAppearanceSound;
|
||||
Anchor = Anchor.TopCentre;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
@ -35,8 +43,10 @@ namespace osu.Game.Screens.Ranking.Expanded
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
appearanceSample = audio.Samples.Get(@"Results/score-panel-top-appear");
|
||||
|
||||
InternalChild = new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
@ -62,5 +72,13 @@ namespace osu.Game.Screens.Ranking.Expanded
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
if (playAppearanceSound)
|
||||
appearanceSample?.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user