mirror of
https://github.com/osukey/osukey.git
synced 2025-07-07 03:09:54 +09:00
Merge branch 'master' into fix-loading-animation
This commit is contained in:
@ -20,6 +20,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
|||||||
private const int spacing = 32;
|
private const int spacing = 32;
|
||||||
private const double preempt = 800;
|
private const double preempt = 800;
|
||||||
|
|
||||||
|
public override bool RemoveWhenNotAlive => false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The start time of <see cref="Start"/>.
|
/// The start time of <see cref="Start"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -79,27 +81,31 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
|||||||
drawableObject.HitObject.DefaultsApplied += scheduleRefresh;
|
drawableObject.HitObject.DefaultsApplied += scheduleRefresh;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scheduleRefresh() => Scheduler.AddOnce(refresh);
|
private void scheduleRefresh()
|
||||||
|
{
|
||||||
|
Scheduler.AddOnce(refresh);
|
||||||
|
}
|
||||||
|
|
||||||
private void refresh()
|
private void refresh()
|
||||||
{
|
{
|
||||||
ClearInternal();
|
ClearInternal();
|
||||||
|
|
||||||
if (End == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
OsuHitObject osuStart = Start.HitObject;
|
OsuHitObject osuStart = Start.HitObject;
|
||||||
OsuHitObject osuEnd = End.HitObject;
|
double startTime = osuStart.GetEndTime();
|
||||||
|
|
||||||
if (osuEnd.NewCombo)
|
LifetimeStart = startTime;
|
||||||
return;
|
|
||||||
|
|
||||||
if (osuStart is Spinner || osuEnd is Spinner)
|
OsuHitObject osuEnd = End?.HitObject;
|
||||||
|
|
||||||
|
if (osuEnd == null || osuEnd.NewCombo || osuStart is Spinner || osuEnd is Spinner)
|
||||||
|
{
|
||||||
|
// ensure we always set a lifetime for full LifetimeManagementContainer benefits
|
||||||
|
LifetimeEnd = LifetimeStart;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Vector2 startPosition = osuStart.EndPosition;
|
Vector2 startPosition = osuStart.EndPosition;
|
||||||
Vector2 endPosition = osuEnd.Position;
|
Vector2 endPosition = osuEnd.Position;
|
||||||
double startTime = osuStart.GetEndTime();
|
|
||||||
double endTime = osuEnd.StartTime;
|
double endTime = osuEnd.StartTime;
|
||||||
|
|
||||||
Vector2 distanceVector = endPosition - startPosition;
|
Vector2 distanceVector = endPosition - startPosition;
|
||||||
@ -107,6 +113,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
|||||||
float rotation = (float)(Math.Atan2(distanceVector.Y, distanceVector.X) * (180 / Math.PI));
|
float rotation = (float)(Math.Atan2(distanceVector.Y, distanceVector.X) * (180 / Math.PI));
|
||||||
double duration = endTime - startTime;
|
double duration = endTime - startTime;
|
||||||
|
|
||||||
|
double? firstTransformStartTime = null;
|
||||||
|
double finalTransformEndTime = startTime;
|
||||||
|
|
||||||
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;
|
||||||
@ -125,16 +134,23 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
|||||||
Scale = new Vector2(1.5f * osuEnd.Scale),
|
Scale = new Vector2(1.5f * osuEnd.Scale),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (firstTransformStartTime == null)
|
||||||
|
firstTransformStartTime = fadeInTime;
|
||||||
|
|
||||||
using (fp.BeginAbsoluteSequence(fadeInTime))
|
using (fp.BeginAbsoluteSequence(fadeInTime))
|
||||||
{
|
{
|
||||||
fp.FadeIn(osuEnd.TimeFadeIn);
|
fp.FadeIn(osuEnd.TimeFadeIn);
|
||||||
fp.ScaleTo(osuEnd.Scale, osuEnd.TimeFadeIn, Easing.Out);
|
fp.ScaleTo(osuEnd.Scale, osuEnd.TimeFadeIn, Easing.Out);
|
||||||
fp.MoveTo(pointEndPosition, osuEnd.TimeFadeIn, Easing.Out);
|
fp.MoveTo(pointEndPosition, osuEnd.TimeFadeIn, Easing.Out);
|
||||||
fp.Delay(fadeOutTime - fadeInTime).FadeOut(osuEnd.TimeFadeIn);
|
fp.Delay(fadeOutTime - fadeInTime).FadeOut(osuEnd.TimeFadeIn);
|
||||||
|
|
||||||
|
finalTransformEndTime = fadeOutTime + osuEnd.TimeFadeIn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fp.Expire(true);
|
// todo: use Expire() on FollowPoints and take lifetime from them when https://github.com/ppy/osu-framework/issues/3300 is fixed.
|
||||||
}
|
LifetimeStart = firstTransformStartTime ?? startTime;
|
||||||
|
LifetimeEnd = finalTransformEndTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Visualises connections between <see cref="DrawableOsuHitObject"/>s.
|
/// Visualises connections between <see cref="DrawableOsuHitObject"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class FollowPointRenderer : CompositeDrawable
|
public class FollowPointRenderer : LifetimeManagementContainer
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All the <see cref="FollowPointConnection"/>s contained by this <see cref="FollowPointRenderer"/>.
|
/// All the <see cref="FollowPointConnection"/>s contained by this <see cref="FollowPointRenderer"/>.
|
||||||
@ -45,8 +45,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
|||||||
/// <returns>The index of <paramref name="connection"/> in <see cref="connections"/>.</returns>
|
/// <returns>The index of <paramref name="connection"/> in <see cref="connections"/>.</returns>
|
||||||
private void addConnection(FollowPointConnection connection)
|
private void addConnection(FollowPointConnection connection)
|
||||||
{
|
{
|
||||||
AddInternal(connection);
|
|
||||||
|
|
||||||
// Groups are sorted by their start time when added such that the index can be used to post-process other surrounding connections
|
// Groups are sorted by their start time when added such that the index can be used to post-process other surrounding connections
|
||||||
int index = connections.AddInPlace(connection, Comparer<FollowPointConnection>.Create((g1, g2) => g1.StartTime.Value.CompareTo(g2.StartTime.Value)));
|
int index = connections.AddInPlace(connection, Comparer<FollowPointConnection>.Create((g1, g2) => g1.StartTime.Value.CompareTo(g2.StartTime.Value)));
|
||||||
|
|
||||||
@ -74,6 +72,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
|||||||
FollowPointConnection previousConnection = connections[index - 1];
|
FollowPointConnection previousConnection = connections[index - 1];
|
||||||
previousConnection.End = connection.Start;
|
previousConnection.End = connection.Start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddInternal(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Reference in New Issue
Block a user