1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

feat: make KeyCounterDisplay skinnable

This commit is contained in:
tsrk 2023-06-14 21:15:12 +02:00
parent c637fddf73
commit e26aeea589
No known key found for this signature in database
GPG Key ID: EBD46BB3049B56D6
3 changed files with 24 additions and 1 deletions

View File

@ -8,13 +8,14 @@ using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using osu.Game.Skinning;
namespace osu.Game.Screens.Play.HUD namespace osu.Game.Screens.Play.HUD
{ {
/// <summary> /// <summary>
/// A flowing display of all gameplay keys. Individual keys can be added using <see cref="InputTrigger"/> implementations. /// A flowing display of all gameplay keys. Individual keys can be added using <see cref="InputTrigger"/> implementations.
/// </summary> /// </summary>
public abstract partial class KeyCounterDisplay : CompositeDrawable, IAttachableSkinComponent public abstract partial class KeyCounterDisplay : CompositeDrawable, IAttachableSkinComponent, ISerialisableDrawable
{ {
/// <summary> /// <summary>
/// Whether the key counter should be visible regardless of the configuration value. /// Whether the key counter should be visible regardless of the configuration value.
@ -78,5 +79,7 @@ namespace osu.Game.Screens.Play.HUD
base.Dispose(isDisposing); base.Dispose(isDisposing);
controller.OnNewTrigger -= Add; controller.OnNewTrigger -= Add;
} }
public bool UsesFixedAnchor { get; set; }
} }
} }

View File

@ -12,6 +12,7 @@ using osu.Game.Audio;
using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.Formats;
using osu.Game.Extensions; using osu.Game.Extensions;
using osu.Game.IO; using osu.Game.IO;
using osu.Game.Screens.Play;
using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Play.HUD.HitErrorMeters; using osu.Game.Screens.Play.HUD.HitErrorMeters;
using osuTK; using osuTK;
@ -113,6 +114,7 @@ namespace osu.Game.Skinning
var combo = container.OfType<DefaultComboCounter>().FirstOrDefault(); var combo = container.OfType<DefaultComboCounter>().FirstOrDefault();
var ppCounter = container.OfType<PerformancePointsCounter>().FirstOrDefault(); var ppCounter = container.OfType<PerformancePointsCounter>().FirstOrDefault();
var songProgress = container.OfType<ArgonSongProgress>().FirstOrDefault(); var songProgress = container.OfType<ArgonSongProgress>().FirstOrDefault();
var keyCounter = container.OfType<ArgonKeyCounterDisplay>().FirstOrDefault();
if (score != null) if (score != null)
{ {
@ -168,6 +170,13 @@ namespace osu.Game.Skinning
{ {
songProgress.Position = new Vector2(0, -10); songProgress.Position = new Vector2(0, -10);
songProgress.Scale = new Vector2(0.9f, 1); songProgress.Scale = new Vector2(0.9f, 1);
if (keyCounter != null)
{
keyCounter.Anchor = Anchor.BottomLeft;
keyCounter.Origin = Anchor.BottomLeft;
keyCounter.Position = new Vector2(50, -57);
}
} }
} }
}) })
@ -179,6 +188,7 @@ namespace osu.Game.Skinning
new DefaultAccuracyCounter(), new DefaultAccuracyCounter(),
new DefaultHealthDisplay(), new DefaultHealthDisplay(),
new ArgonSongProgress(), new ArgonSongProgress(),
new ArgonKeyCounterDisplay(),
new BarHitErrorMeter(), new BarHitErrorMeter(),
new BarHitErrorMeter(), new BarHitErrorMeter(),
new PerformancePointsCounter() new PerformancePointsCounter()

View File

@ -90,6 +90,8 @@ namespace osu.Game.Skinning
var accuracy = container.OfType<DefaultAccuracyCounter>().FirstOrDefault(); var accuracy = container.OfType<DefaultAccuracyCounter>().FirstOrDefault();
var combo = container.OfType<DefaultComboCounter>().FirstOrDefault(); var combo = container.OfType<DefaultComboCounter>().FirstOrDefault();
var ppCounter = container.OfType<PerformancePointsCounter>().FirstOrDefault(); var ppCounter = container.OfType<PerformancePointsCounter>().FirstOrDefault();
var songProgress = container.OfType<DefaultSongProgress>().FirstOrDefault();
var keyCounter = container.OfType<DefaultKeyCounterDisplay>().FirstOrDefault();
if (score != null) if (score != null)
{ {
@ -141,6 +143,13 @@ namespace osu.Game.Skinning
hitError2.Origin = Anchor.CentreLeft; hitError2.Origin = Anchor.CentreLeft;
} }
} }
if (songProgress != null && keyCounter != null)
{
keyCounter.Anchor = Anchor.BottomRight;
keyCounter.Origin = Anchor.BottomRight;
keyCounter.Position = new Vector2(10, songProgress.Height + 10);
}
}) })
{ {
Children = new Drawable[] Children = new Drawable[]
@ -150,6 +159,7 @@ namespace osu.Game.Skinning
new DefaultAccuracyCounter(), new DefaultAccuracyCounter(),
new DefaultHealthDisplay(), new DefaultHealthDisplay(),
new DefaultSongProgress(), new DefaultSongProgress(),
new DefaultKeyCounterDisplay(),
new BarHitErrorMeter(), new BarHitErrorMeter(),
new BarHitErrorMeter(), new BarHitErrorMeter(),
new PerformancePointsCounter() new PerformancePointsCounter()