2019-10-09 15:05:55 +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.
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2020-08-17 23:47:32 +08:00
|
|
|
using osu.Game.Graphics.UserInterface;
|
2022-05-24 15:15:24 +08:00
|
|
|
using osu.Game.Overlays;
|
2019-10-09 15:05:55 +08:00
|
|
|
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Edit
|
|
|
|
{
|
2023-10-30 16:46:04 +08:00
|
|
|
[Cached]
|
2022-11-24 13:32:20 +08:00
|
|
|
public abstract partial class EditorScreenWithTimeline : EditorScreen
|
2019-10-09 15:05:55 +08:00
|
|
|
{
|
2023-07-14 14:58:53 +08:00
|
|
|
public const float PADDING = 10;
|
2019-10-09 15:05:55 +08:00
|
|
|
|
2023-10-30 19:42:34 +08:00
|
|
|
public Container TimelineContent { get; private set; } = null!;
|
2023-07-14 13:04:12 +08:00
|
|
|
|
2023-10-30 19:42:34 +08:00
|
|
|
public Container MainContent { get; private set; } = null!;
|
2023-07-14 13:04:12 +08:00
|
|
|
|
|
|
|
private LoadingSpinner spinner = null!;
|
2019-12-05 19:12:25 +08:00
|
|
|
|
2020-09-24 16:03:54 +08:00
|
|
|
protected EditorScreenWithTimeline(EditorScreenMode type)
|
|
|
|
: base(type)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-10-09 15:05:55 +08:00
|
|
|
[BackgroundDependencyLoader(true)]
|
2023-07-14 13:02:48 +08:00
|
|
|
private void load(OverlayColourProvider colourProvider)
|
2019-10-09 15:05:55 +08:00
|
|
|
{
|
2023-07-14 13:19:04 +08:00
|
|
|
// Grid with only two rows.
|
|
|
|
// First is the timeline area, which should be allowed to expand as required.
|
|
|
|
// Second is the main editor content, including the playfield and side toolbars (but not the bottom).
|
2021-04-14 15:00:49 +08:00
|
|
|
Child = new GridContainer
|
2019-10-09 15:05:55 +08:00
|
|
|
{
|
2021-04-14 15:00:49 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
RowDimensions = new[]
|
2019-10-09 15:05:55 +08:00
|
|
|
{
|
2021-04-14 15:00:49 +08:00
|
|
|
new Dimension(GridSizeMode.AutoSize),
|
|
|
|
new Dimension(),
|
2020-02-07 17:23:59 +08:00
|
|
|
},
|
2021-04-14 15:00:49 +08:00
|
|
|
Content = new[]
|
2020-02-07 17:23:59 +08:00
|
|
|
{
|
2021-04-14 15:00:49 +08:00
|
|
|
new Drawable[]
|
2019-10-09 15:05:55 +08:00
|
|
|
{
|
2020-02-07 17:23:59 +08:00
|
|
|
new Container
|
|
|
|
{
|
2021-04-14 15:00:49 +08:00
|
|
|
Name = "Timeline",
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Children = new Drawable[]
|
2019-10-09 15:05:55 +08:00
|
|
|
{
|
2024-02-21 04:18:37 +08:00
|
|
|
new GridContainer
|
2019-10-09 15:05:55 +08:00
|
|
|
{
|
2021-04-14 15:00:49 +08:00
|
|
|
Name = "Timeline content",
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2024-02-21 04:18:37 +08:00
|
|
|
Content = new[]
|
2019-10-09 15:05:55 +08:00
|
|
|
{
|
2024-02-21 04:18:37 +08:00
|
|
|
new Drawable[]
|
2019-10-09 15:05:55 +08:00
|
|
|
{
|
2024-02-21 04:18:37 +08:00
|
|
|
TimelineContent = new Container
|
2021-04-14 15:00:49 +08:00
|
|
|
{
|
2024-02-21 04:18:37 +08:00
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2021-04-14 15:00:49 +08:00
|
|
|
},
|
2019-10-09 15:05:55 +08:00
|
|
|
},
|
2020-02-07 17:23:59 +08:00
|
|
|
},
|
2024-02-21 04:18:37 +08:00
|
|
|
RowDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(GridSizeMode.AutoSize),
|
|
|
|
},
|
|
|
|
ColumnDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(),
|
|
|
|
new Dimension(GridSizeMode.Absolute, 90),
|
|
|
|
}
|
2019-10-09 15:05:55 +08:00
|
|
|
}
|
2021-04-14 15:00:49 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
new Drawable[]
|
|
|
|
{
|
2023-10-30 16:46:04 +08:00
|
|
|
MainContent = new Container
|
2021-04-14 15:00:49 +08:00
|
|
|
{
|
|
|
|
Name = "Main content",
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2021-04-14 17:15:11 +08:00
|
|
|
Depth = float.MaxValue,
|
2021-04-14 15:00:49 +08:00
|
|
|
Child = spinner = new LoadingSpinner(true)
|
|
|
|
{
|
|
|
|
State = { Value = Visibility.Visible },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2019-10-09 15:05:55 +08:00
|
|
|
};
|
2021-01-05 12:27:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
2020-09-23 12:16:46 +08:00
|
|
|
|
2019-10-09 15:05:55 +08:00
|
|
|
LoadComponentAsync(CreateMainContent(), content =>
|
|
|
|
{
|
2020-08-17 23:47:32 +08:00
|
|
|
spinner.State.Value = Visibility.Hidden;
|
|
|
|
|
2023-10-30 16:46:04 +08:00
|
|
|
MainContent.Add(content);
|
2019-10-09 15:05:55 +08:00
|
|
|
content.FadeInFromZero(300, Easing.OutQuint);
|
2019-12-05 19:12:25 +08:00
|
|
|
|
2023-10-30 16:46:04 +08:00
|
|
|
LoadComponentAsync(new TimelineArea(CreateTimelineContent()), TimelineContent.Add);
|
2019-10-09 15:05:55 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
protected abstract Drawable CreateMainContent();
|
|
|
|
|
2019-12-05 22:31:21 +08:00
|
|
|
protected virtual Drawable CreateTimelineContent() => new Container();
|
2019-10-09 15:05:55 +08:00
|
|
|
}
|
|
|
|
}
|