Move WedgeBackground to its own class and improve display a bit.

This commit is contained in:
Dean Herbert 2016-11-23 14:29:20 +09:00
parent 622b127180
commit 1e0b7dffc0
1 changed files with 36 additions and 22 deletions

View File

@ -24,6 +24,7 @@
using osu.Game.Screens.Play;
using osu.Framework;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics.Containers;
namespace osu.Game.Screens.Select
{
@ -35,7 +36,6 @@ public class PlaySongSelect : OsuGameMode
private CarouselContainer carousel;
private TrackManager trackManager;
private Container backgroundWedgesContainer;
private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 225);
private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0);
@ -45,46 +45,60 @@ public class PlaySongSelect : OsuGameMode
private static readonly Vector2 BACKGROUND_BLUR = new Vector2(20);
private CancellationTokenSource initialAddSetsTask;
class WedgeBackground : Container
{
public WedgeBackground()
{
Children = new[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Size = new Vector2(1, 0.5f),
Colour = new Color4(0, 0, 0, 0.5f),
Shear = new Vector2(0.15f, 0),
EdgeSmoothness = new Vector2(2, 0),
},
new Box
{
RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Y,
Size = new Vector2(1, -0.5f),
Position = new Vector2(0, 1),
Colour = new Color4(0, 0, 0, 0.5f),
Shear = new Vector2(-0.15f, 0),
EdgeSmoothness = new Vector2(2, 0),
},
};
}
}
/// <param name="database">Optionally provide a database to use instead of the OsuGame one.</param>
public PlaySongSelect(BeatmapDatabase database = null)
{
this.database = database;
const float scrollWidth = 640;
const float carouselWidth = 640;
const float bottomToolHeight = 50;
Children = new Drawable[]
{
backgroundWedgesContainer = new Container
new ParallaxContainer
{
ParallaxAmount = 0.005f,
RelativeSizeAxes = Axes.Both,
Size = Vector2.One,
Padding = new MarginPadding { Right = scrollWidth },
Children = new[]
Children = new []
{
new Box
new WedgeBackground
{
RelativeSizeAxes = Axes.Both,
Size = new Vector2(1, 0.5f),
Colour = new Color4(0, 0, 0, 0.5f),
Shear = new Vector2(0.15f, 0),
EdgeSmoothness = new Vector2(2, 0),
},
new Box
{
RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Y,
Size = new Vector2(1, -0.5f),
Position = new Vector2(0, 1),
Colour = new Color4(0, 0, 0, 0.5f),
Shear = new Vector2(-0.15f, 0),
EdgeSmoothness = new Vector2(2, 0),
Padding = new MarginPadding { Right = carouselWidth * 0.76f },
},
}
},
carousel = new CarouselContainer
{
RelativeSizeAxes = Axes.Y,
Size = new Vector2(scrollWidth, 1),
Size = new Vector2(carouselWidth, 1),
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
},