1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-23 02:57:25 +08:00

Use switch instead of if-else.

This commit is contained in:
Dean Herbert 2016-11-14 16:10:07 +09:00
parent 86a6c7641d
commit eb32d842cc

View File

@ -315,20 +315,21 @@ namespace osu.Game.Overlays
Add(newBackground);
if (direction == TransformDirection.Next)
switch (direction)
{
newBackground.Position = new Vector2(400, 0);
newBackground.MoveToX(0, 500, EasingTypes.OutCubic);
backgroundSprite.MoveToX(-400, 500, EasingTypes.OutCubic);
case TransformDirection.Next:
newBackground.Position = new Vector2(400, 0);
newBackground.MoveToX(0, 500, EasingTypes.OutCubic);
backgroundSprite.MoveToX(-400, 500, EasingTypes.OutCubic);
break;
case TransformDirection.Prev:
newBackground.Position = new Vector2(-400, 0);
newBackground.MoveToX(0, 500, EasingTypes.OutCubic);
backgroundSprite.MoveToX(400, 500, EasingTypes.OutCubic);
break;
}
else if (direction == TransformDirection.Prev)
{
newBackground.Position = new Vector2(-400, 0);
newBackground.MoveToX(0, 500, EasingTypes.OutCubic);
backgroundSprite.MoveToX(400, 500, EasingTypes.OutCubic);
}
backgroundSprite.Expire();
backgroundSprite.Expire();
backgroundSprite = newBackground;
}