1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 19:47:24 +08:00
osu-lazer/osu.Game/Graphics/Containers/OsuClickableContainer.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1.5 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 17:19:50 +08:00
2022-06-17 15:37:17 +08:00
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterface;
2018-04-13 17:19:50 +08:00
namespace osu.Game.Graphics.Containers
{
public class OsuClickableContainer : ClickableContainer, IHasTooltip
{
private readonly HoverSampleSet sampleSet;
2018-04-13 17:19:50 +08:00
private readonly Container content = new Container { RelativeSizeAxes = Axes.Both };
2018-04-13 17:19:50 +08:00
protected override Container<Drawable> Content => content;
2018-04-13 17:19:50 +08:00
2021-07-09 10:16:47 +08:00
protected virtual HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverClickSounds(sampleSet);
2018-04-13 17:19:50 +08:00
public OsuClickableContainer(HoverSampleSet sampleSet = HoverSampleSet.Default)
{
this.sampleSet = sampleSet;
}
2018-04-13 17:19:50 +08:00
public virtual LocalisableString TooltipText { get; set; }
[BackgroundDependencyLoader]
private void load()
{
if (AutoSizeAxes != Axes.None)
{
content.RelativeSizeAxes = (Axes.Both & ~AutoSizeAxes);
content.AutoSizeAxes = AutoSizeAxes;
}
2018-04-13 17:19:50 +08:00
InternalChildren = new Drawable[]
{
content,
2021-07-09 10:16:47 +08:00
CreateHoverSounds(sampleSet)
};
}
}
}