2017-01-10 16:01:53 +08:00
|
|
|
|
using OpenTK;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
using osu.Framework.Configuration;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Framework.Graphics.Transformations;
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Modes.UI
|
|
|
|
|
{
|
2017-01-18 11:08:16 +08:00
|
|
|
|
public class HealthDisplay : Container
|
2017-01-10 16:01:53 +08:00
|
|
|
|
{
|
|
|
|
|
private Box background;
|
|
|
|
|
private Box fill;
|
|
|
|
|
|
2017-01-18 13:40:13 +08:00
|
|
|
|
public BindableDouble Current = new BindableDouble();
|
|
|
|
|
|
2017-01-18 11:08:16 +08:00
|
|
|
|
public HealthDisplay()
|
2017-01-10 16:01:53 +08:00
|
|
|
|
{
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
background = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Gray,
|
|
|
|
|
},
|
|
|
|
|
fill = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.White,
|
2017-01-10 17:21:07 +08:00
|
|
|
|
Scale = new Vector2(0, 1),
|
2017-01-10 16:01:53 +08:00
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2017-01-18 13:40:13 +08:00
|
|
|
|
Current.ValueChanged += current_ValueChanged;
|
|
|
|
|
}
|
2017-01-10 16:01:53 +08:00
|
|
|
|
|
2017-01-18 13:40:13 +08:00
|
|
|
|
private void current_ValueChanged(object sender, EventArgs e)
|
2017-01-10 16:01:53 +08:00
|
|
|
|
{
|
|
|
|
|
fill.ScaleTo(new Vector2((float)Current, 1), 200, EasingTypes.OutQuint);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|