Merge pull request #10502 from peppy/hud-available-area

Confine available area for HUD components to exclude the song progress area
This commit is contained in:
Dan Balasescu 2020-10-15 18:12:49 +09:00 committed by GitHub
commit a9075fc47c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 18 deletions

View File

@ -63,6 +63,8 @@ namespace osu.Game.Screens.Play
private readonly Container topScoreContainer; private readonly Container topScoreContainer;
private readonly FillFlowContainer bottomRightElements;
private IEnumerable<Drawable> hideTargets => new Drawable[] { visibilityContainer, KeyCounter }; private IEnumerable<Drawable> hideTargets => new Drawable[] { visibilityContainer, KeyCounter };
public HUDOverlay(ScoreProcessor scoreProcessor, HealthProcessor healthProcessor, DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods) public HUDOverlay(ScoreProcessor scoreProcessor, HealthProcessor healthProcessor, DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods)
@ -80,32 +82,55 @@ namespace osu.Game.Screens.Play
visibilityContainer = new Container visibilityContainer = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Child = new GridContainer
{ {
HealthDisplay = CreateHealthDisplay(), RelativeSizeAxes = Axes.Both,
topScoreContainer = new Container Content = new[]
{ {
Anchor = Anchor.TopCentre, new Drawable[]
Origin = Anchor.TopCentre,
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{ {
AccuracyCounter = CreateAccuracyCounter(), new Container
ScoreCounter = CreateScoreCounter(), {
ComboCounter = CreateComboCounter(), RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
HealthDisplay = CreateHealthDisplay(),
topScoreContainer = new Container
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
AccuracyCounter = CreateAccuracyCounter(),
ScoreCounter = CreateScoreCounter(),
ComboCounter = CreateComboCounter(),
},
},
ComboCounter = CreateComboCounter(),
ModDisplay = CreateModsContainer(),
HitErrorDisplay = CreateHitErrorDisplayOverlay(),
PlayerSettingsOverlay = CreatePlayerSettingsOverlay(),
}
},
}, },
new Drawable[]
{
Progress = CreateProgress(),
}
}, },
Progress = CreateProgress(), RowDimensions = new[]
ModDisplay = CreateModsContainer(), {
HitErrorDisplay = CreateHitErrorDisplayOverlay(), new Dimension(),
PlayerSettingsOverlay = CreatePlayerSettingsOverlay(), new Dimension(GridSizeMode.AutoSize)
} }
},
}, },
new FillFlowContainer bottomRightElements = new FillFlowContainer
{ {
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight, Origin = Anchor.BottomRight,
Position = -new Vector2(5, TwoLayerButton.SIZE_RETRACTED.Y), X = -5,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
LayoutDuration = fade_duration / 2, LayoutDuration = fade_duration / 2,
LayoutEasing = fade_easing, LayoutEasing = fade_easing,
@ -186,6 +211,12 @@ namespace osu.Game.Screens.Play
replayLoaded.BindValueChanged(replayLoadedValueChanged, true); replayLoaded.BindValueChanged(replayLoadedValueChanged, true);
} }
protected override void Update()
{
base.Update();
bottomRightElements.Y = -Progress.Height;
}
private void replayLoadedValueChanged(ValueChangedEvent<bool> e) private void replayLoadedValueChanged(ValueChangedEvent<bool> e)
{ {
PlayerSettingsOverlay.ReplayLoaded = e.NewValue; PlayerSettingsOverlay.ReplayLoaded = e.NewValue;

View File

@ -70,7 +70,6 @@ namespace osu.Game.Screens.Play
public SongProgress() public SongProgress()
{ {
Masking = true; Masking = true;
Height = bottom_bar_height + graph_height + handle_size.Y + info_height;
Children = new Drawable[] Children = new Drawable[]
{ {
@ -148,6 +147,8 @@ namespace osu.Game.Screens.Play
bar.CurrentTime = gameplayTime; bar.CurrentTime = gameplayTime;
graph.Progress = (int)(graph.ColumnCount * progress); graph.Progress = (int)(graph.ColumnCount * progress);
Height = bottom_bar_height + graph_height + handle_size.Y + info_height - graph.Y;
} }
private void updateBarVisibility() private void updateBarVisibility()