mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:47:26 +08:00
Change HealthDisplay
to be a CompositeDrawable
This commit is contained in:
parent
bf65547eec
commit
2396ba42a6
@ -1,11 +1,13 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
@ -50,9 +52,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
});
|
});
|
||||||
|
|
||||||
AddStep("set health to 0.10", () => layer.Current.Value = 0.1);
|
AddStep("set health to 0.10", () => layer.Current.Value = 0.1);
|
||||||
AddUntilStep("layer fade is visible", () => layer.Child.Alpha > 0.1f);
|
AddUntilStep("layer fade is visible", () => layer.ChildrenOfType<Container>().First().Alpha > 0.1f);
|
||||||
AddStep("set health to 1", () => layer.Current.Value = 1f);
|
AddStep("set health to 1", () => layer.Current.Value = 1f);
|
||||||
AddUntilStep("layer fade is invisible", () => !layer.Child.IsPresent);
|
AddUntilStep("layer fade is invisible", () => !layer.ChildrenOfType<Container>().First().IsPresent);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -78,7 +78,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Margin = new MarginPadding { Top = 20 };
|
Margin = new MarginPadding { Top = 20 };
|
||||||
|
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
public FailingLayer()
|
public FailingLayer()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
boxes = new Container
|
boxes = new Container
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
/// A container for components displaying the current player health.
|
/// A container for components displaying the current player health.
|
||||||
/// Gets bound automatically to the <see cref="Rulesets.Scoring.HealthProcessor"/> when inserted to <see cref="DrawableRuleset.Overlays"/> hierarchy.
|
/// Gets bound automatically to the <see cref="Rulesets.Scoring.HealthProcessor"/> when inserted to <see cref="DrawableRuleset.Overlays"/> hierarchy.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class HealthDisplay : Container
|
public abstract class HealthDisplay : CompositeDrawable
|
||||||
{
|
{
|
||||||
private Bindable<bool> showHealthbar;
|
private Bindable<bool> showHealthbar;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user