mirror of https://github.com/ppy/osu
Add rotation support for very old skins
This commit is contained in:
parent
1bee7bf353
commit
f0070eecf1
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
|
@ -27,6 +27,8 @@ public partial class LegacyReverseArrow : CompositeDrawable
|
|||
|
||||
private Drawable arrow = null!;
|
||||
|
||||
private bool shouldRotate;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ISkinSource skinSource)
|
||||
{
|
||||
|
@ -40,6 +42,8 @@ private void load(ISkinSource skinSource)
|
|||
textureIsDefaultSkin = skin is ISkinTransformer transformer && transformer.Skin is DefaultLegacySkin;
|
||||
|
||||
drawableObject.ApplyCustomUpdateState += updateStateTransforms;
|
||||
|
||||
shouldRotate = skinSource.GetConfig<SkinConfiguration.LegacySetting, decimal>(SkinConfiguration.LegacySetting.Version)?.Value <= 1;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
@ -76,11 +80,23 @@ private void updateStateTransforms(DrawableHitObject hitObject, ArmedState state
|
|||
switch (state)
|
||||
{
|
||||
case ArmedState.Idle:
|
||||
// TODO: rotate slightly if Version < 1 (aka UseNewLayout)
|
||||
InternalChild.ScaleTo(1.3f, move_out_duration, Easing.Out)
|
||||
.Then()
|
||||
.ScaleTo(1f, move_in_duration, Easing.Out)
|
||||
.Loop(total - (move_in_duration + move_out_duration));
|
||||
if (shouldRotate)
|
||||
{
|
||||
InternalChild.ScaleTo(1.3f, move_out_duration)
|
||||
.RotateTo(5.625f)
|
||||
.Then()
|
||||
.ScaleTo(1f, move_in_duration)
|
||||
.RotateTo(-5.625f, move_in_duration)
|
||||
.Loop(total - (move_in_duration + move_out_duration));
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalChild.ScaleTo(1.3f)
|
||||
.Then()
|
||||
.ScaleTo(1f, move_in_duration)
|
||||
.Loop(total - (move_in_duration + move_out_duration));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue