mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Simplify content creation of Timeline / TimelineArea
This commit is contained in:
parent
be08b9d1ef
commit
d1c68cb92b
@ -23,6 +23,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
[Cached]
|
[Cached]
|
||||||
public class Timeline : ZoomableScrollContainer, IPositionSnapProvider
|
public class Timeline : ZoomableScrollContainer, IPositionSnapProvider
|
||||||
{
|
{
|
||||||
|
private readonly Drawable userContent;
|
||||||
public readonly Bindable<bool> WaveformVisible = new Bindable<bool>();
|
public readonly Bindable<bool> WaveformVisible = new Bindable<bool>();
|
||||||
|
|
||||||
public readonly Bindable<bool> ControlPointsVisible = new Bindable<bool>();
|
public readonly Bindable<bool> ControlPointsVisible = new Bindable<bool>();
|
||||||
@ -57,10 +58,12 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
private Track track;
|
private Track track;
|
||||||
|
|
||||||
private const float timeline_height = 72;
|
private const float timeline_height = 72;
|
||||||
private const float timeline_expanded_height = 150;
|
private const float timeline_expanded_height = 156;
|
||||||
|
|
||||||
public Timeline()
|
public Timeline(Drawable userContent)
|
||||||
{
|
{
|
||||||
|
this.userContent = userContent;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
|
|
||||||
ZoomDuration = 200;
|
ZoomDuration = 200;
|
||||||
@ -118,6 +121,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Colour = colours.YellowDarker,
|
Colour = colours.YellowDarker,
|
||||||
},
|
},
|
||||||
|
userContent,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -12,11 +12,19 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||||
{
|
{
|
||||||
public class TimelineArea : Container
|
public class TimelineArea : CompositeDrawable
|
||||||
{
|
{
|
||||||
public readonly Timeline Timeline = new Timeline();
|
public Timeline Timeline;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => Timeline;
|
private readonly Drawable userContent;
|
||||||
|
|
||||||
|
public TimelineArea(Drawable content = null)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
|
userContent = content ?? Drawable.Empty();
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
@ -122,7 +130,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Timeline
|
Timeline = new Timeline(userContent),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
RowDimensions = new[]
|
RowDimensions = new[]
|
||||||
|
@ -133,15 +133,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
mainContent.Add(content);
|
mainContent.Add(content);
|
||||||
content.FadeInFromZero(300, Easing.OutQuint);
|
content.FadeInFromZero(300, Easing.OutQuint);
|
||||||
|
|
||||||
LoadComponentAsync(new TimelineArea
|
LoadComponentAsync(new TimelineArea(CreateTimelineContent()), t =>
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
CreateTimelineContent(),
|
|
||||||
}
|
|
||||||
}, t =>
|
|
||||||
{
|
{
|
||||||
timelineContainer.Add(t);
|
timelineContainer.Add(t);
|
||||||
OnTimelineLoaded(t);
|
OnTimelineLoaded(t);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user