Add rotation support for very old skins

This commit is contained in:
Dean Herbert 2023-10-02 20:09:39 +09:00
parent 1bee7bf353
commit f0070eecf1
2 changed files with 21 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -27,6 +27,8 @@ public partial class LegacyReverseArrow : CompositeDrawable
private Drawable arrow = null!; private Drawable arrow = null!;
private bool shouldRotate;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ISkinSource skinSource) private void load(ISkinSource skinSource)
{ {
@ -40,6 +42,8 @@ private void load(ISkinSource skinSource)
textureIsDefaultSkin = skin is ISkinTransformer transformer && transformer.Skin is DefaultLegacySkin; textureIsDefaultSkin = skin is ISkinTransformer transformer && transformer.Skin is DefaultLegacySkin;
drawableObject.ApplyCustomUpdateState += updateStateTransforms; drawableObject.ApplyCustomUpdateState += updateStateTransforms;
shouldRotate = skinSource.GetConfig<SkinConfiguration.LegacySetting, decimal>(SkinConfiguration.LegacySetting.Version)?.Value <= 1;
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -76,11 +80,23 @@ private void updateStateTransforms(DrawableHitObject hitObject, ArmedState state
switch (state) switch (state)
{ {
case ArmedState.Idle: case ArmedState.Idle:
// TODO: rotate slightly if Version < 1 (aka UseNewLayout) if (shouldRotate)
InternalChild.ScaleTo(1.3f, move_out_duration, Easing.Out) {
.Then() InternalChild.ScaleTo(1.3f, move_out_duration)
.ScaleTo(1f, move_in_duration, Easing.Out) .RotateTo(5.625f)
.Loop(total - (move_in_duration + move_out_duration)); .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; break;
} }
} }