mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 05:43:21 +08:00
Merge branch 'master' into partial-judgements
This commit is contained in:
commit
14fcc197e9
@ -1 +1 @@
|
|||||||
Subproject commit 7ae3cf1a10fa973a49995a71cbaf768702be1cce
|
Subproject commit 415884e7e19f9062a4fac457a7ce19b566fa2ee7
|
@ -8,6 +8,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Game.Graphics.Backgrounds;
|
using osu.Game.Graphics.Backgrounds;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
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.
|
/// a rounded (_[-Width-]_) figure such that a regular "circle" is the result of a parent with Width = 0.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CirclePiece : Container
|
public class CirclePiece : Container, IHasAccentColour
|
||||||
{
|
{
|
||||||
public const float SYMBOL_SIZE = TaikoHitObject.CIRCLE_RADIUS * 2f * 0.45f;
|
public const float SYMBOL_SIZE = TaikoHitObject.CIRCLE_RADIUS * 2f * 0.45f;
|
||||||
public const float SYMBOL_BORDER = 8;
|
public const float SYMBOL_BORDER = 8;
|
||||||
|
34
osu.Game/Graphics/IHasAccentColour.cs
Normal file
34
osu.Game/Graphics/IHasAccentColour.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// 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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasAccentColour : IDrawable
|
||||||
|
{
|
||||||
|
Color4 AccentColour { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AccentedColourExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Tweens the accent colour of a drawable to another colour.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="accentedDrawable">The drawable to apply the accent colour to.</param>
|
||||||
|
/// <param name="newColour">The new accent colour.</param>
|
||||||
|
/// <param name="duration">The tween duration.</param>
|
||||||
|
/// <param name="easing">The tween easing.</param>
|
||||||
|
public static void FadeAccent(this IHasAccentColour accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None)
|
||||||
|
{
|
||||||
|
accentedDrawable.TransformTo(accentedDrawable.AccentColour, newColour, duration, easing, new TransformAccent());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
37
osu.Game/Graphics/Transforms/TransformAccent.cs
Normal file
37
osu.Game/Graphics/Transforms/TransformAccent.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// 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<Color4>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Current value of the transformed colour in linear colour space.
|
||||||
|
/// </summary>
|
||||||
|
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 IHasAccentColour;
|
||||||
|
if (accented != null)
|
||||||
|
accented.AccentColour = CurrentValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -82,7 +82,9 @@
|
|||||||
<Compile Include="Graphics\Backgrounds\Triangles.cs" />
|
<Compile Include="Graphics\Backgrounds\Triangles.cs" />
|
||||||
<Compile Include="Graphics\Cursor\CursorTrail.cs" />
|
<Compile Include="Graphics\Cursor\CursorTrail.cs" />
|
||||||
<Compile Include="Graphics\Cursor\GameplayCursor.cs" />
|
<Compile Include="Graphics\Cursor\GameplayCursor.cs" />
|
||||||
|
<Compile Include="Graphics\IHasAccentColour.cs" />
|
||||||
<Compile Include="Graphics\Sprites\OsuSpriteText.cs" />
|
<Compile Include="Graphics\Sprites\OsuSpriteText.cs" />
|
||||||
|
<Compile Include="Graphics\Transforms\TransformAccent.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\BackButton.cs" />
|
<Compile Include="Graphics\UserInterface\BackButton.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\FocusedTextBox.cs" />
|
<Compile Include="Graphics\UserInterface\FocusedTextBox.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\Nub.cs" />
|
<Compile Include="Graphics\UserInterface\Nub.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user