1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 03:25:11 +08:00

Apply refactorings from review

This commit is contained in:
smoogipoo 2020-06-22 15:42:55 +09:00
parent 33fdd7466c
commit 3ede095b9c
2 changed files with 10 additions and 14 deletions

View File

@ -236,13 +236,11 @@ namespace osu.Game.Screens.Ranking
scorePanelList.Detach(expandedPanel);
detachedPanelContainer.Add(expandedPanel);
// Move into its original location in the local container.
// Move into its original location in the local container first, then to the final location.
var origLocation = detachedPanelContainer.ToLocalSpace(screenSpacePos);
expandedPanel.MoveTo(origLocation);
expandedPanel.MoveToX(origLocation.X);
// Move into the final location.
expandedPanel.MoveToX(StatisticsPanel.SIDE_PADDING, 150, Easing.OutQuint);
expandedPanel.MoveTo(origLocation)
.Then()
.MoveTo(new Vector2(StatisticsPanel.SIDE_PADDING, origLocation.Y), 150, Easing.OutQuint);
// Hide contracted panels.
foreach (var contracted in scorePanelList.GetScorePanels().Where(p => p.State == PanelState.Contracted))
@ -262,13 +260,11 @@ namespace osu.Game.Screens.Ranking
detachedPanelContainer.Remove(detachedPanel);
scorePanelList.Attach(detachedPanel);
// Move into its original location in the attached container.
// Move into its original location in the attached container first, then to the final location.
var origLocation = detachedPanel.Parent.ToLocalSpace(screenSpacePos);
detachedPanel.MoveTo(origLocation);
detachedPanel.MoveToX(origLocation.X);
// Move into the final location.
detachedPanel.MoveToX(0, 150, Easing.OutQuint);
detachedPanel.MoveTo(origLocation)
.Then()
.MoveTo(new Vector2(0, origLocation.Y), 150, Easing.OutQuint);
// Show contracted panels.
foreach (var contracted in scorePanelList.GetScorePanels().Where(p => p.State == PanelState.Contracted))

View File

@ -202,7 +202,7 @@ namespace osu.Game.Screens.Ranking
/// <exception cref="InvalidOperationException">If <paramref name="panel"/> is not a part of this <see cref="ScorePanelList"/>.</exception>
public void Detach(ScorePanel panel)
{
var container = flow.FirstOrDefault(t => t.Panel == panel);
var container = flow.SingleOrDefault(t => t.Panel == panel);
if (container == null)
throw new InvalidOperationException("Panel is not contained by the score panel list.");
@ -216,7 +216,7 @@ namespace osu.Game.Screens.Ranking
/// <exception cref="InvalidOperationException">If <paramref name="panel"/> is not a part of this <see cref="ScorePanelList"/>.</exception>
public void Attach(ScorePanel panel)
{
var container = flow.FirstOrDefault(t => t.Panel == panel);
var container = flow.SingleOrDefault(t => t.Panel == panel);
if (container == null)
throw new InvalidOperationException("Panel is not contained by the score panel list.");