mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 05:02:55 +08:00
Expose AccentColour/GlowColour from hud elements, and set from HudOverlay.
This commit is contained in:
parent
2987a57588
commit
3054697f98
@ -31,12 +31,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Current.Value = DisplayedCount = 1.0f;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
DisplayedCountSpriteText.Colour = colours.BlueLighter;
|
||||
}
|
||||
|
||||
protected override string FormatCount(double count)
|
||||
{
|
||||
return $@"{count:P2}";
|
||||
|
@ -10,10 +10,11 @@ using osu.Game.Graphics.Sprites;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public abstract class RollingCounter<T> : Container
|
||||
public abstract class RollingCounter<T> : Container, IHasAccentColour
|
||||
{
|
||||
/// <summary>
|
||||
/// The current value.
|
||||
@ -80,6 +81,12 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
}
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return DisplayedCountSpriteText.Colour; }
|
||||
set { DisplayedCountSpriteText.Colour = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Skeleton of a numeric counter which value rolls over time.
|
||||
/// </summary>
|
||||
|
@ -35,12 +35,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
LeadingZeroes = leading;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
DisplayedCountSpriteText.Colour = colours.BlueLighter;
|
||||
}
|
||||
|
||||
protected override double GetProportionalDuration(double currentValue, double newValue)
|
||||
{
|
||||
return currentValue > newValue ? currentValue - newValue : newValue - currentValue;
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
@ -38,12 +39,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Current.Value = Current + amount;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
DisplayedCountSpriteText.Colour = colours.BlueLighter;
|
||||
}
|
||||
|
||||
protected class TransformCount : Transform<int>
|
||||
{
|
||||
public override int CurrentValue
|
||||
|
@ -1,6 +1,7 @@
|
||||
// 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 OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
@ -12,10 +13,35 @@ using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.UI
|
||||
{
|
||||
public class StandardHealthDisplay : HealthDisplay
|
||||
public class StandardHealthDisplay : HealthDisplay, IHasAccentColour
|
||||
{
|
||||
private readonly Container fill;
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return fill.Colour; }
|
||||
set { fill.Colour = value; }
|
||||
}
|
||||
|
||||
private Color4 glowColour;
|
||||
public Color4 GlowColour
|
||||
{
|
||||
get { return glowColour; }
|
||||
set
|
||||
{
|
||||
if (glowColour == value)
|
||||
return;
|
||||
glowColour = value;
|
||||
|
||||
fill.EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Colour = glowColour,
|
||||
Radius = 8,
|
||||
Type = EdgeEffectType.Glow
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public StandardHealthDisplay()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
@ -41,18 +67,6 @@ namespace osu.Game.Modes.UI
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
fill.Colour = colours.BlueLighter;
|
||||
fill.EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Colour = colours.BlueDarker.Opacity(0.6f),
|
||||
Radius = 8,
|
||||
Type = EdgeEffectType.Glow
|
||||
};
|
||||
}
|
||||
|
||||
protected override void SetHealth(float value) => fill.ScaleTo(new Vector2(value, 1), 200, EasingTypes.OutQuint);
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,11 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Play;
|
||||
|
||||
@ -53,5 +56,20 @@ namespace osu.Game.Modes.UI
|
||||
TextSize = 40,
|
||||
Position = new Vector2(0, 30),
|
||||
};
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
ComboCounter.AccentColour = colours.BlueLighter;
|
||||
AccuracyCounter.AccentColour = colours.BlueLighter;
|
||||
ScoreCounter.AccentColour = colours.BlueLighter;
|
||||
|
||||
var shd = HealthDisplay as StandardHealthDisplay;
|
||||
if (shd != null)
|
||||
{
|
||||
shd.AccentColour = colours.BlueLighter;
|
||||
shd.GlowColour = colours.BlueDarker.Opacity(0.6f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user