move stuff thats duplicated in PreviewButton and DirectPanel to PlayButton

This commit is contained in:
Jorolf
2017-10-06 21:00:23 +02:00
parent fffeac638f
commit 5a8b8dacbb
8 changed files with 117 additions and 147 deletions

View File

@ -230,21 +230,21 @@ namespace osu.Game.Overlays
})
};
foreach (DirectPanel panel in newPanels.Children)
panel.PreviewPlaying.ValueChanged += newValue =>
{
if (newValue)
{
if (playing != null && playing != panel)
playing.PreviewPlaying.Value = false;
playing = panel;
}
};
LoadComponentAsync(newPanels, p =>
{
if (panels != null) ScrollFlow.Remove(panels);
ScrollFlow.Add(panels = newPanels);
foreach (DirectPanel panel in p.Children)
panel.PreviewPlaying.ValueChanged += newValue =>
{
if (newValue)
{
if (playing != null && playing != panel)
playing.PreviewPlaying.Value = false;
playing = panel;
}
};
});
}