Add skin customisation support to song progress display

This commit is contained in:
Dean Herbert 2021-04-29 14:14:04 +09:00
parent 3c84b0d8c6
commit 434e63d629
1 changed files with 36 additions and 21 deletions

View File

@ -14,6 +14,7 @@
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using osu.Game.Screens.Play.HUD;
namespace osu.Game.Screens.Play namespace osu.Game.Screens.Play
{ {
@ -71,30 +72,38 @@ public IEnumerable<HitObject> Objects
public SongProgress() public SongProgress()
{ {
Masking = true;
Children = new Drawable[] Children = new Drawable[]
{ {
info = new SongProgressInfo new SongProgressDisplay
{ {
Origin = Anchor.BottomLeft, Masking = true,
Anchor = Anchor.BottomLeft, RelativeSizeAxes = Axes.Both,
RelativeSizeAxes = Axes.X, Anchor = Anchor.BottomCentre,
Height = info_height, Origin = Anchor.BottomCentre,
}, Children = new Drawable[]
graph = new SongProgressGraph {
{ info = new SongProgressInfo
RelativeSizeAxes = Axes.X, {
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Height = graph_height, RelativeSizeAxes = Axes.X,
Margin = new MarginPadding { Bottom = bottom_bar_height }, Height = info_height,
}, },
bar = new SongProgressBar(bottom_bar_height, graph_height, handle_size) graph = new SongProgressGraph
{ {
Anchor = Anchor.BottomLeft, RelativeSizeAxes = Axes.X,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
OnSeek = time => RequestSeek?.Invoke(time), Anchor = Anchor.BottomLeft,
Height = graph_height,
Margin = new MarginPadding { Bottom = bottom_bar_height },
},
bar = new SongProgressBar(bottom_bar_height, graph_height, handle_size)
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
OnSeek = time => RequestSeek?.Invoke(time),
},
}
}, },
}; };
} }
@ -175,5 +184,11 @@ private void updateInfoMargin()
float finalMargin = bottom_bar_height + (AllowSeeking.Value ? handle_size.Y : 0) + (ShowGraph.Value ? graph_height : 0); float finalMargin = bottom_bar_height + (AllowSeeking.Value ? handle_size.Y : 0) + (ShowGraph.Value ? graph_height : 0);
info.TransformTo(nameof(info.Margin), new MarginPadding { Bottom = finalMargin }, transition_duration, Easing.In); info.TransformTo(nameof(info.Margin), new MarginPadding { Bottom = finalMargin }, transition_duration, Easing.In);
} }
public class SongProgressDisplay : Container, ISkinnableComponent
{
// TODO: move actual implementation into this.
// exists for skin customisation purposes.
}
} }
} }