mirror of
https://github.com/ppy/osu.git
synced 2025-01-10 01:03:21 +08:00
Merge pull request #8462 from peppy/fix-follow-point-transforms
Fix animated follow points not (re)animating after rewind
This commit is contained in:
commit
d3cb21c5a4
@ -52,6 +52,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.327.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.331.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A single follow point positioned between two adjacent <see cref="DrawableOsuHitObject"/>s.
|
/// A single follow point positioned between two adjacent <see cref="DrawableOsuHitObject"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class FollowPoint : Container
|
public class FollowPoint : Container, IAnimationTimeReference
|
||||||
{
|
{
|
||||||
private const float width = 8;
|
private const float width = 8;
|
||||||
|
|
||||||
@ -45,5 +45,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
|||||||
}
|
}
|
||||||
}, confineMode: ConfineMode.NoScaling);
|
}, confineMode: ConfineMode.NoScaling);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double AnimationStartTime { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
|||||||
|
|
||||||
int point = 0;
|
int point = 0;
|
||||||
|
|
||||||
|
ClearInternal();
|
||||||
|
|
||||||
for (int d = (int)(spacing * 1.5); d < distance - spacing; d += spacing)
|
for (int d = (int)(spacing * 1.5); d < distance - spacing; d += spacing)
|
||||||
{
|
{
|
||||||
float fraction = (float)d / distance;
|
float fraction = (float)d / distance;
|
||||||
@ -126,12 +128,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
|||||||
|
|
||||||
FollowPoint fp;
|
FollowPoint fp;
|
||||||
|
|
||||||
if (InternalChildren.Count > point)
|
|
||||||
{
|
|
||||||
fp = (FollowPoint)InternalChildren[point];
|
|
||||||
fp.ClearTransforms();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
AddInternal(fp = new FollowPoint());
|
AddInternal(fp = new FollowPoint());
|
||||||
|
|
||||||
fp.Position = pointStartPosition;
|
fp.Position = pointStartPosition;
|
||||||
@ -142,6 +138,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
|||||||
if (firstTransformStartTime == null)
|
if (firstTransformStartTime == null)
|
||||||
firstTransformStartTime = fadeInTime;
|
firstTransformStartTime = fadeInTime;
|
||||||
|
|
||||||
|
fp.AnimationStartTime = fadeInTime;
|
||||||
|
|
||||||
using (fp.BeginAbsoluteSequence(fadeInTime))
|
using (fp.BeginAbsoluteSequence(fadeInTime))
|
||||||
{
|
{
|
||||||
fp.FadeIn(osuEnd.TimeFadeIn);
|
fp.FadeIn(osuEnd.TimeFadeIn);
|
||||||
|
25
osu.Game/Skinning/IAnimationTimeReference.cs
Normal file
25
osu.Game/Skinning/IAnimationTimeReference.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
|
||||||
|
namespace osu.Game.Skinning
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Denotes an object which provides a reference time to start animations from.
|
||||||
|
/// </summary>
|
||||||
|
[Cached]
|
||||||
|
public interface IAnimationTimeReference
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The reference clock.
|
||||||
|
/// </summary>
|
||||||
|
IFrameBasedClock Clock { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The time which animations should be started from, relative to <see cref="Clock"/>.
|
||||||
|
/// </summary>
|
||||||
|
double AnimationStartTime { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -3,10 +3,12 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Animations;
|
using osu.Framework.Graphics.Animations;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
{
|
{
|
||||||
@ -22,7 +24,7 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
if (textures.Length > 0)
|
if (textures.Length > 0)
|
||||||
{
|
{
|
||||||
var animation = new TextureAnimation
|
var animation = new SkinnableTextureAnimation
|
||||||
{
|
{
|
||||||
DefaultFrameLength = getFrameLength(source, applyConfigFrameRate, textures),
|
DefaultFrameLength = getFrameLength(source, applyConfigFrameRate, textures),
|
||||||
Repeat = looping,
|
Repeat = looping,
|
||||||
@ -53,6 +55,25 @@ namespace osu.Game.Skinning
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SkinnableTextureAnimation : TextureAnimation
|
||||||
|
{
|
||||||
|
[Resolved(canBeNull: true)]
|
||||||
|
private IAnimationTimeReference timeReference { get; set; }
|
||||||
|
|
||||||
|
public SkinnableTextureAnimation()
|
||||||
|
: base(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
if (timeReference != null)
|
||||||
|
Clock = new FramedOffsetClock(timeReference.Clock) { Offset = -timeReference.AnimationStartTime };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private const double default_frame_time = 1000 / 60d;
|
private const double default_frame_time = 1000 / 60d;
|
||||||
|
|
||||||
private static double getFrameLength(ISkin source, bool applyConfigFrameRate, Texture[] textures)
|
private static double getFrameLength(ISkin source, bool applyConfigFrameRate, Texture[] textures)
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2020.327.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2020.331.0" />
|
||||||
<PackageReference Include="Sentry" Version="2.1.1" />
|
<PackageReference Include="Sentry" Version="2.1.1" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.327.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.331.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
||||||
<ItemGroup Label="Transitive Dependencies">
|
<ItemGroup Label="Transitive Dependencies">
|
||||||
@ -79,7 +79,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2020.327.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2020.331.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user