1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 21:23:04 +08:00

Comments, play first song if current is nil and user presses play

This commit is contained in:
DrabWeb 2017-04-09 07:04:41 -03:00
parent 7f2feab9e7
commit 67f1167172
2 changed files with 14 additions and 6 deletions

View File

@ -108,10 +108,10 @@ namespace osu.Game.Overlays
OnSelect = (set, index) =>
{
if (set.ID == (current?.BeatmapSetInfo?.ID ?? -1))
current?.Track?.Seek(0);
current?.Track?.Seek(0);
play(set.Beatmaps[0], true);
playListIndex = index;
play(set.Beatmaps[0], true);
},
},
playerContainer = new Container
@ -177,7 +177,13 @@ namespace osu.Game.Overlays
IconScale = new Vector2(1.4f),
Action = () =>
{
if (current?.Track == null) return;
if (current?.Track == null)
{
if (playList.Count > 0)
play(playList.First().Beatmaps[0], true);
else
return;
}
if (current.Track.IsRunning)
current.Track.Stop();
else
@ -286,9 +292,9 @@ namespace osu.Game.Overlays
if (current != null && playList.Count == 1) return;
int n = playListIndex + 1;
if (n >= playList.Count)
if (n >= playList.Count)
n = 0;
play(playList[n].Beatmaps[0], true);
playListIndex = n;
}

View File

@ -72,7 +72,7 @@ namespace osu.Game.Overlays
list = new Playlist
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = 95, Bottom = 10, Right = 10 }, //todo: static sizes aren't good
Padding = new MarginPadding { Top = 95, Bottom = 10, Right = 10 },
},
filter = new FilterControl
{
@ -85,6 +85,7 @@ namespace osu.Game.Overlays
};
filter.Search.Exit = Hide;
//todo: play the first displayed song on commit when searching is implemented
}
[BackgroundDependencyLoader]
@ -314,6 +315,7 @@ namespace osu.Game.Overlays
if (value == current) return;
current = value;
//todo: fading off screen doesn't work
title.FadeColour(Current ? current_colour : Color4.White, fade_duration);
}
}