1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-28 01:47:33 +08:00

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.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.IEnumerableExtensions;
@ -242,7 +243,9 @@ namespace osu.Game.Tests.Visual.Gameplay
void revertAndCheckUnchanged() void revertAndCheckUnchanged()
{ {
AddStep("Revert changes", () => changeHandler.RestoreState(int.MinValue)); 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 ArgonSongProgressGraph graph;
private readonly ArgonSongProgressBar bar; private readonly ArgonSongProgressBar bar;
private readonly Container graphContainer; private readonly Container graphContainer;
private readonly Container content;
private const float bar_height = 10; private const float bar_height = 10;
@ -30,43 +31,50 @@ namespace osu.Game.Screens.Play.HUD
public ArgonSongProgress() public ArgonSongProgress()
{ {
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Anchor = Anchor.BottomCentre; Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre; Origin = Anchor.BottomCentre;
Masking = true; Masking = true;
CornerRadius = 5; CornerRadius = 5;
Children = new Drawable[]
Child = content = new Container
{ {
info = new SongProgressInfo RelativeSizeAxes = Axes.X,
Children = new Drawable[]
{ {
Origin = Anchor.TopLeft, info = new SongProgressInfo
Name = "Info",
Anchor = Anchor.TopLeft,
RelativeSizeAxes = Axes.X,
ShowProgress = false
},
bar = new ArgonSongProgressBar(bar_height)
{
Name = "Seek bar",
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
OnSeek = time => player?.Seek(time),
},
graphContainer = new Container
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Masking = true,
CornerRadius = 5,
Child = graph = new ArgonSongProgressGraph
{ {
Name = "Difficulty graph", Origin = Anchor.TopLeft,
RelativeSizeAxes = Axes.Both, Name = "Info",
Blending = BlendingParameters.Additive Anchor = Anchor.TopLeft,
RelativeSizeAxes = Axes.X,
ShowProgress = false
}, },
RelativeSizeAxes = Axes.X, bar = new ArgonSongProgressBar(bar_height)
}, {
Name = "Seek bar",
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
OnSeek = time => player?.Seek(time),
},
graphContainer = new Container
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Masking = true,
CornerRadius = 5,
Child = graph = new ArgonSongProgressGraph
{
Name = "Difficulty graph",
RelativeSizeAxes = Axes.Both,
Blending = BlendingParameters.Additive
},
RelativeSizeAxes = Axes.X,
},
}
}; };
RelativeSizeAxes = Axes.X;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -100,7 +108,7 @@ namespace osu.Game.Screens.Play.HUD
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
Height = bar.Height + bar_height + info.Height; content.Height = bar.Height + bar_height + info.Height;
graphContainer.Height = bar.Height; graphContainer.Height = bar.Height;
} }

View File

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