1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-18 05:43:21 +08:00
osu-lazer/osu.Game.Rulesets.Osu/UI/ReplayAnalysis/ClickMarker.cs

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

89 lines
3.1 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.
using System.Linq;
2024-09-05 13:02:05 +08:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
2024-09-04 20:04:59 +08:00
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osuTK;
2024-09-04 20:04:59 +08:00
using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.UI.ReplayAnalysis
{
2024-09-05 13:28:20 +08:00
/// <summary>
/// A marker which shows one click, with visuals focusing on the button which was clicked and the precise location of the click.
/// </summary>
public partial class ClickMarker : AnalysisMarker
{
private CircularProgress leftClickDisplay = null!;
private CircularProgress rightClickDisplay = null!;
2024-09-05 13:02:05 +08:00
[BackgroundDependencyLoader]
private void load()
{
InternalChildren = new Drawable[]
{
2024-09-05 13:02:05 +08:00
new Circle
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(0.125f),
RelativeSizeAxes = Axes.Both,
Blending = BlendingParameters.Additive,
Colour = Colours.Gray5,
},
2024-09-04 20:04:59 +08:00
new CircularContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
2024-09-05 13:02:05 +08:00
RelativeSizeAxes = Axes.Both,
Colour = Colours.Gray5,
2024-09-04 20:04:59 +08:00
Masking = true,
2024-09-05 13:02:05 +08:00
BorderThickness = 2.2f,
2024-09-04 20:04:59 +08:00
BorderColour = Color4.White,
Child = new Box
{
Colour = Color4.Black,
RelativeSizeAxes = Axes.Both,
AlwaysPresent = true,
Alpha = 0,
},
},
leftClickDisplay = new CircularProgress
2024-09-05 13:02:05 +08:00
{
Colour = Colours.Yellow,
Size = new Vector2(0.95f),
Anchor = Anchor.CentreLeft,
2024-09-05 13:02:05 +08:00
Origin = Anchor.CentreRight,
Rotation = 180,
Progress = 0.5f,
InnerRadius = 0.18f,
2024-09-05 13:02:05 +08:00
RelativeSizeAxes = Axes.Both,
},
rightClickDisplay = new CircularProgress
{
2024-09-05 13:02:05 +08:00
Colour = Colours.Yellow,
Size = new Vector2(0.95f),
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Progress = 0.5f,
InnerRadius = 0.18f,
RelativeSizeAxes = Axes.Both,
},
};
2024-09-05 13:02:05 +08:00
Size = new Vector2(16);
}
protected override void OnApply(AnalysisFrameEntry entry)
{
base.OnApply(entry);
leftClickDisplay.Alpha = entry.Action.Contains(OsuAction.LeftButton) ? 1 : 0;
rightClickDisplay.Alpha = entry.Action.Contains(OsuAction.RightButton) ? 1 : 0;
}
}
}