1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-23 07:27:24 +08:00
osu-lazer/osu.Game/Modes/UI/StandardHealthDisplay.cs

61 lines
1.8 KiB
C#
Raw Normal View History

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transforms;
using osu.Game.Graphics;
namespace osu.Game.Modes.UI
{
2017-03-10 12:02:50 +08:00
internal class StandardHealthDisplay : HealthDisplay
{
private Container fill;
public StandardHealthDisplay()
{
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
},
fill = new Container
{
RelativeSizeAxes = Axes.Both,
Scale = new Vector2(0, 1),
Masking = true,
Children = new[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
}
}
},
};
}
[BackgroundDependencyLoader]
private void laod(OsuColour colours)
{
fill.Colour = colours.BlueLighter;
fill.EdgeEffect = new EdgeEffect
{
Colour = colours.BlueDarker.Opacity(0.6f),
Radius = 8,
Type = EdgeEffectType.Glow
};
}
2017-03-10 12:02:50 +08:00
protected override void SetHP(float value) => fill.ScaleTo(new Vector2(value, 1), 200, EasingTypes.OutQuint);
}
}