1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 10:57:27 +08:00
osu-lazer/osu.Game/Screens/Edit/Timing/TimingScreen.cs

132 lines
4.3 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.Collections.Generic;
using System.Linq;
2019-10-09 15:06:16 +08:00
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Timing;
2019-10-09 15:06:16 +08:00
using osu.Game.Beatmaps;
2019-10-11 17:46:05 +08:00
using osu.Game.Beatmaps.ControlPoints;
2019-10-09 15:06:16 +08:00
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
2019-10-22 20:50:21 +08:00
using osu.Game.Graphics.UserInterface;
using osuTK;
2019-10-09 15:06:16 +08:00
namespace osu.Game.Screens.Edit.Timing
{
2019-10-09 15:06:16 +08:00
public class TimingScreen : EditorScreenWithTimeline
{
2019-10-11 17:46:05 +08:00
[Cached]
private Bindable<IEnumerable<ControlPoint>> selectedPoints = new Bindable<IEnumerable<ControlPoint>>();
2019-10-11 17:46:05 +08:00
[Resolved]
private IAdjustableClock clock { get; set; }
2019-10-09 15:06:16 +08:00
protected override Drawable CreateMainContent() => new GridContainer
{
RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.Absolute, 200),
},
Content = new[]
{
new Drawable[]
{
new ControlPointList(),
new ControlPointSettings(),
},
}
};
protected override void LoadComplete()
{
base.LoadComplete();
selectedPoints.BindValueChanged(selected => { clock.Seek(selected.NewValue.First().Time); });
}
2019-10-09 15:06:16 +08:00
public class ControlPointList : CompositeDrawable
{
2019-10-22 20:50:21 +08:00
private OsuButton deleteButton;
2019-10-09 15:06:16 +08:00
[Resolved]
protected IBindable<WorkingBeatmap> Beatmap { get; private set; }
2019-10-22 20:50:21 +08:00
[Resolved]
private Bindable<IEnumerable<ControlPoint>> selectedPoints { get; set; }
2019-10-09 15:06:16 +08:00
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
RelativeSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
new Box
{
Colour = colours.Gray0,
RelativeSizeAxes = Axes.Both,
},
new OsuScrollContainer
{
RelativeSizeAxes = Axes.Both,
2019-10-11 17:46:05 +08:00
Child = new ControlPointTable
2019-10-09 15:06:16 +08:00
{
ControlPoints = Beatmap.Value.Beatmap.ControlPointInfo.AllControlPoints
2019-10-11 17:46:05 +08:00
}
2019-10-22 20:50:21 +08:00
},
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Direction = FillDirection.Horizontal,
Margin = new MarginPadding(10),
Spacing = new Vector2(5),
Children = new Drawable[]
{
deleteButton = new OsuButton
{
Text = "-",
Size = new Vector2(30, 30),
Action = delete,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
},
new OsuButton
{
Text = "+",
Action = addNew,
Size = new Vector2(30, 30),
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
},
}
},
2019-10-09 15:06:16 +08:00
};
}
2019-10-22 20:50:21 +08:00
protected override void LoadComplete()
{
base.LoadComplete();
selectedPoints.BindValueChanged(selected => { deleteButton.Enabled.Value = selected.NewValue != null; }, true);
}
private void delete()
{
}
private void addNew()
{
}
2019-10-09 15:06:16 +08:00
}
}
}