mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Rename to StandardComboCounter, add HealthDisplay abstraction.
This commit is contained in:
@ -1,25 +1,14 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
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;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.UI
|
||||
{
|
||||
public class HealthDisplay : Container
|
||||
internal abstract class HealthDisplay : Container
|
||||
{
|
||||
private Container fill;
|
||||
|
||||
public BindableDouble Current = new BindableDouble
|
||||
public readonly BindableDouble Current = new BindableDouble
|
||||
{
|
||||
MinValue = 0,
|
||||
MaxValue = 1
|
||||
@ -27,46 +16,9 @@ namespace osu.Game.Modes.UI
|
||||
|
||||
public HealthDisplay()
|
||||
{
|
||||
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,
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Current.ValueChanged += current_ValueChanged;
|
||||
Current.ValueChanged += (s, e) => setHP((float)Current);
|
||||
}
|
||||
|
||||
[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
|
||||
};
|
||||
}
|
||||
|
||||
private void current_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
fill.ScaleTo(new Vector2((float)Current, 1), 200, EasingTypes.OutQuint);
|
||||
}
|
||||
protected abstract void setHP(float value);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user