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

View File

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