2018-01-05 19:21:19 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-06-27 20:05:49 +08:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
2017-11-26 03:59:55 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2017-06-27 20:05:49 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2017-11-26 01:41:18 +08:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2017-06-27 20:05:49 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Graphics.Containers
|
|
|
|
|
{
|
|
|
|
|
public class OsuClickableContainer : ClickableContainer
|
|
|
|
|
{
|
2017-11-26 01:41:18 +08:00
|
|
|
|
private readonly HoverSampleSet sampleSet;
|
2017-06-27 20:05:49 +08:00
|
|
|
|
|
2017-11-26 03:59:55 +08:00
|
|
|
|
private readonly Container content = new Container { RelativeSizeAxes = Axes.Both };
|
|
|
|
|
|
|
|
|
|
protected override Container<Drawable> Content => content;
|
|
|
|
|
|
2018-01-12 01:52:50 +08:00
|
|
|
|
protected virtual HoverClickSounds CreateHoverClickSounds(HoverSampleSet sampleSet) => new HoverClickSounds(sampleSet);
|
|
|
|
|
|
2017-11-26 01:41:18 +08:00
|
|
|
|
public OsuClickableContainer(HoverSampleSet sampleSet = HoverSampleSet.Normal)
|
2017-06-27 20:05:49 +08:00
|
|
|
|
{
|
2017-11-26 01:41:18 +08:00
|
|
|
|
this.sampleSet = sampleSet;
|
2017-06-27 20:05:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-11-26 01:41:18 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
2017-06-27 20:05:49 +08:00
|
|
|
|
{
|
2017-11-26 03:59:55 +08:00
|
|
|
|
if (AutoSizeAxes != Axes.None)
|
|
|
|
|
{
|
|
|
|
|
content.RelativeSizeAxes = RelativeSizeAxes;
|
|
|
|
|
content.AutoSizeAxes = AutoSizeAxes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
content,
|
2018-01-12 01:52:50 +08:00
|
|
|
|
CreateHoverClickSounds(sampleSet)
|
2017-11-26 03:59:55 +08:00
|
|
|
|
};
|
2017-06-27 20:05:49 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|