mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge branch 'master' of git://github.com/ppy/osu into most-played-beatmaps-section
This commit is contained in:
@ -3,12 +3,18 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
@ -22,6 +28,10 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
|
||||
private readonly Container nestedContainer;
|
||||
|
||||
private readonly Container borderContainer;
|
||||
|
||||
private readonly Box hoverLayer;
|
||||
|
||||
protected override Container<Drawable> Content => nestedContainer;
|
||||
|
||||
protected Panel()
|
||||
@ -29,20 +39,56 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
Height = MAX_HEIGHT;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
|
||||
AddInternal(nestedContainer = new Container
|
||||
AddInternal(borderContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
CornerRadius = 10,
|
||||
BorderColour = new Color4(221, 255, 255, 255),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
nestedContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
hoverLayer = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
Blending = BlendingMode.Additive,
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
Alpha = 0;
|
||||
}
|
||||
|
||||
private SampleChannel sampleHover;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuColour colours)
|
||||
{
|
||||
sampleHover = audio.Sample.Get($@"SongSelect/song-ping-variation-{RNG.Next(1, 5)}");
|
||||
hoverLayer.Colour = colours.Blue.Opacity(0.1f);
|
||||
}
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
{
|
||||
sampleHover?.Play();
|
||||
|
||||
hoverLayer.FadeIn(100, Easing.OutQuint);
|
||||
return base.OnHover(state);
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
{
|
||||
hoverLayer.FadeOut(1000, Easing.OutQuint);
|
||||
base.OnHoverLost(state);
|
||||
}
|
||||
|
||||
public void SetMultiplicativeAlpha(float alpha)
|
||||
{
|
||||
nestedContainer.Alpha = alpha;
|
||||
borderContainer.Alpha = alpha;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -94,8 +140,8 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
|
||||
protected virtual void Selected()
|
||||
{
|
||||
nestedContainer.BorderThickness = 2.5f;
|
||||
nestedContainer.EdgeEffect = new EdgeEffectParameters
|
||||
borderContainer.BorderThickness = 2.5f;
|
||||
borderContainer.EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Type = EdgeEffectType.Glow,
|
||||
Colour = new Color4(130, 204, 255, 150),
|
||||
@ -106,8 +152,8 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
|
||||
protected virtual void Deselected()
|
||||
{
|
||||
nestedContainer.BorderThickness = 0;
|
||||
nestedContainer.EdgeEffect = new EdgeEffectParameters
|
||||
borderContainer.BorderThickness = 0;
|
||||
borderContainer.EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Offset = new Vector2(1),
|
||||
|
Reference in New Issue
Block a user