mirror of
https://github.com/ppy/osu.git
synced 2025-01-31 23:52:55 +08:00
Update Health display design.
This commit is contained in:
parent
9a2beb5979
commit
ca6946c7a2
@ -1,23 +1,29 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
|
||||||
|
|
||||||
using OpenTK;
|
using System;
|
||||||
using OpenTK.Graphics;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Transformations;
|
using osu.Framework.Graphics.Transformations;
|
||||||
using System;
|
using osu.Game.Graphics;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Modes.UI
|
namespace osu.Game.Modes.UI
|
||||||
{
|
{
|
||||||
public class HealthDisplay : Container
|
public class HealthDisplay : Container
|
||||||
{
|
{
|
||||||
private Box background;
|
private Box background;
|
||||||
private Box fill;
|
private Container fill;
|
||||||
|
|
||||||
public BindableDouble Current = new BindableDouble() { MinValue = 0, MaxValue = 1 };
|
public BindableDouble Current = new BindableDouble()
|
||||||
|
{
|
||||||
|
MinValue = 0,
|
||||||
|
MaxValue = 1
|
||||||
|
};
|
||||||
|
|
||||||
public HealthDisplay()
|
public HealthDisplay()
|
||||||
{
|
{
|
||||||
@ -26,19 +32,38 @@ namespace osu.Game.Modes.UI
|
|||||||
background = new Box
|
background = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Gray,
|
Colour = Color4.Black,
|
||||||
},
|
},
|
||||||
fill = new Box
|
fill = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.White,
|
|
||||||
Scale = new Vector2(0, 1),
|
Scale = new Vector2(0, 1),
|
||||||
|
Masking = true,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Current.ValueChanged += current_ValueChanged;
|
Current.ValueChanged += current_ValueChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[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)
|
private void current_ValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
fill.ScaleTo(new Vector2((float)Current, 1), 200, EasingTypes.OutQuint);
|
fill.ScaleTo(new Vector2((float)Current, 1), 200, EasingTypes.OutQuint);
|
||||||
|
@ -27,9 +27,9 @@ namespace osu.Game.Modes.UI
|
|||||||
protected abstract ScoreCounter CreateScoreCounter();
|
protected abstract ScoreCounter CreateScoreCounter();
|
||||||
protected virtual HealthDisplay CreateHealthDisplay() => new HealthDisplay
|
protected virtual HealthDisplay CreateHealthDisplay() => new HealthDisplay
|
||||||
{
|
{
|
||||||
Size = new Vector2(0.5f, 20),
|
Size = new Vector2(1, 5),
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Padding = new MarginPadding(5)
|
Margin = new MarginPadding { Top = 20 }
|
||||||
};
|
};
|
||||||
|
|
||||||
public virtual void OnHit(HitObject h)
|
public virtual void OnHit(HitObject h)
|
||||||
|
Loading…
Reference in New Issue
Block a user