1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-23 16:27:20 +08:00

Rename RoundedLine to BoxElement and make more generically useful

This commit is contained in:
Dean Herbert 2023-11-10 16:04:28 +09:00
parent 4f90ac15fa
commit 60df2722ab
No known key found for this signature in database
3 changed files with 52 additions and 20 deletions

View File

@ -116,7 +116,7 @@ namespace osu.Game.Skinning
var skinnableTargetWrapper = new DefaultSkinComponentsContainer(container =>
{
var health = container.OfType<ArgonHealthDisplay>().FirstOrDefault();
var healthLine = container.OfType<RoundedLine>().FirstOrDefault();
var healthLine = container.OfType<BoxElement>().FirstOrDefault();
var scoreWedge = container.OfType<ArgonScoreWedge>().FirstOrDefault();
var score = container.OfType<ArgonScoreCounter>().FirstOrDefault();
var accuracy = container.OfType<ArgonAccuracyCounter>().FirstOrDefault();
@ -213,7 +213,7 @@ namespace osu.Game.Skinning
new ArgonScoreWedge(),
new ArgonScoreCounter(),
new ArgonHealthDisplay(),
new RoundedLine(),
new BoxElement(),
new ArgonAccuracyCounter(),
new ArgonComboCounter(),
new BarHitErrorMeter(),

View File

@ -0,0 +1,50 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Configuration;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Skinning.Components
{
public partial class BoxElement : CompositeDrawable, ISerialisableDrawable
{
public bool UsesFixedAnchor { get; set; }
[SettingSource("Corner rounding", "How round the corners of the box should be.")]
public BindableFloat CornerRounding { get; } = new BindableFloat(1)
{
Precision = 0.01f,
MinValue = 0,
MaxValue = 1,
};
public BoxElement()
{
Size = new Vector2(400, 80);
InternalChildren = new Drawable[]
{
new Box
{
Colour = Color4.White,
RelativeSizeAxes = Axes.Both,
},
};
Masking = true;
}
protected override void Update()
{
base.Update();
CornerRadius = CornerRounding.Value * Math.Min(DrawWidth, DrawHeight) * 0.5f;
}
}
}

View File

@ -1,18 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics.Shapes;
using osuTK;
namespace osu.Game.Skinning.Components
{
public partial class RoundedLine : Circle, ISerialisableDrawable
{
public bool UsesFixedAnchor { get; set; }
public RoundedLine()
{
Size = new Vector2(200, 8);
}
}
}