1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 03:22:55 +08:00

Merge branch 'master' into fix-invalid-depth

This commit is contained in:
Dean Herbert 2017-06-23 14:48:12 +09:00 committed by GitHub
commit a0e7751cd1
130 changed files with 536 additions and 188 deletions

@ -1 +1 @@
Subproject commit 3dd751659b5f8e3267146db1557ec43d77456b8e
Subproject commit eed53d35f999ae08a6d233c046aa333a7623c5f0

View File

@ -6,7 +6,7 @@ using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Testing;

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.MathUtils;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Screens.Play;

View File

@ -3,9 +3,9 @@
using osu.Framework.Testing;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Sprites;
using osu.Game.Screens.Menu;
using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Desktop.VisualTests.Tests
{

View File

@ -7,7 +7,6 @@ using osu.Framework.Allocation;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using OpenTK;
using osu.Framework.Graphics.Sprites;
using osu.Game.Database;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Objects;
@ -15,6 +14,7 @@ using osu.Game.Screens.Play;
using OpenTK.Graphics;
using osu.Desktop.VisualTests.Beatmaps;
using osu.Game.Rulesets.Osu.UI;
using osu.Framework.Graphics.Shapes;
namespace osu.Desktop.VisualTests.Tests
{

View File

@ -6,6 +6,7 @@ using OpenTK.Graphics;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Testing;
@ -125,6 +126,8 @@ namespace osu.Desktop.VisualTests.Tests
private class TestSpeedAdjustmentContainer : SpeedAdjustmentContainer
{
public override bool RemoveWhenNotAlive => false;
public TestSpeedAdjustmentContainer(MultiplierControlPoint controlPoint)
: base(controlPoint)
{
@ -150,11 +153,13 @@ namespace osu.Desktop.VisualTests.Tests
}
}
private class TestDrawableHitObject : DrawableHitObject
private class TestDrawableHitObject : DrawableHitObject, IScrollingHitObject
{
private readonly Box background;
private const float height = 14;
public BindableDouble LifetimeOffset { get; } = new BindableDouble();
public TestDrawableHitObject(HitObject hitObject)
: base(hitObject)
{
@ -195,25 +200,11 @@ namespace osu.Desktop.VisualTests.Tests
FadeInFromZero(250, EasingTypes.OutQuint);
}
private bool hasExpired;
protected override void Update()
{
base.Update();
if (Time.Current >= HitObject.StartTime)
{
background.Colour = Color4.Red;
if (!hasExpired)
{
using (BeginDelayedSequence(200))
{
FadeOut(200);
Expire();
}
hasExpired = true;
}
}
}
}
}

View File

@ -10,6 +10,7 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using Squirrel;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Graphics;

View File

@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.UI;
using OpenTK;

View File

@ -3,7 +3,7 @@
using OpenTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Objects.Drawables

View File

@ -7,9 +7,9 @@ using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Mania.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Mania.Objects.Drawables
{

View File

@ -6,12 +6,11 @@ using OpenTK.Input;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Mania.Judgements;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
public abstract class DrawableManiaHitObject<TObject> : DrawableHitObject<ManiaHitObject, ManiaJudgement>
public abstract class DrawableManiaHitObject<TObject> : DrawableScrollingHitObject<ManiaHitObject, ManiaJudgement>
where TObject : ManiaHitObject
{
/// <summary>
@ -33,13 +32,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
Y = (float)HitObject.StartTime;
}
protected override void LoadComplete()
{
base.LoadComplete();
LifetimeStart = HitObject.StartTime - ManiaPlayfield.TIME_SPAN_MAX;
}
public override Color4 AccentColour
{
get { return base.AccentColour; }

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
public DrawableNote(Note hitObject, Bindable<Key> key = null)
: base(hitObject, key)
{
RelativeSizeAxes = Axes.Both;
RelativeSizeAxes = Axes.X;
Height = 100;
Add(headPiece = new NotePiece

View File

@ -4,7 +4,7 @@
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces

View File

@ -5,7 +5,7 @@ using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces

View File

@ -7,7 +7,7 @@ using OpenTK.Input;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Colour;
using osu.Framework.Input;
using osu.Game.Graphics;

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.UI;
using OpenTK;
@ -22,6 +21,7 @@ using osu.Framework.MathUtils;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Timing;
using osu.Framework.Configuration;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Mania.UI
{
@ -30,8 +30,8 @@ namespace osu.Game.Rulesets.Mania.UI
public const float HIT_TARGET_POSITION = 50;
private const double time_span_default = 1500;
public const double TIME_SPAN_MIN = 50;
public const double TIME_SPAN_MAX = 10000;
private const double time_span_min = 50;
private const double time_span_max = 10000;
private const double time_span_step = 50;
/// <summary>
@ -60,8 +60,8 @@ namespace osu.Game.Rulesets.Mania.UI
private readonly BindableDouble visibleTimeRange = new BindableDouble(time_span_default)
{
MinValue = TIME_SPAN_MIN,
MaxValue = TIME_SPAN_MAX
MinValue = time_span_min,
MaxValue = time_span_max
};
private readonly SpeedAdjustmentCollection barLineContainer;
@ -245,7 +245,7 @@ namespace osu.Game.Rulesets.Mania.UI
barLineContainer.Width = columns.Width;
}
private class TransformTimeSpan : Transform<double>
private class TransformTimeSpan : Transform<double, Drawable>
{
public override double CurrentValue
{

View File

@ -6,7 +6,7 @@ using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
{

View File

@ -3,11 +3,11 @@
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Judgements;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{

View File

@ -3,8 +3,8 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Sprites;
using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{

View File

@ -3,9 +3,9 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{

View File

@ -3,7 +3,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using OpenTK.Graphics;

View File

@ -4,7 +4,7 @@
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces

View File

@ -5,9 +5,9 @@ using System;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{

View File

@ -3,7 +3,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using OpenTK;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables

View File

@ -3,8 +3,8 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{

View File

@ -7,7 +7,6 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Judgements;
@ -15,6 +14,7 @@ using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{

View File

@ -3,8 +3,8 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
{

View File

@ -4,7 +4,7 @@
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Backgrounds;
using OpenTK.Graphics;
using osu.Game.Beatmaps.ControlPoints;

View File

@ -3,9 +3,9 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
{

View File

@ -3,9 +3,9 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
{

View File

@ -6,7 +6,7 @@ using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Rulesets.Taiko.Judgements;
using osu.Game.Rulesets.Taiko.Objects;

View File

@ -5,7 +5,7 @@ using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Taiko.Objects;
namespace osu.Game.Rulesets.Taiko.UI

View File

@ -5,7 +5,7 @@ using OpenTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Rulesets.Taiko.Judgements;
using osu.Game.Rulesets.Taiko.Objects;

View File

@ -3,7 +3,7 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.UI;
using OpenTK;

View File

@ -14,6 +14,7 @@ using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Input;
using osu.Game.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Beatmaps.Drawables
{

View File

@ -12,6 +12,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Beatmaps.Drawables
{

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.MathUtils;
using OpenTK;
using OpenTK.Graphics;
@ -56,7 +55,7 @@ namespace osu.Game.Graphics.Backgrounds
/// <summary>
/// Whether we should drop-off alpha values of triangles more quickly to improve
/// the visual appearance of fading. This defaults to on as it is generally more
/// aesthetically pleasing, but should be turned off in <see cref="BufferedContainer{T}"/>s.
/// aesthetically pleasing, but should be turned off in buffered containers.
/// </summary>
public bool HideAlphaDiscrepancies = true;

View File

@ -9,7 +9,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Game.Beatmaps;
using osu.Game.Configuration;

View File

@ -8,7 +8,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Graphics.Cursor

View File

@ -3,6 +3,7 @@
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transforms;
using osu.Game.Graphics.Transforms;
namespace osu.Game.Graphics
@ -26,7 +27,8 @@ namespace osu.Game.Graphics
/// <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)
public static void FadeAccent<T>(this T accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None)
where T : Transformable<Drawable>, IHasAccentColour
{
accentedDrawable.TransformTo(() => accentedDrawable.AccentColour, newColour, duration, easing, new TransformAccent());
}

View File

@ -8,7 +8,7 @@ using osu.Framework.MathUtils;
namespace osu.Game.Graphics.Transforms
{
public class TransformAccent : Transform<Color4>
public class TransformAccent : Transform<Color4, Drawable>
{
/// <summary>
/// Current value of the transformed colour in linear colour space.

View File

@ -5,7 +5,7 @@ using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using System;
namespace osu.Game.Graphics.UserInterface

View File

@ -5,6 +5,7 @@ using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Containers;
using osu.Framework.Audio.Sample;

View File

@ -7,7 +7,7 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
namespace osu.Game.Graphics.UserInterface

View File

@ -7,7 +7,7 @@ using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Graphics.UserInterface

View File

@ -5,6 +5,7 @@ using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;

View File

@ -3,9 +3,9 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Graphics.UserInterface
{

View File

@ -9,10 +9,10 @@ using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Graphics.UserInterface
{

View File

@ -9,6 +9,7 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;

View File

@ -6,10 +6,11 @@ using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Sprites;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Graphics.UserInterface
{

View File

@ -7,7 +7,7 @@ using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Game.Graphics.Sprites;

View File

@ -45,7 +45,7 @@ namespace osu.Game.Graphics.UserInterface
Current.Value = Current + amount;
}
protected class TransformAccuracy : Transform<double>
protected class TransformAccuracy : Transform<double, Drawable>
{
public override double CurrentValue
{

View File

@ -27,7 +27,7 @@ namespace osu.Game.Graphics.UserInterface
/// <remarks>
/// Must be a subclass of Transform(T)
/// </remarks>
protected virtual Type TransformType => typeof(Transform<T>);
protected virtual Type TransformType => typeof(Transform<T, Drawable>);
protected SpriteText DisplayedCountSpriteText;
@ -181,17 +181,17 @@ namespace osu.Game.Graphics.UserInterface
protected virtual void TransformCount(T currentValue, T newValue)
{
Debug.Assert(
typeof(Transform<T>).IsAssignableFrom(TransformType),
typeof(Transform<T, Drawable>).IsAssignableFrom(TransformType),
@"transformType should be a subclass of Transform<T>."
);
TransformCount((Transform<T>)Activator.CreateInstance(TransformType), currentValue, newValue);
TransformCount((Transform<T, Drawable>)Activator.CreateInstance(TransformType), currentValue, newValue);
}
/// <summary>
/// Intended to be used by TransformCount(T currentValue, T newValue).
/// </summary>
protected void TransformCount(Transform<T> transform, T currentValue, T newValue)
protected void TransformCount(Transform<T, Drawable> transform, T currentValue, T newValue)
{
Type type = transform.GetType();

View File

@ -56,7 +56,7 @@ namespace osu.Game.Graphics.UserInterface
Current.Value = Current + amount;
}
protected class TransformScore : Transform<double>
protected class TransformScore : Transform<double, Drawable>
{
public override double CurrentValue
{

View File

@ -37,7 +37,7 @@ namespace osu.Game.Graphics.UserInterface
Current.Value = Current + amount;
}
private class TransformCounterCount : Transform<int>
private class TransformCounterCount : Transform<int, Drawable>
{
public override int CurrentValue
{

View File

@ -14,6 +14,7 @@ using osu.Game.Graphics.Containers;
using osu.Game.Beatmaps.ControlPoints;
using osu.Framework.Audio.Track;
using System;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Graphics.UserInterface
{

View File

@ -4,11 +4,11 @@
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input;
using osu.Game.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Graphics.UserInterface.Volume
{

View File

@ -9,7 +9,7 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;

View File

@ -5,6 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;

View File

@ -10,7 +10,7 @@ using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Threading;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;

View File

@ -14,6 +14,7 @@ using osu.Game.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Overlays.Dialog
{

View File

@ -4,9 +4,9 @@
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Dialog;
using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Overlays
{

View File

@ -8,12 +8,12 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Localisation;
using osu.Game.Database;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Overlays.Direct
{

View File

@ -6,7 +6,6 @@ using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Colour;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
@ -16,6 +15,7 @@ using osu.Framework.Localisation;
using osu.Framework.Graphics.Textures;
using System.Linq;
using osu.Framework.Input;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Overlays.Direct
{

View File

@ -4,10 +4,10 @@
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Input;
using OpenTK;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Overlays
{
@ -98,7 +98,7 @@ namespace osu.Game.Overlays
return true;
}
private class TransformSeek : TransformFloat
private class TransformSeek : TransformFloat<Drawable>
{
public override void Apply(Drawable d)
{

View File

@ -4,10 +4,10 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Overlays.Settings.Sections.General;
using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Overlays
{
@ -27,7 +27,8 @@ namespace osu.Game.Overlays
{
Children = new Drawable[]
{
new Box {
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Alpha = 0.6f,

View File

@ -8,7 +8,6 @@ using osu.Framework.Configuration;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Sprites;
@ -17,6 +16,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using osu.Game.Database;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Overlays.Mods
{

View File

@ -10,7 +10,6 @@ using osu.Framework.Configuration;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Graphics;
@ -18,6 +17,7 @@ using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Extensions;
using osu.Framework.Input;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Overlays.Music
{

View File

@ -23,6 +23,7 @@ using osu.Game.Graphics.Sprites;
using osu.Framework.Threading;
using osu.Game.Overlays.Music;
using osu.Game.Graphics.UserInterface;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Overlays
{

View File

@ -6,9 +6,9 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Notifications;
using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Overlays
{

View File

@ -7,12 +7,12 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Input;
using osu.Game.Graphics;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Overlays.Notifications
{

View File

@ -5,6 +5,7 @@ using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;

View File

@ -4,6 +4,7 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;

View File

@ -9,6 +9,7 @@ using osu.Framework.Configuration;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using OpenTK;

View File

@ -8,9 +8,9 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Overlays.SearchableList
{

View File

@ -7,8 +7,8 @@ using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Overlays.SearchableList
{

View File

@ -4,7 +4,7 @@
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Game.Graphics.Backgrounds;

View File

@ -6,6 +6,7 @@ using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;

View File

@ -5,7 +5,7 @@ using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Framework.Threading;
using osu.Game.Overlays.Toolbar;

View File

@ -7,6 +7,7 @@ using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input;
using osu.Game.Graphics;

View File

@ -6,7 +6,7 @@ using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;

View File

@ -6,10 +6,10 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input;
using osu.Game.Graphics;
using OpenTK;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Overlays.Toolbar
{

View File

@ -15,6 +15,7 @@ using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Overlays.Toolbar
{

View File

@ -6,11 +6,11 @@ using osu.Framework.Allocation;
using osu.Framework.Caching;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Database;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Configuration;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Overlays.Toolbar
{

View File

@ -4,7 +4,7 @@
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
namespace osu.Game.Overlays.Toolbar

View File

@ -6,8 +6,8 @@ using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using System;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Overlays
{

View File

@ -184,7 +184,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
private List<DrawableHitObject<TObject, TJudgement>> nestedHitObjects;
protected IEnumerable<DrawableHitObject<TObject, TJudgement>> NestedHitObjects => nestedHitObjects;
protected void AddNested(DrawableHitObject<TObject, TJudgement> h)
protected virtual void AddNested(DrawableHitObject<TObject, TJudgement> h)
{
if (nestedHitObjects == null)
nestedHitObjects = new List<DrawableHitObject<TObject, TJudgement>>();

View File

@ -0,0 +1,49 @@
// 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 osu.Framework.Configuration;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Rulesets.Objects.Drawables
{
/// <summary>
/// A basic class that overrides <see cref="DrawableHitObject{TObject, TJudgement}"/> and implements <see cref="IScrollingHitObject"/>.
/// </summary>
public abstract class DrawableScrollingHitObject<TObject, TJudgement> : DrawableHitObject<TObject, TJudgement>, IScrollingHitObject
where TObject : HitObject
where TJudgement : Judgement
{
public BindableDouble LifetimeOffset { get; } = new BindableDouble();
protected DrawableScrollingHitObject(TObject hitObject)
: base(hitObject)
{
}
public override double LifetimeStart
{
get { return Math.Min(HitObject.StartTime - LifetimeOffset, base.LifetimeStart); }
set { base.LifetimeStart = value; }
}
public override double LifetimeEnd
{
get
{
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
return Math.Max(endTime + LifetimeOffset, base.LifetimeEnd);
}
set { base.LifetimeEnd = value; }
}
protected override void AddNested(DrawableHitObject<TObject, TJudgement> h)
{
var scrollingHitObject = h as IScrollingHitObject;
scrollingHitObject?.LifetimeOffset.BindTo(LifetimeOffset);
base.AddNested(h);
}
}
}

View File

@ -0,0 +1,25 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Configuration;
using osu.Framework.Graphics;
namespace osu.Game.Rulesets.Objects.Drawables
{
/// <summary>
/// An interface that exposes properties required for scrolling hit objects to be properly displayed.
/// </summary>
public interface IScrollingHitObject : IDrawable
{
/// <summary>
/// Time offset before the hit object start time at which this <see cref="IScrollingHitObject"/> becomes visible and the time offset
/// after the hit object's end time after which it expires.
///
/// <para>
/// This provides only a default life time range, however classes inheriting from <see cref="IScrollingHitObject"/> should override
/// their life times if more tight control is desired.
/// </para>
/// </summary>
BindableDouble LifetimeOffset { get; }
}
}

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using OpenTK;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Rulesets.Timing
{
@ -44,14 +45,17 @@ namespace osu.Game.Rulesets.Timing
set { visibleTimeRange.BindTo(value); }
}
protected override IComparer<Drawable> DepthComparer => new HitObjectReverseStartTimeComparer();
/// <summary>
/// Axes through which this timing section scrolls. This is set from <see cref="SpeedAdjustmentContainer"/>.
/// Axes through which this timing section scrolls. This is set by the <see cref="SpeedAdjustmentContainer"/>.
/// </summary>
internal Axes ScrollingAxes;
private Cached layout = new Cached();
/// <summary>
/// The control point that provides the speed adjustments for this container. This is set by the <see cref="SpeedAdjustmentContainer"/>.
/// </summary>
internal MultiplierControlPoint ControlPoint;
protected override IComparer<Drawable> DepthComparer => new HitObjectReverseStartTimeComparer();
/// <summary>
/// Creates a new <see cref="DrawableTimingSection"/>.
@ -71,41 +75,58 @@ namespace osu.Game.Rulesets.Timing
return;
}
layout.Invalidate();
durationBacking.Invalidate();
base.InvalidateFromChild(invalidation);
}
protected override void UpdateAfterChildren()
private Cached<double> durationBacking = new Cached<double>();
/// <summary>
/// The maximum duration of any one hit object inside this <see cref="DrawableTimingSection"/>. This is calculated as the maximum
/// end time between all hit objects relative to this <see cref="DrawableTimingSection"/>'s <see cref="MultiplierControlPoint.StartTime"/>.
/// </summary>
public double Duration => durationBacking.EnsureValid()
? durationBacking.Value
: durationBacking.Refresh(() =>
{
base.UpdateAfterChildren();
if (!Children.Any())
return 0;
if (!layout.EnsureValid())
{
layout.Refresh(() =>
{
if (!Children.Any())
return;
double baseDuration = Children.Max(c => (c.HitObject as IHasEndTime)?.EndTime ?? c.HitObject.StartTime) - ControlPoint.StartTime;
//double maxDuration = Children.Select(c => (c.HitObject as IHasEndTime)?.EndTime ?? c.HitObject.StartTime).Max();
//float width = (float)maxDuration - RelativeChildOffset.X;
//float height = (float)maxDuration - RelativeChildOffset.Y;
// If we have a singular hit object at the timing section's start time, let's set a sane default duration
if (baseDuration == 0)
baseDuration = 1;
// Scrolling ruleset hit objects typically have anchors+origins set to the hit object's start time, but if the hit object doesn't implement IHasEndTime and lies on the control point
// then the baseDuration above will be 0. This will cause problems with masking when it is further set as the value for Size in Update(). We _want_ the timing section bounds to
// completely enclose the hit object to avoid the masking optimisations.
//
// To do this we need to find a duration that corresponds to the absolute size of the element that extrudes beyond the timing section's bounds and add that to baseDuration.
// We can utilize the fact that the Size and RelativeChildSpace are 1:1, meaning that an change in duration for the timing section has no change to the hit object's positioning
// and simply find the largest absolutely-sized element in this timing section. This introduces a little bit of error, but will never under-estimate the duration.
// Auto-size to the total size of our children
// This ends up being the total duration of our children, however for now this is a more sure-fire way to calculate this
// than the above due to some undesired masking optimisations causing some hit objects to be culled...
// Todo: When this is investigated more we should use the above method as it is a little more exact
// Todo: This is not working correctly in the case that hit objects are absolutely-sized - needs a proper looking into in osu!framework
float width = Children.Select(child => child.X + child.Width).Max() - RelativeChildOffset.X;
float height = Children.Select(child => child.Y + child.Height).Max() - RelativeChildOffset.Y;
// Find the largest element that is absolutely-sized along ScrollingAxes
float maxAbsoluteSize = Children.Where(c => (c.RelativeSizeAxes & ScrollingAxes) == 0)
.Select(c => (ScrollingAxes & Axes.X) > 0 ? c.Width : c.Height)
.DefaultIfEmpty().Max();
// Consider that width/height are time values. To have ourselves span these time values 1:1, we first need to set our size
Size = new Vector2((ScrollingAxes & Axes.X) > 0 ? width : Size.X, (ScrollingAxes & Axes.Y) > 0 ? height : Size.Y);
// Then to make our position-space be time values again, we need our relative child size to follow our size
RelativeChildSize = Size;
});
}
float ourAbsoluteSize = (ScrollingAxes & Axes.X) > 0 ? DrawWidth : DrawHeight;
// Add the extra duration to account for the absolute size
baseDuration *= 1 + maxAbsoluteSize / ourAbsoluteSize;
return baseDuration;
});
protected override void Update()
{
base.Update();
// We want our size and position-space along ScrollingAxes to span our duration to completely enclose all the hit objects
Size = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)Duration : Size.X, (ScrollingAxes & Axes.Y) > 0 ? (float)Duration : Size.Y);
// And we need to make sure the hit object's position-space doesn't change due to our resizing
RelativeChildSize = Size;
}
}
}

View File

@ -51,6 +51,13 @@ namespace osu.Game.Rulesets.Timing
this.scrollingAxes = scrollingAxes;
}
public override void Add(SpeedAdjustmentContainer speedAdjustment)
{
speedAdjustment.VisibleTimeRange.BindTo(VisibleTimeRange);
speedAdjustment.ScrollingAxes = scrollingAxes;
base.Add(speedAdjustment);
}
/// <summary>
/// Adds a hit object to this <see cref="SpeedAdjustmentCollection"/>. The hit objects will be kept in a queue
/// and will be processed when new <see cref="SpeedAdjustmentContainer"/>s are added to this <see cref="SpeedAdjustmentCollection"/>.
@ -58,14 +65,10 @@ namespace osu.Game.Rulesets.Timing
/// <param name="hitObject">The hit object to add.</param>
public void Add(DrawableHitObject hitObject)
{
queuedHitObjects.Enqueue(hitObject);
}
if (!(hitObject is IScrollingHitObject))
throw new InvalidOperationException($"Hit objects added to a {nameof(SpeedAdjustmentCollection)} must implement {nameof(IScrollingHitObject)}.");
public override void Add(SpeedAdjustmentContainer speedAdjustment)
{
speedAdjustment.VisibleTimeRange.BindTo(VisibleTimeRange);
speedAdjustment.ScrollingAxes = scrollingAxes;
base.Add(speedAdjustment);
queuedHitObjects.Enqueue(hitObject);
}
protected override void Update()

View File

@ -42,6 +42,8 @@ namespace osu.Game.Rulesets.Timing
public readonly MultiplierControlPoint ControlPoint;
private DrawableTimingSection timingSection;
/// <summary>
/// Creates a new <see cref="SpeedAdjustmentContainer"/>.
/// </summary>
@ -56,9 +58,10 @@ namespace osu.Game.Rulesets.Timing
[BackgroundDependencyLoader]
private void load()
{
DrawableTimingSection timingSection = CreateTimingSection();
timingSection = CreateTimingSection();
timingSection.ScrollingAxes = ScrollingAxes;
timingSection.ControlPoint = ControlPoint;
timingSection.VisibleTimeRange.BindTo(VisibleTimeRange);
timingSection.RelativeChildOffset = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)ControlPoint.StartTime : 0, (ScrollingAxes & Axes.Y) > 0 ? (float)ControlPoint.StartTime : 0);
@ -74,6 +77,17 @@ namespace osu.Game.Rulesets.Timing
RelativeChildSize = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)VisibleTimeRange : 1, (ScrollingAxes & Axes.Y) > 0 ? (float)VisibleTimeRange : 1);
}
public override double LifetimeStart => ControlPoint.StartTime - VisibleTimeRange;
public override double LifetimeEnd => ControlPoint.StartTime + timingSection.Duration + VisibleTimeRange;
public override void Add(DrawableHitObject drawable)
{
var scrollingHitObject = drawable as IScrollingHitObject;
scrollingHitObject?.LifetimeOffset.BindTo(VisibleTimeRange);
base.Add(drawable);
}
/// <summary>
/// Whether this speed adjustment can contain a hit object. This is true if the hit object occurs after this speed adjustment with respect to time.
/// </summary>

View File

@ -8,7 +8,7 @@ using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Input;
using osu.Game.Graphics;

View File

@ -8,7 +8,7 @@ using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Game.Graphics;
using osu.Game.Overlays.Toolbar;

View File

@ -0,0 +1,223 @@
// 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;
using OpenTK.Graphics;
using OpenTK.Graphics.ES30;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Batches;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.OpenGL.Vertices;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Shaders;
using osu.Framework.Graphics.Textures;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using System;
namespace osu.Game.Screens.Menu
{
internal class LogoVisualisation : Drawable, IHasAccentColour
{
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
/// <summary>
/// The number of bars to jump each update iteration.
/// </summary>
private const int index_change = 5;
/// <summary>
/// The maximum length of each bar in the visualiser. Will be reduced when kiai is not activated.
/// </summary>
private const float bar_length = 600;
/// <summary>
/// The number of bars in one rotation of the visualiser.
/// </summary>
private const int bars_per_visualiser = 200;
/// <summary>
/// How many times we should stretch around the circumference (overlapping overselves).
/// </summary>
private const float visualiser_rounds = 5;
/// <summary>
/// How much should each bar go down each milisecond (based on a full bar).
/// </summary>
private const float decay_per_milisecond = 0.0024f;
/// <summary>
/// Number of milliseconds between each amplitude update.
/// </summary>
private const float time_between_updates = 50;
/// <summary>
/// The minimum amplitude to show a bar.
/// </summary>
private const float amplitude_dead_zone = 1f / bar_length;
private int indexOffset;
public Color4 AccentColour { get; set; }
private readonly float[] frequencyAmplitudes = new float[256];
public override bool HandleInput => false;
private Shader shader;
private readonly Texture texture;
public LogoVisualisation()
{
texture = Texture.WhitePixel;
AccentColour = new Color4(1, 1, 1, 0.2f);
BlendingMode = BlendingMode.Additive;
}
[BackgroundDependencyLoader(true)]
private void load(ShaderManager shaders, OsuGame game)
{
if (game?.Beatmap != null)
beatmap.BindTo(game.Beatmap);
shader = shaders?.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED);
}
private void updateAmplitudes()
{
float[] temporalAmplitudes = beatmap.Value?.Track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256];
var effect = beatmap.Value?.Beatmap.ControlPointInfo.EffectPointAt(beatmap.Value.Track?.CurrentTime ?? Time.Current);
for (int i = 0; i < bars_per_visualiser; i++)
{
if (beatmap?.Value?.Track?.IsRunning ?? false)
{
float targetAmplitude = temporalAmplitudes[(i + indexOffset) % bars_per_visualiser] * (effect?.KiaiMode == true ? 1 : 0.5f);
if (targetAmplitude > frequencyAmplitudes[i])
frequencyAmplitudes[i] = targetAmplitude;
}
else
{
int index = (i + index_change) % bars_per_visualiser;
if (frequencyAmplitudes[index] > frequencyAmplitudes[i])
frequencyAmplitudes[i] = frequencyAmplitudes[index];
}
}
indexOffset = (indexOffset + index_change) % bars_per_visualiser;
Scheduler.AddDelayed(updateAmplitudes, time_between_updates);
}
protected override void LoadComplete()
{
base.LoadComplete();
updateAmplitudes();
}
protected override void Update()
{
base.Update();
float decayFactor = (float)Time.Elapsed * decay_per_milisecond;
for (int i = 0; i < bars_per_visualiser; i++)
{
//3% of extra bar length to make it a little faster when bar is almost at it's minimum
frequencyAmplitudes[i] -= decayFactor * (frequencyAmplitudes[i] + 0.03f);
if (frequencyAmplitudes[i] < 0)
frequencyAmplitudes[i] = 0;
}
Invalidate(Invalidation.DrawNode, shallPropagate: false);
}
protected override DrawNode CreateDrawNode() => new VisualisationDrawNode();
private readonly VisualiserSharedData sharedData = new VisualiserSharedData();
protected override void ApplyDrawNode(DrawNode node)
{
base.ApplyDrawNode(node);
var visNode = (VisualisationDrawNode)node;
visNode.Shader = shader;
visNode.Texture = texture;
visNode.Size = DrawSize.X;
visNode.Shared = sharedData;
visNode.Colour = AccentColour;
visNode.AudioData = frequencyAmplitudes;
}
private class VisualiserSharedData
{
public readonly LinearBatch<TexturedVertex2D> VertexBatch = new LinearBatch<TexturedVertex2D>(100 * 4, 10, PrimitiveType.Quads);
}
private class VisualisationDrawNode : DrawNode
{
public Shader Shader;
public Texture Texture;
public VisualiserSharedData Shared;
//Asuming the logo is a circle, we don't need a second dimension.
public float Size;
public Color4 Colour;
public float[] AudioData;
public override void Draw(Action<TexturedVertex2D> vertexAction)
{
base.Draw(vertexAction);
Shader.Bind();
Texture.TextureGL.Bind();
Vector2 inflation = DrawInfo.MatrixInverse.ExtractScale().Xy;
ColourInfo colourInfo = DrawInfo.Colour;
colourInfo.ApplyChild(Colour);
if (AudioData != null)
{
for (int j = 0; j < visualiser_rounds; j++)
{
for (int i = 0; i < bars_per_visualiser; i++)
{
if (AudioData[i] < amplitude_dead_zone)
continue;
float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualiser * 360 + j * 360 / visualiser_rounds);
float rotationCos = (float)Math.Cos(rotation);
float rotationSin = (float)Math.Sin(rotation);
//taking the cos and sin to the 0..1 range
var barPosition = new Vector2(rotationCos / 2 + 0.5f, rotationSin / 2 + 0.5f) * Size;
var barSize = new Vector2(Size * (float)Math.Sqrt(2 * (1 - Math.Cos(MathHelper.DegreesToRadians(360f / bars_per_visualiser)))) / 2f, bar_length * AudioData[i]);
//The distance between the position and the sides of the bar.
var bottomOffset = new Vector2(-rotationSin * barSize.X / 2, rotationCos * barSize.X / 2);
//The distance between the bottom side of the bar and the top side.
var amplitudeOffset = new Vector2(rotationCos * barSize.Y, rotationSin * barSize.Y);
var rectangle = new Quad(
(barPosition - bottomOffset) * DrawInfo.Matrix,
(barPosition - bottomOffset + amplitudeOffset) * DrawInfo.Matrix,
(barPosition + bottomOffset) * DrawInfo.Matrix,
(barPosition + bottomOffset + amplitudeOffset) * DrawInfo.Matrix
);
Texture.DrawQuad(
rectangle,
colourInfo,
null,
Shared.VertexBatch.Add,
//barSize by itself will make it smooth more in the X axis than in the Y axis, this reverts that.
Vector2.Divide(inflation, barSize.Yx));
}
}
}
Shader.Unbind();
}
}
}
}

View File

@ -8,7 +8,7 @@ using osu.Framework.Configuration;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics;

View File

@ -1,11 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
namespace osu.Game.Screens.Menu
{
internal class MenuVisualisation : Drawable
{
}
}

View File

@ -8,6 +8,7 @@ using osu.Framework.Audio.Sample;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input;
@ -34,8 +35,10 @@ namespace osu.Game.Screens.Menu
private readonly Container logoBeatContainer;
private readonly Container logoAmplitudeContainer;
private readonly Container logoHoverContainer;
private readonly LogoVisualisation visualizer;
private SampleChannel sampleClick;
private SampleChannel sampleBeat;
private readonly Container colourAndTriangles;
@ -120,6 +123,14 @@ namespace osu.Game.Screens.Menu
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
visualizer = new LogoVisualisation
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Alpha = 0.5f,
Size = new Vector2(0.96f)
},
new BufferedContainer
{
AutoSizeAxes = Axes.Both,
@ -189,14 +200,6 @@ namespace osu.Game.Screens.Menu
Alpha = 0,
}
}
},
new MenuVisualisation
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
BlendingMode = BlendingMode.Additive,
Alpha = 0.2f,
}
}
}
@ -213,6 +216,7 @@ namespace osu.Game.Screens.Menu
private void load(TextureStore textures, AudioManager audio)
{
sampleClick = audio.Sample.Get(@"Menu/menuhit");
sampleBeat = audio.Sample.Get(@"Menu/heartbeat");
logo.Texture = textures.Get(@"Menu/logo");
ripple.Texture = textures.Get(@"Menu/logo");
}
@ -223,6 +227,9 @@ namespace osu.Game.Screens.Menu
{
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
if (Hovering)
sampleBeat.Play();
lastBeatIndex = beatIndex;
var beatLength = timingPoint.BeatLength;
@ -246,10 +253,14 @@ namespace osu.Game.Screens.Menu
if (effectPoint.KiaiMode && flashLayer.Alpha < 0.4f)
{
flashLayer.ClearTransforms();
visualizer.ClearTransforms();
flashLayer.FadeTo(0.2f * amplitudeAdjust, beat_in_time, EasingTypes.Out);
visualizer.FadeTo(0.9f * amplitudeAdjust, beat_in_time, EasingTypes.Out);
using (flashLayer.BeginDelayedSequence(beat_in_time))
flashLayer.FadeOut(beatLength);
using (visualizer.BeginDelayedSequence(beat_in_time))
visualizer.FadeTo(0.5f, beatLength);
}
}

View File

@ -7,7 +7,7 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Database;
using osu.Game.Graphics;

Some files were not shown because too many files have changed in this diff Show More