1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 00:02:54 +08:00

Set defaults on SkinnableHUDComponent to cancel out relative size default

Specifying locally on each HUD component looks to make more sense.
This commit is contained in:
Dean Herbert 2021-04-28 18:06:59 +09:00
parent 2540d6029c
commit defa350aa7
6 changed files with 14 additions and 27 deletions

View File

@ -36,32 +36,6 @@ namespace osu.Game.Tests.Visual.Gameplay
[Resolved]
private OsuConfigManager config { get; set; }
protected override void LoadComplete()
{
base.LoadComplete();
Add(new Container
{
RelativeSizeAxes = Axes.Both,
Width = 0.3f,
Children = new Drawable[]
{
new Box
{
Colour = Color4.Black,
RelativeSizeAxes = Axes.Both,
Alpha = 0.9f,
},
new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children = createSkinSourceComponents(),
},
}
});
}
[Test]
public void TestComboCounterIncrementing()
{

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Skinning;
namespace osu.Game.Screens.Play.HUD
@ -14,6 +15,7 @@ namespace osu.Game.Screens.Play.HUD
: base(new HUDSkinComponent(HUDSkinComponents.AccuracyCounter), _ => new DefaultAccuracyCounter())
{
CentreComponent = false;
AutoSizeAxes = Axes.Both;
}
private IAccuracyCounter skinnedCounter;

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Skinning;
namespace osu.Game.Screens.Play.HUD
@ -14,6 +15,7 @@ namespace osu.Game.Screens.Play.HUD
: base(new HUDSkinComponent(HUDSkinComponents.ComboCounter), skinComponent => new DefaultComboCounter())
{
CentreComponent = false;
AutoSizeAxes = Axes.Both;
}
private IComboCounter skinnedCounter;

View File

@ -46,8 +46,11 @@ namespace osu.Game.Screens.Play.HUD
SkinRotation.BindValueChanged(rotation => Rotation = rotation.NewValue);
SkinAnchor.BindValueChanged(anchor => { Anchor = anchor.NewValue; });
// reset everything and require each component to specify what they want,
// as if they were just drawables. maybe we want to change SkinnableDrawable to not default
// to RelativeSizeAxes.Both...
RelativeSizeAxes = Axes.None;
AutoSizeAxes = Axes.Both;
AutoSizeAxes = Axes.None;
}
protected override bool OnInvalidate(Invalidation invalidation, InvalidationSource source)
@ -58,6 +61,7 @@ namespace osu.Game.Screens.Play.HUD
SkinPositionY.Value = Position.Y;
SkinRotation.Value = Rotation;
SkinAnchor.Value = Anchor;
return base.OnInvalidate(invalidation, source);
}
}

View File

@ -3,6 +3,7 @@
using System;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
@ -35,6 +36,8 @@ namespace osu.Game.Screens.Play.HUD
: base(new HUDSkinComponent(HUDSkinComponents.HealthDisplay), _ => new DefaultHealthDisplay())
{
CentreComponent = false;
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
}
private IHealthDisplay skinnedCounter;

View File

@ -4,6 +4,7 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
@ -22,6 +23,7 @@ namespace osu.Game.Screens.Play.HUD
: base(new HUDSkinComponent(HUDSkinComponents.ScoreCounter), _ => new DefaultScoreCounter())
{
CentreComponent = false;
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]