mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 15:33:05 +08:00
Make the news collapsable month sections sound like dropdowns, because they pseudo kinda are
This commit is contained in:
parent
9b7bb37244
commit
9538c4c7f2
@ -15,13 +15,18 @@ using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using System.Diagnostics;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.News.Sidebar
|
||||
{
|
||||
public class MonthSection : CompositeDrawable
|
||||
{
|
||||
private const int animation_duration = 250;
|
||||
private Sample sampleOpen;
|
||||
private Sample sampleClose;
|
||||
|
||||
public readonly BindableBool Expanded = new BindableBool();
|
||||
|
||||
@ -51,6 +56,21 @@ namespace osu.Game.Overlays.News.Sidebar
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Expanded.ValueChanged += expanded =>
|
||||
{
|
||||
if (expanded.NewValue)
|
||||
sampleOpen?.Play();
|
||||
else
|
||||
sampleClose?.Play();
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
sampleOpen = audio.Samples.Get(@"UI/dropdown-open");
|
||||
sampleClose = audio.Samples.Get(@"UI/dropdown-close");
|
||||
}
|
||||
|
||||
private class DropdownHeader : OsuClickableContainer
|
||||
@ -59,6 +79,8 @@ namespace osu.Game.Overlays.News.Sidebar
|
||||
|
||||
private readonly SpriteIcon icon;
|
||||
|
||||
protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds();
|
||||
|
||||
public DropdownHeader(int month, int year)
|
||||
{
|
||||
var date = new DateTime(year, month, 1);
|
||||
@ -104,6 +126,7 @@ namespace osu.Game.Overlays.News.Sidebar
|
||||
private readonly APINewsPost post;
|
||||
|
||||
public PostButton(APINewsPost post)
|
||||
: base(HoverSampleSet.Submit)
|
||||
{
|
||||
this.post = post;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user