diff --git a/osu-framework b/osu-framework index 269a1fd192..3931f8e358 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 269a1fd192c573d558a5ab0ff990a8b462947287 +Subproject commit 3931f8e358365b1853a76e1d141fcf4c929a2143 diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs index 59eebce28e..52dad28d31 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Backgrounds; using OpenTK.Graphics; using System; +using osu.Game.Graphics; namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces { @@ -18,7 +19,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces /// a rounded (_[-Width-]_) figure such that a regular "circle" is the result of a parent with Width = 0. /// /// - public class CirclePiece : Container + public class CirclePiece : Container, IAccented { public const float SYMBOL_SIZE = TaikoHitObject.CIRCLE_RADIUS * 2f * 0.45f; public const float SYMBOL_BORDER = 8; diff --git a/osu.Game/Graphics/IAccented.cs b/osu.Game/Graphics/IAccented.cs new file mode 100644 index 0000000000..6f0f107f3c --- /dev/null +++ b/osu.Game/Graphics/IAccented.cs @@ -0,0 +1,36 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Game.Graphics.Transforms; + +namespace osu.Game.Graphics +{ + /// + /// A type of drawable that has an accent colour. + /// The accent colour is used to colorize various objects inside a drawable + /// without colorizing the drawable itself. + /// + public interface IAccented : IDrawable + { + Color4 AccentColour { get; set; } + } + + public static class AccentedExtensions + { + /// + /// Tweens the accent colour of a drawable to another colour. + /// + /// The type of drawable. + /// The drawable to apply the accent colour to. + /// The new accent colour. + /// The tween duration. + /// The tween easing. + public static void FadeAccent(this TDrawable drawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None) + where TDrawable : Drawable, IAccented + { + drawable.TransformTo(drawable.AccentColour, newColour, duration, easing, new TransformAccent()); + } + } +} diff --git a/osu.Game/Graphics/Transforms/TransformAccent.cs b/osu.Game/Graphics/Transforms/TransformAccent.cs new file mode 100644 index 0000000000..7f40a0a016 --- /dev/null +++ b/osu.Game/Graphics/Transforms/TransformAccent.cs @@ -0,0 +1,37 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Transforms; +using osu.Framework.MathUtils; + +namespace osu.Game.Graphics.Transforms +{ + public class TransformAccent : Transform + { + /// + /// Current value of the transformed colour in linear colour space. + /// + public override Color4 CurrentValue + { + get + { + double time = Time?.Current ?? 0; + if (time < StartTime) return StartValue; + if (time >= EndTime) return EndValue; + + return Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing); + } + } + + public override void Apply(Drawable d) + { + base.Apply(d); + + var accented = d as IAccented; + if (accented != null) + accented.AccentColour = CurrentValue; + } + } +} diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index 66c9e7d461..c32b654840 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -47,7 +47,7 @@ namespace osu.Game.Graphics.UserInterface protected class TransformAccuracy : Transform { - protected override double CurrentValue + public override double CurrentValue { get { diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index c9a1040185..c2b1b026b6 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -51,7 +51,7 @@ namespace osu.Game.Graphics.UserInterface protected class TransformScore : Transform { - protected override double CurrentValue + public override double CurrentValue { get { diff --git a/osu.Game/Modes/UI/ComboCounter.cs b/osu.Game/Modes/UI/ComboCounter.cs index f831677e44..3629634889 100644 --- a/osu.Game/Modes/UI/ComboCounter.cs +++ b/osu.Game/Modes/UI/ComboCounter.cs @@ -213,7 +213,7 @@ namespace osu.Game.Modes.UI protected class TransformComboRoll : Transform { - protected override int CurrentValue + public override int CurrentValue { get { diff --git a/osu.Game/Modes/UI/ComboResultCounter.cs b/osu.Game/Modes/UI/ComboResultCounter.cs index 957a720c94..63009c5351 100644 --- a/osu.Game/Modes/UI/ComboResultCounter.cs +++ b/osu.Game/Modes/UI/ComboResultCounter.cs @@ -36,7 +36,7 @@ namespace osu.Game.Modes.UI protected class TransformComboResult : Transform { - protected override ulong CurrentValue + public override ulong CurrentValue { get { diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index a5bdf1df69..00c189d01c 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -82,7 +82,9 @@ + +