mirror of
https://github.com/ppy/osu.git
synced 2025-01-22 08:32:54 +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;
|
Current.Value = DisplayedCount = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
|
||||||
DisplayedCountSpriteText.Colour = colours.BlueLighter;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string FormatCount(double count)
|
protected override string FormatCount(double count)
|
||||||
{
|
{
|
||||||
return $@"{count:P2}";
|
return $@"{count:P2}";
|
||||||
|
@ -10,10 +10,11 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
public abstract class RollingCounter<T> : Container
|
public abstract class RollingCounter<T> : Container, IHasAccentColour
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current value.
|
/// The current value.
|
||||||
@ -80,6 +81,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Color4 AccentColour
|
||||||
|
{
|
||||||
|
get { return DisplayedCountSpriteText.Colour; }
|
||||||
|
set { DisplayedCountSpriteText.Colour = value; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Skeleton of a numeric counter which value rolls over time.
|
/// Skeleton of a numeric counter which value rolls over time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -35,12 +35,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
LeadingZeroes = leading;
|
LeadingZeroes = leading;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
|
||||||
DisplayedCountSpriteText.Colour = colours.BlueLighter;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override double GetProportionalDuration(double currentValue, double newValue)
|
protected override double GetProportionalDuration(double currentValue, double newValue)
|
||||||
{
|
{
|
||||||
return currentValue > newValue ? currentValue - newValue : newValue - currentValue;
|
return currentValue > newValue ? currentValue - newValue : newValue - currentValue;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Transforms;
|
using osu.Framework.Graphics.Transforms;
|
||||||
@ -38,12 +39,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Current.Value = Current + amount;
|
Current.Value = Current + amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
|
||||||
DisplayedCountSpriteText.Colour = colours.BlueLighter;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected class TransformCount : Transform<int>
|
protected class TransformCount : Transform<int>
|
||||||
{
|
{
|
||||||
public override int CurrentValue
|
public override int CurrentValue
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -12,10 +13,35 @@ using osu.Game.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Modes.UI
|
namespace osu.Game.Modes.UI
|
||||||
{
|
{
|
||||||
public class StandardHealthDisplay : HealthDisplay
|
public class StandardHealthDisplay : HealthDisplay, IHasAccentColour
|
||||||
{
|
{
|
||||||
private readonly Container fill;
|
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()
|
public StandardHealthDisplay()
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
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);
|
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
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
@ -53,5 +56,20 @@ namespace osu.Game.Modes.UI
|
|||||||
TextSize = 40,
|
TextSize = 40,
|
||||||
Position = new Vector2(0, 30),
|
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