1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 19:32:55 +08:00

Add new default locations for hit bar error displays

This commit is contained in:
Dean Herbert 2021-05-18 15:50:40 +09:00
parent 5acb708939
commit 10c730b37d
4 changed files with 51 additions and 3 deletions

View File

@ -20,10 +20,14 @@ namespace osu.Game.Screens.Play
{ {
public class SongProgress : OverlayContainer, ISkinnableDrawable public class SongProgress : OverlayContainer, ISkinnableDrawable
{ {
private const int info_height = 20; public const float MAX_HEIGHT = info_height + bottom_bar_height + graph_height + handle_height;
private const int bottom_bar_height = 5;
private const float info_height = 20;
private const float bottom_bar_height = 5;
private const float graph_height = SquareGraph.Column.WIDTH * 6; private const float graph_height = SquareGraph.Column.WIDTH * 6;
private static readonly Vector2 handle_size = new Vector2(10, 18); private const float handle_height = 18;
private static readonly Vector2 handle_size = new Vector2(10, handle_height);
private const float transition_duration = 200; private const float transition_duration = 200;

View File

@ -14,6 +14,7 @@ using osu.Game.Extensions;
using osu.Game.IO; using osu.Game.IO;
using osu.Game.Screens.Play; 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 osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -78,6 +79,23 @@ namespace osu.Game.Skinning
combo.Position = new Vector2(accuracy.ScreenSpaceDeltaToParentSpace(score.ScreenSpaceDrawQuad.Size).X / 2 + horizontal_padding, vertical_offset + 5); combo.Position = new Vector2(accuracy.ScreenSpaceDeltaToParentSpace(score.ScreenSpaceDrawQuad.Size).X / 2 + horizontal_padding, vertical_offset + 5);
combo.Anchor = Anchor.TopCentre; combo.Anchor = Anchor.TopCentre;
} }
var hitError = container.OfType<HitErrorMeter>().FirstOrDefault();
if (hitError != null)
{
hitError.Anchor = Anchor.CentreLeft;
hitError.Origin = Anchor.CentreLeft;
}
var hitError2 = container.OfType<HitErrorMeter>().LastOrDefault();
if (hitError2 != null)
{
hitError2.Anchor = Anchor.CentreRight;
hitError2.Origin = Anchor.CentreLeft;
hitError2.Scale = new Vector2(-1, 1);
}
} }
}) })
{ {
@ -88,6 +106,8 @@ namespace osu.Game.Skinning
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.AccuracyCounter)), GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.AccuracyCounter)),
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.HealthDisplay)), GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.HealthDisplay)),
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.SongProgress)), GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.SongProgress)),
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.BarHitErrorMeter)),
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.BarHitErrorMeter)),
} }
}; };
@ -114,6 +134,12 @@ namespace osu.Game.Skinning
case HUDSkinComponents.SongProgress: case HUDSkinComponents.SongProgress:
return new SongProgress(); return new SongProgress();
case HUDSkinComponents.BarHitErrorMeter:
return new BarHitErrorMeter();
case HUDSkinComponents.ColourHitErrorMeter:
return new ColourHitErrorMeter();
} }
break; break;

View File

@ -10,5 +10,7 @@ namespace osu.Game.Skinning
AccuracyCounter, AccuracyCounter,
HealthDisplay, HealthDisplay,
SongProgress, SongProgress,
BarHitErrorMeter,
ColourHitErrorMeter,
} }
} }

View File

@ -19,6 +19,7 @@ using osu.Game.IO;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play; 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 osuTK.Graphics; using osuTK.Graphics;
namespace osu.Game.Skinning namespace osu.Game.Skinning
@ -342,6 +343,20 @@ namespace osu.Game.Skinning
{ {
accuracy.Y = container.ToLocalSpace(score.ScreenSpaceDrawQuad.BottomRight).Y; accuracy.Y = container.ToLocalSpace(score.ScreenSpaceDrawQuad.BottomRight).Y;
} }
var songProgress = container.OfType<SongProgress>().FirstOrDefault();
var hitError = container.OfType<HitErrorMeter>().FirstOrDefault();
if (hitError != null)
{
hitError.Anchor = Anchor.BottomCentre;
hitError.Origin = Anchor.CentreLeft;
hitError.Rotation = -90;
if (songProgress != null)
hitError.Y -= SongProgress.MAX_HEIGHT;
}
}) })
{ {
Children = new[] Children = new[]
@ -352,6 +367,7 @@ namespace osu.Game.Skinning
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.AccuracyCounter)) ?? new DefaultAccuracyCounter(), GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.AccuracyCounter)) ?? new DefaultAccuracyCounter(),
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.HealthDisplay)) ?? new DefaultHealthDisplay(), GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.HealthDisplay)) ?? new DefaultHealthDisplay(),
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.SongProgress)) ?? new SongProgress(), GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.SongProgress)) ?? new SongProgress(),
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.BarHitErrorMeter)) ?? new BarHitErrorMeter(),
} }
}; };