Merge branch 'skin-size-editing' into gameplay-hud-redesign/counters

This commit is contained in:
Bartłomiej Dach 2023-11-11 21:28:29 +09:00
commit ea556abad8
No known key found for this signature in database
3 changed files with 69 additions and 51 deletions

View File

@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
@ -242,7 +243,9 @@ namespace osu.Game.Tests.Visual.Gameplay
void revertAndCheckUnchanged()
{
AddStep("Revert changes", () => changeHandler.RestoreState(int.MinValue));
AddAssert("Current state is same as default", () => defaultState.SequenceEqual(changeHandler.GetCurrentState()));
AddAssert("Current state is same as default",
() => Encoding.UTF8.GetString(defaultState),
() => Is.EqualTo(Encoding.UTF8.GetString(changeHandler.GetCurrentState())));
}
}

View File

@ -19,6 +19,7 @@ namespace osu.Game.Screens.Play.HUD
private readonly ArgonSongProgressGraph graph;
private readonly ArgonSongProgressBar bar;
private readonly Container graphContainer;
private readonly Container content;
private const float bar_height = 10;
@ -30,10 +31,17 @@ namespace osu.Game.Screens.Play.HUD
public ArgonSongProgress()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre;
Masking = true;
CornerRadius = 5;
Child = content = new Container
{
RelativeSizeAxes = Axes.X,
Children = new Drawable[]
{
info = new SongProgressInfo
@ -65,8 +73,8 @@ namespace osu.Game.Screens.Play.HUD
},
RelativeSizeAxes = Axes.X,
},
}
};
RelativeSizeAxes = Axes.X;
}
[BackgroundDependencyLoader]
@ -100,7 +108,7 @@ namespace osu.Game.Screens.Play.HUD
protected override void Update()
{
base.Update();
Height = bar.Height + bar_height + info.Height;
content.Height = bar.Height + bar_height + info.Height;
graphContainer.Height = bar.Height;
}

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Utils;
using osu.Game.Configuration;
using osu.Game.Graphics;
@ -27,6 +28,7 @@ namespace osu.Game.Screens.Play.HUD
private readonly DefaultSongProgressBar bar;
private readonly DefaultSongProgressGraph graph;
private readonly SongProgressInfo info;
private readonly Container content;
[SettingSource(typeof(SongProgressStrings), nameof(SongProgressStrings.ShowGraph), nameof(SongProgressStrings.ShowGraphDescription))]
public Bindable<bool> ShowGraph { get; } = new BindableBool(true);
@ -37,9 +39,13 @@ namespace osu.Game.Screens.Play.HUD
public DefaultSongProgress()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Anchor = Anchor.BottomRight;
Origin = Anchor.BottomRight;
Child = content = new Container
{
RelativeSizeAxes = Axes.X,
Children = new Drawable[]
{
info = new SongProgressInfo
@ -62,6 +68,7 @@ namespace osu.Game.Screens.Play.HUD
Origin = Anchor.BottomLeft,
OnSeek = time => player?.Seek(time),
},
}
};
}
@ -107,7 +114,7 @@ namespace osu.Game.Screens.Play.HUD
float newHeight = bottom_bar_height + graph_height + handle_size.Y + info.Height - graph.Y;
if (!Precision.AlmostEquals(Height, newHeight, 5f))
Height = newHeight;
content.Height = newHeight;
}
private void updateBarVisibility()