-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
EditorScreenWithTimeline.cs
126 lines (113 loc) · 4.81 KB
/
EditorScreenWithTimeline.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// 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;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
namespace osu.Game.Screens.Edit
{
[Cached]
public abstract partial class EditorScreenWithTimeline : EditorScreen
{
public const float PADDING = 10;
public Container TimelineContent { get; private set; } = null!;
public Container MainContent { get; private set; } = null!;
private LoadingSpinner spinner = null!;
protected EditorScreenWithTimeline(EditorScreenMode type)
: base(type)
{
}
[BackgroundDependencyLoader(true)]
private void load(OverlayColourProvider colourProvider)
{
// 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).
Child = new GridContainer
{
RelativeSizeAxes = Axes.Both,
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(),
},
Content = new[]
{
new Drawable[]
{
new Container
{
Name = "Timeline",
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background4
},
new GridContainer
{
Name = "Timeline content",
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = PADDING, Top = PADDING },
Content = new[]
{
new Drawable[]
{
TimelineContent = new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
},
},
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
},
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.Absolute, 90),
}
}
}
},
},
new Drawable[]
{
MainContent = new Container
{
Name = "Main content",
RelativeSizeAxes = Axes.Both,
Depth = float.MaxValue,
Child = spinner = new LoadingSpinner(true)
{
State = { Value = Visibility.Visible },
},
},
},
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
LoadComponentAsync(CreateMainContent(), content =>
{
spinner.State.Value = Visibility.Hidden;
MainContent.Add(content);
content.FadeInFromZero(300, Easing.OutQuint);
LoadComponentAsync(new TimelineArea(CreateTimelineContent()), TimelineContent.Add);
});
}
protected abstract Drawable CreateMainContent();
protected virtual Drawable CreateTimelineContent() => new Container();
}
}