From afab93879461d7dc01632f87a5a88dc3d1fa30fc Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 14 Nov 2016 03:21:07 +0800 Subject: [PATCH 1/6] Strongly typed TransformDirection for music controller. --- osu.Game/Overlays/MusicController.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index e1d12fa6dd..a7fe0f39c2 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -229,7 +229,7 @@ namespace osu.Game.Overlays void preferUnicode_changed(object sender, EventArgs e) { - updateDisplay(current, false); + updateDisplay(current, TransformDirection.None); } private void workingChanged(object sender = null, EventArgs e = null) @@ -237,7 +237,7 @@ namespace osu.Game.Overlays if (beatmapSource.Value == current) return; bool audioEquals = current?.BeatmapInfo.AudioEquals(beatmapSource.Value.BeatmapInfo) ?? false; current = beatmapSource.Value; - updateDisplay(current, audioEquals ? null : (bool?)true); + updateDisplay(current, audioEquals ? TransformDirection.None : TransformDirection.Left); appendToHistory(current.BeatmapInfo); } @@ -298,10 +298,10 @@ namespace osu.Game.Overlays current.Track.Start(); beatmapSource.Value = current; }); - updateDisplay(current, isNext); + updateDisplay(current, isNext ? TransformDirection.Left : TransformDirection.Right); } - private void updateDisplay(WorkingBeatmap beatmap, bool? isNext) + private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction) { if (beatmap.Beatmap == null) //todo: we may need to display some default text here (currently in the constructor). @@ -315,13 +315,13 @@ namespace osu.Game.Overlays Add(newBackground); - if (isNext == true) + if (direction == TransformDirection.Left) { newBackground.Position = new Vector2(400, 0); newBackground.MoveToX(0, 500, EasingTypes.OutCubic); backgroundSprite.MoveToX(-400, 500, EasingTypes.OutCubic); } - else if (isNext == false) + else if (direction == TransformDirection.Right) { newBackground.Position = new Vector2(-400, 0); newBackground.MoveToX(0, 500, EasingTypes.OutCubic); @@ -354,6 +354,8 @@ namespace osu.Game.Overlays protected override void PopOut() => FadeOut(100); + private enum TransformDirection { None, Left, Right } + private class MusicControllerBackground : BufferedContainer { private Sprite sprite; From 33a35ca711f19c4865a8f41ce175106c36c10882 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 14 Nov 2016 04:01:48 +0800 Subject: [PATCH 2/6] Do not set WorkingBeatmap explicitly in mode stack. --- osu.Game/OsuGame.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index a13f772f2d..e72e1bc371 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -105,10 +105,7 @@ namespace osu.Game } }); - (modeStack = new Intro - { - Beatmap = Beatmap - }).Preload(this, d => + (modeStack = new Intro()).Preload(this, d => { mainContent.Add(d); From 7c8ef2a82be3262407e3b1298395fda2d9427e4e Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 14 Nov 2016 04:22:06 +0800 Subject: [PATCH 3/6] Select and unselect BeatmapPanel when selecting BeatmapGroup. --- osu.Game/Beatmaps/Drawable/BeatmapGroup.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Beatmaps/Drawable/BeatmapGroup.cs b/osu.Game/Beatmaps/Drawable/BeatmapGroup.cs index 1e433922a6..c66a6ad259 100644 --- a/osu.Game/Beatmaps/Drawable/BeatmapGroup.cs +++ b/osu.Game/Beatmaps/Drawable/BeatmapGroup.cs @@ -51,11 +51,15 @@ namespace osu.Game.Beatmaps.Drawable difficulties.Show(); header.State = PanelSelectedState.Selected; + if (SelectedPanel != null) + SelectedPanel.State = PanelSelectedState.Selected; break; case BeatmapGroupState.Collapsed: FadeTo(0.8f, 250); header.State = PanelSelectedState.NotSelected; + if (SelectedPanel != null) + SelectedPanel.State = PanelSelectedState.NotSelected; difficulties.Hide(); break; } From aac968eec8673d690cae0e2912606118a7b41ef8 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 14 Nov 2016 04:47:08 +0800 Subject: [PATCH 4/6] Update res file with latest manifest. --- osu.Desktop/osu!.res | Bin 156169 -> 156596 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/osu.Desktop/osu!.res b/osu.Desktop/osu!.res index 72bbe5757877769f28a0a92ceaa34187d6545b06..7c70e30401fc50ef59dc7b34bb4c834175a957a9 100644 GIT binary patch delta 1005 zcmZ8fOG_J36h8OnVG=b)6RU{mH4u$LUYb}V+WIK9!4^tsQwlu&u&iT&$&Ud~$FTXfHRGo*u zKDf5dFaV+P)s;mZPUGIn_e;0-_3R8Iteu{(AY`drq=&T|KTq7qs(rewI*_e$dOoZl zTT#J=?0T0AtsJ4YO6GV}-+hNhmXJe#^9xl2$VpH3>Mwj)8bB`nB8;mZ)LzSdyNzEt zQHP#M;U9L?S>sDT#0SG09ru{Yf-@lV1rIN zMC#t1M`K3-c34<2Fap6PfVKt;fs+7Gu3)f^6$SvD4Ni(tHrFil_t(LFCqO&+eD&y~ z9iXGpkU+r-w4F+QqhTEo2_2k@9AcbkUmX;tpiO0UTVpYEmi zYr(urpLm8jyZSqW(}<|4b-YHmw{&xo$gNHnp-Vl?;32iNj(gP489X}B0tlHK35Cd0 zUdV|%GKoc1W*rZW&2Z8DO(r%O%I33Ep?IE~31yQ^A{3v==MqsSmSB?1uAiug!GHEB zM~>U%gd8WZq@|lVn~L=Ka&*sPUMMILqc^xx7)Ft1GA9A|q^UF&qD}H1A+8 b(saq}$-jKfy}1Y@m$qZGO_!*l^soF2uz~L) delta 606 zcmY*W&ubGw7=7Pl8xz51VN()nF`K4IHtiu1?5}N_q#;JU7Hp9!-4xp9U`_#{r}QFi z!Gk5zxpcCRlpV$WbkHS(SPZ$JAXe=9(9-N;13TMJl3^Ik{08l?qk=zEoq$6l6QUis7l3tQaz}Wmc`E*IvA&tDsoa+MarVQPG@1N9OuWxZ->4H zX+_BX=UQhLx~_wu!6IM|g#siB!5szWVanV0Q3zO&N*^^xfW`hJk$j%)DPW^gQJe{@ z3M>s=Ot@*F2+Q)h<~XoC@RXc%E6pGt_sPRBP)0QBqt8L0G6*!$)PNQ6*H2icvA?er zwN>>u$sxt$pi*u1BnPC1f~JNl$yRbHmqV${43*CcV~vdk*q4x)e#*9kG|gRy-IGVp yVK#s7uo!>0$sYUDpH22qO>w^Auo{2fV84uFzR_;Iyl*$!?d{gqi@nmF+kXKw*Mr{x From 86a6c7641dab5617d9b4af3e1255483906f7aec8 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 14 Nov 2016 04:59:41 +0800 Subject: [PATCH 5/6] Make TransformDirection more clear. --- osu.Game/Overlays/MusicController.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index a7fe0f39c2..f6f82d57c2 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -237,7 +237,7 @@ namespace osu.Game.Overlays if (beatmapSource.Value == current) return; bool audioEquals = current?.BeatmapInfo.AudioEquals(beatmapSource.Value.BeatmapInfo) ?? false; current = beatmapSource.Value; - updateDisplay(current, audioEquals ? TransformDirection.None : TransformDirection.Left); + updateDisplay(current, audioEquals ? TransformDirection.None : TransformDirection.Next); appendToHistory(current.BeatmapInfo); } @@ -298,7 +298,7 @@ namespace osu.Game.Overlays current.Track.Start(); beatmapSource.Value = current; }); - updateDisplay(current, isNext ? TransformDirection.Left : TransformDirection.Right); + updateDisplay(current, isNext ? TransformDirection.Next : TransformDirection.Prev); } private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction) @@ -315,13 +315,13 @@ namespace osu.Game.Overlays Add(newBackground); - if (direction == TransformDirection.Left) + if (direction == TransformDirection.Next) { newBackground.Position = new Vector2(400, 0); newBackground.MoveToX(0, 500, EasingTypes.OutCubic); backgroundSprite.MoveToX(-400, 500, EasingTypes.OutCubic); } - else if (direction == TransformDirection.Right) + else if (direction == TransformDirection.Prev) { newBackground.Position = new Vector2(-400, 0); newBackground.MoveToX(0, 500, EasingTypes.OutCubic); @@ -354,7 +354,7 @@ namespace osu.Game.Overlays protected override void PopOut() => FadeOut(100); - private enum TransformDirection { None, Left, Right } + private enum TransformDirection { None, Next, Prev } private class MusicControllerBackground : BufferedContainer { From eb32d842cc05b956f121ea50d3a8052c535fbfb2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 14 Nov 2016 16:10:07 +0900 Subject: [PATCH 6/6] 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; }