2019-01-24 16:43:03 +08:00
|
|
|
|
// 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
|
|
|
|
|
|
2018-03-04 02:49:38 +08:00
|
|
|
|
using System;
|
2018-02-28 23:14:52 +08:00
|
|
|
|
using System.Globalization;
|
2021-07-06 18:07:25 +08:00
|
|
|
|
using osu.Framework;
|
2018-02-28 23:14:52 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2021-07-01 19:41:30 +08:00
|
|
|
|
using osu.Framework.Audio;
|
|
|
|
|
using osu.Framework.Audio.Sample;
|
2019-02-21 18:04:31 +08:00
|
|
|
|
using osu.Framework.Bindables;
|
2021-07-08 19:01:39 +08:00
|
|
|
|
using osu.Framework.Extensions;
|
2018-03-04 02:25:34 +08:00
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
2018-02-28 23:14:52 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Effects;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
2018-10-02 11:02:47 +08:00
|
|
|
|
using osu.Framework.Input.Events;
|
2021-04-14 11:28:37 +08:00
|
|
|
|
using osu.Framework.Threading;
|
2020-01-09 12:43:44 +08:00
|
|
|
|
using osu.Framework.Utils;
|
2018-02-28 23:14:52 +08:00
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2021-07-06 01:22:55 +08:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2020-03-02 17:59:55 +08:00
|
|
|
|
using osu.Game.Input.Bindings;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
|
|
|
|
using osuTK.Graphics;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-02-28 23:14:52 +08:00
|
|
|
|
namespace osu.Game.Overlays.Volume
|
|
|
|
|
{
|
2022-06-03 23:18:54 +08:00
|
|
|
|
public class VolumeMeter : Container, IStateful<SelectionState>
|
2018-02-28 23:14:52 +08:00
|
|
|
|
{
|
|
|
|
|
private CircularProgress volumeCircle;
|
2018-06-13 18:18:11 +08:00
|
|
|
|
private CircularProgress volumeCircleGlow;
|
|
|
|
|
|
2018-11-27 17:05:38 +08:00
|
|
|
|
public BindableDouble Bindable { get; } = new BindableDouble { MinValue = 0, MaxValue = 1, Precision = 0.01 };
|
2018-02-28 23:14:52 +08:00
|
|
|
|
private readonly float circleSize;
|
|
|
|
|
private readonly Color4 meterColour;
|
|
|
|
|
private readonly string name;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-03-07 13:50:50 +08:00
|
|
|
|
private OsuSpriteText text;
|
|
|
|
|
private BufferedContainer maxGlow;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-07-07 20:02:48 +08:00
|
|
|
|
private Container selectedGlowContainer;
|
2021-07-05 21:47:35 +08:00
|
|
|
|
|
2021-07-08 19:01:39 +08:00
|
|
|
|
private Sample hoverSample;
|
|
|
|
|
private Sample notchSample;
|
2021-07-01 19:41:30 +08:00
|
|
|
|
private double sampleLastPlaybackTime;
|
|
|
|
|
|
2021-07-06 18:07:25 +08:00
|
|
|
|
public event Action<SelectionState> StateChanged;
|
2021-07-06 01:22:55 +08:00
|
|
|
|
|
2021-07-06 18:07:25 +08:00
|
|
|
|
private SelectionState state;
|
|
|
|
|
|
|
|
|
|
public SelectionState State
|
2021-07-06 01:22:55 +08:00
|
|
|
|
{
|
2021-07-06 18:07:25 +08:00
|
|
|
|
get => state;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (state == value)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
state = value;
|
|
|
|
|
StateChanged?.Invoke(value);
|
2021-07-07 20:02:48 +08:00
|
|
|
|
|
|
|
|
|
updateSelectedState();
|
2021-07-06 18:07:25 +08:00
|
|
|
|
}
|
2021-07-06 01:22:55 +08:00
|
|
|
|
}
|
2021-07-04 20:47:07 +08:00
|
|
|
|
|
2021-07-07 20:17:31 +08:00
|
|
|
|
private const float transition_length = 500;
|
|
|
|
|
|
2018-02-28 23:14:52 +08:00
|
|
|
|
public VolumeMeter(string name, float circleSize, Color4 meterColour)
|
|
|
|
|
{
|
|
|
|
|
this.circleSize = circleSize;
|
|
|
|
|
this.meterColour = meterColour;
|
|
|
|
|
this.name = name;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-02-28 23:14:52 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-02-28 23:14:52 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
2021-07-01 19:41:30 +08:00
|
|
|
|
private void load(OsuColour colours, AudioManager audio)
|
2018-02-28 23:14:52 +08:00
|
|
|
|
{
|
2022-06-04 00:04:23 +08:00
|
|
|
|
hoverSample = audio.Samples.Get($@"UI/{HoverSampleSet.Button.GetDescription()}-hover");
|
2021-07-08 19:01:39 +08:00
|
|
|
|
notchSample = audio.Samples.Get(@"UI/notch-tick");
|
2021-07-01 19:41:30 +08:00
|
|
|
|
sampleLastPlaybackTime = Time.Current;
|
|
|
|
|
|
2018-06-13 18:18:11 +08:00
|
|
|
|
Color4 backgroundColour = colours.Gray1;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-02-28 23:14:52 +08:00
|
|
|
|
CircularProgress bgProgress;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-06-13 18:18:11 +08:00
|
|
|
|
const float progress_start_radius = 0.75f;
|
|
|
|
|
const float progress_size = 0.03f;
|
|
|
|
|
const float progress_end_radius = progress_start_radius + progress_size;
|
|
|
|
|
|
|
|
|
|
const float blur_amount = 5;
|
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
2018-02-28 23:14:52 +08:00
|
|
|
|
{
|
2018-06-13 18:18:11 +08:00
|
|
|
|
new Container
|
2018-02-28 23:14:52 +08:00
|
|
|
|
{
|
2018-06-13 18:18:11 +08:00
|
|
|
|
Size = new Vector2(circleSize),
|
|
|
|
|
Children = new Drawable[]
|
2018-02-28 23:14:52 +08:00
|
|
|
|
{
|
2018-06-13 18:18:11 +08:00
|
|
|
|
new BufferedContainer
|
2018-03-23 17:17:14 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2018-06-13 18:18:11 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Circle
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = backgroundColour,
|
|
|
|
|
},
|
|
|
|
|
new CircularContainer
|
|
|
|
|
{
|
|
|
|
|
Masking = true,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Size = new Vector2(progress_end_radius),
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
bgProgress = new CircularProgress
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Rotation = 180,
|
|
|
|
|
Colour = backgroundColour,
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2022-06-04 00:04:23 +08:00
|
|
|
|
Name = @"Progress under covers for smoothing",
|
2018-06-13 18:18:11 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Rotation = 180,
|
|
|
|
|
Child = volumeCircle = new CircularProgress
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new Circle
|
|
|
|
|
{
|
2022-06-04 00:04:23 +08:00
|
|
|
|
Name = @"Inner Cover",
|
2018-06-13 18:18:11 +08:00
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = backgroundColour,
|
|
|
|
|
Size = new Vector2(progress_start_radius),
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
2022-06-04 00:04:23 +08:00
|
|
|
|
Name = @"Progress overlay for glow",
|
2018-06-13 18:18:11 +08:00
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Size = new Vector2(progress_start_radius + progress_size / 1.5f),
|
|
|
|
|
Rotation = 180,
|
|
|
|
|
Padding = new MarginPadding(-Blur.KernelSize(blur_amount)),
|
|
|
|
|
Child = (volumeCircleGlow = new CircularProgress
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
InnerRadius = progress_size * 0.8f,
|
|
|
|
|
}).WithEffect(new GlowEffect
|
|
|
|
|
{
|
|
|
|
|
Colour = meterColour,
|
|
|
|
|
BlurSigma = new Vector2(blur_amount),
|
|
|
|
|
Strength = 5,
|
|
|
|
|
PadExtent = true
|
|
|
|
|
}),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2021-07-07 20:02:48 +08:00
|
|
|
|
selectedGlowContainer = new CircularContainer
|
|
|
|
|
{
|
|
|
|
|
Masking = true,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Alpha = 0,
|
|
|
|
|
Child = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Alpha = 0,
|
|
|
|
|
AlwaysPresent = true,
|
|
|
|
|
},
|
|
|
|
|
EdgeEffect = new EdgeEffectParameters
|
|
|
|
|
{
|
|
|
|
|
Type = EdgeEffectType.Glow,
|
|
|
|
|
Colour = meterColour.Opacity(0.1f),
|
|
|
|
|
Radius = 10,
|
|
|
|
|
}
|
|
|
|
|
},
|
2018-06-13 18:18:11 +08:00
|
|
|
|
maxGlow = (text = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2019-02-22 18:42:09 +08:00
|
|
|
|
Font = OsuFont.Numeric.With(size: 0.16f * circleSize)
|
2018-03-23 17:17:14 +08:00
|
|
|
|
}).WithEffect(new GlowEffect
|
|
|
|
|
{
|
2018-06-13 18:18:11 +08:00
|
|
|
|
Colour = Color4.Transparent,
|
|
|
|
|
PadExtent = true,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Size = new Vector2(120, 20),
|
|
|
|
|
CornerRadius = 10,
|
|
|
|
|
Masking = true,
|
|
|
|
|
Margin = new MarginPadding { Left = circleSize + 10 },
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Children = new Drawable[]
|
2018-02-28 23:14:52 +08:00
|
|
|
|
{
|
2018-06-13 18:18:11 +08:00
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = backgroundColour,
|
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2019-02-12 12:04:46 +08:00
|
|
|
|
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
2018-06-13 18:18:11 +08:00
|
|
|
|
Text = name
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-02-28 23:14:52 +08:00
|
|
|
|
}
|
2018-06-13 18:18:11 +08:00
|
|
|
|
};
|
2021-02-15 16:14:41 +08:00
|
|
|
|
|
2021-07-02 14:44:35 +08:00
|
|
|
|
Bindable.BindValueChanged(volume => { this.TransformTo(nameof(DisplayVolume), volume.NewValue, 400, Easing.OutQuint); }, true);
|
2021-02-15 16:14:41 +08:00
|
|
|
|
|
2018-03-07 13:50:50 +08:00
|
|
|
|
bgProgress.Current.Value = 0.75f;
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-07-04 13:56:15 +08:00
|
|
|
|
private int? displayVolumeInt;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-03-07 13:50:50 +08:00
|
|
|
|
private double displayVolume;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-03-07 13:50:50 +08:00
|
|
|
|
protected double DisplayVolume
|
|
|
|
|
{
|
|
|
|
|
get => displayVolume;
|
|
|
|
|
set
|
2018-02-28 23:14:52 +08:00
|
|
|
|
{
|
2018-03-07 13:50:50 +08:00
|
|
|
|
displayVolume = value;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-07-02 14:44:35 +08:00
|
|
|
|
int intValue = (int)Math.Round(displayVolume * 100);
|
|
|
|
|
bool intVolumeChanged = intValue != displayVolumeInt;
|
|
|
|
|
|
|
|
|
|
displayVolumeInt = intValue;
|
|
|
|
|
|
2021-05-10 06:51:58 +08:00
|
|
|
|
if (displayVolume >= 0.995f)
|
2018-02-28 23:14:52 +08:00
|
|
|
|
{
|
2018-03-04 02:25:34 +08:00
|
|
|
|
text.Text = "MAX";
|
|
|
|
|
maxGlow.EffectColour = meterColour.Opacity(2f);
|
2018-02-28 23:14:52 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2018-03-07 13:50:50 +08:00
|
|
|
|
maxGlow.EffectColour = Color4.Transparent;
|
2021-07-04 13:56:15 +08:00
|
|
|
|
text.Text = intValue.ToString(CultureInfo.CurrentCulture);
|
2018-02-28 23:14:52 +08:00
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-03-07 13:50:50 +08:00
|
|
|
|
volumeCircle.Current.Value = displayVolume * 0.75f;
|
2018-06-13 18:18:11 +08:00
|
|
|
|
volumeCircleGlow.Current.Value = displayVolume * 0.75f;
|
2021-07-01 19:41:30 +08:00
|
|
|
|
|
2021-07-02 14:44:35 +08:00
|
|
|
|
if (intVolumeChanged && IsLoaded)
|
|
|
|
|
Scheduler.AddOnce(playTickSound);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-01 19:41:30 +08:00
|
|
|
|
|
2021-07-02 14:44:35 +08:00
|
|
|
|
private void playTickSound()
|
|
|
|
|
{
|
|
|
|
|
const int tick_debounce_time = 30;
|
2021-07-01 19:41:30 +08:00
|
|
|
|
|
2021-07-02 14:44:35 +08:00
|
|
|
|
if (Time.Current - sampleLastPlaybackTime <= tick_debounce_time)
|
|
|
|
|
return;
|
2021-07-01 19:41:30 +08:00
|
|
|
|
|
2021-07-08 19:01:39 +08:00
|
|
|
|
var channel = notchSample.GetChannel();
|
2021-07-01 19:41:30 +08:00
|
|
|
|
|
2021-07-02 14:39:43 +08:00
|
|
|
|
channel.Frequency.Value = 0.99f + RNG.NextDouble(0.02f) + displayVolume * 0.1f;
|
2021-07-02 14:44:35 +08:00
|
|
|
|
|
2021-07-02 14:55:20 +08:00
|
|
|
|
// intentionally pitched down, even when hitting max.
|
|
|
|
|
if (displayVolumeInt == 0 || displayVolumeInt == 100)
|
2021-07-02 14:45:50 +08:00
|
|
|
|
channel.Frequency.Value -= 0.5f;
|
2021-07-02 14:44:35 +08:00
|
|
|
|
|
|
|
|
|
channel.Play();
|
|
|
|
|
sampleLastPlaybackTime = Time.Current;
|
2018-02-28 23:14:52 +08:00
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-02-28 23:14:52 +08:00
|
|
|
|
public double Volume
|
|
|
|
|
{
|
2019-02-21 17:56:34 +08:00
|
|
|
|
get => Bindable.Value;
|
2018-02-28 23:14:52 +08:00
|
|
|
|
private set => Bindable.Value = value;
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-04-14 11:28:37 +08:00
|
|
|
|
private const double adjust_step = 0.01;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-06-27 17:43:29 +08:00
|
|
|
|
public void Increase(double amount = 1, bool isPrecise = false) => adjust(amount, isPrecise);
|
|
|
|
|
public void Decrease(double amount = 1, bool isPrecise = false) => adjust(-amount, isPrecise);
|
2018-06-08 17:15:03 +08:00
|
|
|
|
|
2018-06-27 17:43:29 +08:00
|
|
|
|
// because volume precision is set to 0.01, this local is required to keep track of more precise adjustments and only apply when possible.
|
2018-11-22 19:13:40 +08:00
|
|
|
|
private double scrollAccumulation;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-04-14 11:28:37 +08:00
|
|
|
|
private double accelerationModifier = 1;
|
|
|
|
|
|
|
|
|
|
private const double max_acceleration = 5;
|
2021-04-15 22:24:13 +08:00
|
|
|
|
private const double acceleration_multiplier = 1.8;
|
2021-04-14 11:28:37 +08:00
|
|
|
|
|
|
|
|
|
private ScheduledDelegate accelerationDebounce;
|
|
|
|
|
|
|
|
|
|
private void resetAcceleration() => accelerationModifier = 1;
|
|
|
|
|
|
2018-06-27 17:43:29 +08:00
|
|
|
|
private void adjust(double delta, bool isPrecise)
|
2018-02-28 23:14:52 +08:00
|
|
|
|
{
|
2021-04-18 22:51:37 +08:00
|
|
|
|
if (delta == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
2021-04-14 11:28:37 +08:00
|
|
|
|
// every adjust increment increases the rate at which adjustments happen up to a cutoff.
|
|
|
|
|
// this debounce will reset on inactivity.
|
|
|
|
|
accelerationDebounce?.Cancel();
|
|
|
|
|
accelerationDebounce = Scheduler.AddDelayed(resetAcceleration, 150);
|
|
|
|
|
|
|
|
|
|
delta *= accelerationModifier;
|
2021-04-15 22:24:13 +08:00
|
|
|
|
accelerationModifier = Math.Min(max_acceleration, accelerationModifier * acceleration_multiplier);
|
2018-11-22 19:13:40 +08:00
|
|
|
|
|
2021-10-27 12:04:41 +08:00
|
|
|
|
double precision = Bindable.Precision;
|
2018-11-22 19:13:40 +08:00
|
|
|
|
|
2021-04-14 11:28:37 +08:00
|
|
|
|
if (isPrecise)
|
|
|
|
|
{
|
2022-05-24 02:22:27 +08:00
|
|
|
|
scrollAccumulation += delta * adjust_step;
|
2021-04-14 11:28:37 +08:00
|
|
|
|
|
|
|
|
|
while (Precision.AlmostBigger(Math.Abs(scrollAccumulation), precision))
|
|
|
|
|
{
|
|
|
|
|
Volume += Math.Sign(scrollAccumulation) * precision;
|
|
|
|
|
scrollAccumulation = scrollAccumulation < 0 ? Math.Min(0, scrollAccumulation + precision) : Math.Max(0, scrollAccumulation - precision);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2018-11-22 19:13:40 +08:00
|
|
|
|
{
|
2021-04-14 11:28:37 +08:00
|
|
|
|
Volume += Math.Sign(delta) * Math.Max(precision, Math.Abs(delta * adjust_step));
|
2018-11-22 19:13:40 +08:00
|
|
|
|
}
|
2018-02-28 23:14:52 +08:00
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-10-02 11:02:47 +08:00
|
|
|
|
protected override bool OnScroll(ScrollEvent e)
|
2018-06-13 15:46:27 +08:00
|
|
|
|
{
|
2018-09-19 19:52:57 +08:00
|
|
|
|
adjust(e.ScrollDelta.Y, e.IsPrecise);
|
2018-06-13 15:46:27 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-07 20:17:31 +08:00
|
|
|
|
protected override bool OnMouseMove(MouseMoveEvent e)
|
2021-07-04 20:47:07 +08:00
|
|
|
|
{
|
2021-07-06 18:07:25 +08:00
|
|
|
|
State = SelectionState.Selected;
|
2021-07-07 20:17:31 +08:00
|
|
|
|
return base.OnMouseMove(e);
|
2018-06-07 00:13:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-09 02:43:59 +08:00
|
|
|
|
protected override bool OnHover(HoverEvent e)
|
|
|
|
|
{
|
|
|
|
|
State = SelectionState.Selected;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-02 11:02:47 +08:00
|
|
|
|
protected override void OnHoverLost(HoverLostEvent e)
|
2018-06-07 00:13:35 +08:00
|
|
|
|
{
|
|
|
|
|
}
|
2020-03-02 17:59:55 +08:00
|
|
|
|
|
2021-09-16 17:26:12 +08:00
|
|
|
|
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
|
2020-03-02 17:59:55 +08:00
|
|
|
|
{
|
|
|
|
|
}
|
2021-07-07 20:02:48 +08:00
|
|
|
|
|
|
|
|
|
private void updateSelectedState()
|
|
|
|
|
{
|
|
|
|
|
switch (state)
|
|
|
|
|
{
|
|
|
|
|
case SelectionState.Selected:
|
|
|
|
|
this.ScaleTo(1.04f, transition_length, Easing.OutExpo);
|
|
|
|
|
selectedGlowContainer.FadeIn(transition_length, Easing.OutExpo);
|
2021-07-08 19:36:25 +08:00
|
|
|
|
hoverSample?.Play();
|
2021-07-07 20:02:48 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SelectionState.NotSelected:
|
|
|
|
|
this.ScaleTo(1f, transition_length, Easing.OutExpo);
|
|
|
|
|
selectedGlowContainer.FadeOut(transition_length, Easing.OutExpo);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-02-28 23:14:52 +08:00
|
|
|
|
}
|
|
|
|
|
}
|