mirror of
https://github.com/ppy/osu.git
synced 2024-11-19 03:12:54 +08:00
129 lines
5.0 KiB
C#
129 lines
5.0 KiB
C#
// 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 osu.Framework.Allocation;
|
|
using osu.Framework.Bindables;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Graphics.Containers;
|
|
using osu.Framework.Graphics.Shapes;
|
|
using osu.Game.Beatmaps.ControlPoints;
|
|
using osu.Game.Graphics;
|
|
using osu.Game.Graphics.UserInterfaceV2;
|
|
using osu.Game.Overlays;
|
|
|
|
namespace osu.Game.Screens.Edit.Timing
|
|
{
|
|
public class TapTimingControl : CompositeDrawable
|
|
{
|
|
[Resolved]
|
|
private EditorClock editorClock { get; set; }
|
|
|
|
[Resolved]
|
|
private Bindable<ControlPointGroup> selectedGroup { get; set; }
|
|
|
|
[BackgroundDependencyLoader]
|
|
private void load(OverlayColourProvider colourProvider, OsuColour colours)
|
|
{
|
|
RelativeSizeAxes = Axes.X;
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
CornerRadius = LabelledDrawable<Drawable>.CORNER_RADIUS;
|
|
Masking = true;
|
|
|
|
InternalChildren = new Drawable[]
|
|
{
|
|
new Box
|
|
{
|
|
Colour = colourProvider.Background4,
|
|
RelativeSizeAxes = Axes.Both,
|
|
},
|
|
new GridContainer
|
|
{
|
|
RelativeSizeAxes = Axes.X,
|
|
AutoSizeAxes = Axes.Y,
|
|
RowDimensions = new[]
|
|
{
|
|
new Dimension(GridSizeMode.Absolute, 200),
|
|
new Dimension(GridSizeMode.Absolute, 60),
|
|
},
|
|
Content = new[]
|
|
{
|
|
new Drawable[]
|
|
{
|
|
new Container
|
|
{
|
|
RelativeSizeAxes = Axes.Both,
|
|
Children = new Drawable[]
|
|
{
|
|
new GridContainer
|
|
{
|
|
RelativeSizeAxes = Axes.Both,
|
|
ColumnDimensions = new[]
|
|
{
|
|
new Dimension(GridSizeMode.AutoSize),
|
|
new Dimension()
|
|
},
|
|
Content = new[]
|
|
{
|
|
new Drawable[]
|
|
{
|
|
new MetronomeDisplay
|
|
{
|
|
Anchor = Anchor.CentreLeft,
|
|
Origin = Anchor.CentreLeft,
|
|
},
|
|
new WaveformComparisonDisplay(),
|
|
}
|
|
},
|
|
}
|
|
}
|
|
}
|
|
},
|
|
new Drawable[]
|
|
{
|
|
new Container
|
|
{
|
|
RelativeSizeAxes = Axes.Both,
|
|
Padding = new MarginPadding(10),
|
|
Children = new Drawable[]
|
|
{
|
|
new RoundedButton
|
|
{
|
|
Text = "Reset",
|
|
BackgroundColour = colours.Pink,
|
|
RelativeSizeAxes = Axes.X,
|
|
Width = 0.3f,
|
|
Action = reset,
|
|
},
|
|
new RoundedButton
|
|
{
|
|
Anchor = Anchor.TopRight,
|
|
Origin = Anchor.TopRight,
|
|
Text = "Play from start",
|
|
RelativeSizeAxes = Axes.X,
|
|
BackgroundColour = colourProvider.Background1,
|
|
Width = 0.68f,
|
|
Action = tap,
|
|
}
|
|
}
|
|
},
|
|
}
|
|
}
|
|
},
|
|
};
|
|
}
|
|
|
|
private void tap()
|
|
{
|
|
editorClock.Seek(selectedGroup.Value.Time);
|
|
editorClock.Start();
|
|
}
|
|
|
|
private void reset()
|
|
{
|
|
editorClock.Stop();
|
|
editorClock.Seek(selectedGroup.Value.Time);
|
|
}
|
|
}
|
|
}
|