mirror of
https://github.com/ppy/osu.git
synced 2025-02-07 12:25:20 +08:00
PlaySongSelect tweaks
Add a back button, dispose the play button when no beatmaps present, display track as background, change wedge padding so it wont overlap with toolbars
This commit is contained in:
parent
b0279c05e6
commit
e2999a0a53
@ -21,6 +21,7 @@ using osu.Game.Beatmaps.Drawable;
|
|||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Framework.GameModes;
|
using osu.Framework.GameModes;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
@ -30,12 +31,12 @@ namespace osu.Game.GameModes.Play
|
|||||||
private BeatmapDatabase database;
|
private BeatmapDatabase database;
|
||||||
private BeatmapGroup selectedBeatmapGroup;
|
private BeatmapGroup selectedBeatmapGroup;
|
||||||
private BeatmapInfo selectedBeatmapInfo;
|
private BeatmapInfo selectedBeatmapInfo;
|
||||||
// TODO: use currently selected track as bg
|
|
||||||
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
|
|
||||||
private ScrollContainer scrollContainer;
|
private ScrollContainer scrollContainer;
|
||||||
|
private Button playButton;
|
||||||
private FlowContainer beatmapSetFlow;
|
private FlowContainer beatmapSetFlow;
|
||||||
private TrackManager trackManager;
|
private TrackManager trackManager;
|
||||||
private Container wedgeContainer;
|
private Container wedgeContainer;
|
||||||
|
private Sprite background;
|
||||||
|
|
||||||
/// <param name="database">Optionally provide a database to use instead of the OsuGame one.</param>
|
/// <param name="database">Optionally provide a database to use instead of the OsuGame one.</param>
|
||||||
public PlaySongSelect(BeatmapDatabase database = null)
|
public PlaySongSelect(BeatmapDatabase database = null)
|
||||||
@ -44,13 +45,22 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
const float scrollWidth = 640;
|
const float scrollWidth = 640;
|
||||||
const float bottomToolHeight = 50;
|
const float bottomToolHeight = 50;
|
||||||
|
const float topToolHeight = 50;
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
background = new Sprite {
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
RelativePositionAxes = Axes.Both,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = Vector2.One,
|
||||||
|
Alpha = 0.5f,
|
||||||
|
},
|
||||||
wedgeContainer = new Container
|
wedgeContainer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Size = Vector2.One,
|
Size = Vector2.One,
|
||||||
Padding = new MarginPadding { Right = scrollWidth - 200 },
|
Padding = new MarginPadding { Right = scrollWidth - 200, Bottom = bottomToolHeight, Top = topToolHeight },
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
@ -81,7 +91,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
{
|
{
|
||||||
beatmapSetFlow = new FlowContainer
|
beatmapSetFlow = new FlowContainer
|
||||||
{
|
{
|
||||||
Padding = new MarginPadding { Left = 25, Top = 25, Bottom = 25 + bottomToolHeight },
|
Padding = new MarginPadding { Left = 25, Top = topToolHeight, Bottom = 25 + bottomToolHeight },
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Direction = FlowDirection.VerticalOnly,
|
Direction = FlowDirection.VerticalOnly,
|
||||||
@ -103,7 +113,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
Size = Vector2.One,
|
Size = Vector2.One,
|
||||||
Colour = new Color4(0, 0, 0, 0.5f),
|
Colour = new Color4(0, 0, 0, 0.5f),
|
||||||
},
|
},
|
||||||
new Button
|
playButton = new Button
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
@ -116,6 +126,18 @@ namespace osu.Game.GameModes.Play
|
|||||||
PreferredPlayMode = playMode.Value
|
PreferredPlayMode = playMode.Value
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
new Button
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Width = 100,
|
||||||
|
Text = "Back",
|
||||||
|
Colour = new Color4(238, 51, 153, 255),
|
||||||
|
Action = delegate {
|
||||||
|
Exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -206,6 +228,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
if (!beatmap.Equals(Beatmap?.BeatmapInfo))
|
if (!beatmap.Equals(Beatmap?.BeatmapInfo))
|
||||||
{
|
{
|
||||||
Beatmap = database.GetWorkingBeatmap(beatmap, Beatmap);
|
Beatmap = database.GetWorkingBeatmap(beatmap, Beatmap);
|
||||||
|
background.Texture = Beatmap.Background;
|
||||||
}
|
}
|
||||||
|
|
||||||
ensurePlayingSelected();
|
ensurePlayingSelected();
|
||||||
@ -276,8 +299,10 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
private void addBeatmapSets()
|
private void addBeatmapSets()
|
||||||
{
|
{
|
||||||
|
if (database.Query<BeatmapSetInfo>().Count() > 0)
|
||||||
foreach (var beatmapSet in database.Query<BeatmapSetInfo>())
|
foreach (var beatmapSet in database.Query<BeatmapSetInfo>())
|
||||||
addBeatmapSet(beatmapSet);
|
addBeatmapSet(beatmapSet);
|
||||||
|
else playButton.Dispose(); // not sure about this
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user