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)
@ -78,6 +80,16 @@ namespace osu.Game.Screens.Play
{ {
FailingLayer = CreateFailingLayer(), FailingLayer = CreateFailingLayer(),
visibilityContainer = new Container visibilityContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Child = new GridContainer
{
RelativeSizeAxes = Axes.Both,
Content = new[]
{
new Drawable[]
{
new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
@ -95,17 +107,30 @@ namespace osu.Game.Screens.Play
ComboCounter = CreateComboCounter(), ComboCounter = CreateComboCounter(),
}, },
}, },
Progress = CreateProgress(), ComboCounter = CreateComboCounter(),
ModDisplay = CreateModsContainer(), ModDisplay = CreateModsContainer(),
HitErrorDisplay = CreateHitErrorDisplayOverlay(), HitErrorDisplay = CreateHitErrorDisplayOverlay(),
PlayerSettingsOverlay = CreatePlayerSettingsOverlay(), PlayerSettingsOverlay = CreatePlayerSettingsOverlay(),
} }
}, },
new FillFlowContainer },
new Drawable[]
{
Progress = CreateProgress(),
}
},
RowDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.AutoSize)
}
},
},
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()