mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 16:43:52 +09:00
Merge pull request #7855 from peppy/fix-transform-mod
Fix transform mod not being applied correctly
This commit is contained in:
@ -8,6 +8,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
@ -27,26 +28,40 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
||||||
{
|
{
|
||||||
foreach (var drawable in drawables)
|
foreach (var drawable in drawables)
|
||||||
|
drawable.ApplyCustomUpdateState += applyTransform;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyTransform(DrawableHitObject drawable, ArmedState state)
|
||||||
|
{
|
||||||
|
switch (drawable)
|
||||||
{
|
{
|
||||||
var hitObject = (OsuHitObject)drawable.HitObject;
|
case DrawableSliderHead _:
|
||||||
|
case DrawableSliderTail _:
|
||||||
|
case DrawableSliderTick _:
|
||||||
|
case DrawableRepeatPoint _:
|
||||||
|
return;
|
||||||
|
|
||||||
float appearDistance = (float)(hitObject.TimePreempt - hitObject.TimeFadeIn) / 2;
|
default:
|
||||||
|
var hitObject = (OsuHitObject)drawable.HitObject;
|
||||||
|
|
||||||
Vector2 originalPosition = drawable.Position;
|
float appearDistance = (float)(hitObject.TimePreempt - hitObject.TimeFadeIn) / 2;
|
||||||
Vector2 appearOffset = new Vector2(MathF.Cos(theta), MathF.Sin(theta)) * appearDistance;
|
|
||||||
|
|
||||||
//the - 1 and + 1 prevents the hit objects to appear in the wrong position.
|
Vector2 originalPosition = drawable.Position;
|
||||||
double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1;
|
Vector2 appearOffset = new Vector2(MathF.Cos(theta), MathF.Sin(theta)) * appearDistance;
|
||||||
double moveDuration = hitObject.TimePreempt + 1;
|
|
||||||
|
|
||||||
using (drawable.BeginAbsoluteSequence(appearTime, true))
|
//the - 1 and + 1 prevents the hit objects to appear in the wrong position.
|
||||||
{
|
double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1;
|
||||||
drawable
|
double moveDuration = hitObject.TimePreempt + 1;
|
||||||
.MoveToOffset(appearOffset)
|
|
||||||
.MoveTo(originalPosition, moveDuration, Easing.InOutSine);
|
|
||||||
}
|
|
||||||
|
|
||||||
theta += (float)hitObject.TimeFadeIn / 1000;
|
using (drawable.BeginAbsoluteSequence(appearTime, true))
|
||||||
|
{
|
||||||
|
drawable
|
||||||
|
.MoveToOffset(appearOffset)
|
||||||
|
.MoveTo(originalPosition, moveDuration, Easing.InOutSine);
|
||||||
|
}
|
||||||
|
|
||||||
|
theta += (float)hitObject.TimeFadeIn / 1000;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user