From eb32d842cc05b956f121ea50d3a8052c535fbfb2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 14 Nov 2016 16:10:07 +0900 Subject: [PATCH] Use switch instead of if-else. --- osu.Game/Overlays/MusicController.cs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index f6f82d57c2..5f7ffe6243 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -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; }