2016-11-23 12:07:35 +08:00
|
|
|
|
using System;
|
2016-11-24 12:48:48 +08:00
|
|
|
|
using osu.Framework;
|
|
|
|
|
using osu.Framework.Allocation;
|
2016-11-23 12:07:35 +08:00
|
|
|
|
using OpenTK;
|
2016-11-23 04:51:42 +08:00
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Primitives;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Database;
|
|
|
|
|
using osu.Framework.Graphics.Colour;
|
2016-11-24 12:48:48 +08:00
|
|
|
|
using osu.Game.Beatmaps.Drawables;
|
2016-11-23 04:51:42 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Select
|
|
|
|
|
{
|
2016-11-24 12:48:48 +08:00
|
|
|
|
class BeatmapInfoWedge : Container
|
2016-11-23 04:51:42 +08:00
|
|
|
|
{
|
2016-11-26 16:31:35 +08:00
|
|
|
|
private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0);
|
|
|
|
|
|
2016-11-23 04:51:42 +08:00
|
|
|
|
private Container beatmapInfoContainer;
|
|
|
|
|
|
2016-11-24 12:48:48 +08:00
|
|
|
|
private BaseGame game;
|
|
|
|
|
|
2016-11-26 16:31:35 +08:00
|
|
|
|
public BeatmapInfoWedge()
|
|
|
|
|
{
|
|
|
|
|
Shear = wedged_container_shear;
|
|
|
|
|
Masking = true;
|
|
|
|
|
BorderColour = new Color4(221, 255, 255, 255);
|
|
|
|
|
BorderThickness = 2.5f;
|
|
|
|
|
EdgeEffect = new EdgeEffect
|
|
|
|
|
{
|
|
|
|
|
Type = EdgeEffectType.Glow,
|
|
|
|
|
Colour = new Color4(130, 204, 255, 150),
|
|
|
|
|
Radius = 20,
|
|
|
|
|
Roundness = 15,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-24 12:48:48 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(BaseGame game)
|
|
|
|
|
{
|
|
|
|
|
this.game = game;
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-23 04:51:42 +08:00
|
|
|
|
public void UpdateBeatmap(WorkingBeatmap beatmap)
|
|
|
|
|
{
|
|
|
|
|
if (beatmap == null)
|
|
|
|
|
return;
|
|
|
|
|
|
2016-11-24 12:48:48 +08:00
|
|
|
|
var lastContainer = beatmapInfoContainer;
|
|
|
|
|
|
|
|
|
|
float newDepth = lastContainer?.Depth - 1 ?? 0;
|
2016-11-23 04:51:42 +08:00
|
|
|
|
|
|
|
|
|
BeatmapSetInfo beatmapSetInfo = beatmap.BeatmapSetInfo;
|
|
|
|
|
BeatmapInfo beatmapInfo = beatmap.BeatmapInfo;
|
2016-11-24 12:48:48 +08:00
|
|
|
|
|
|
|
|
|
(beatmapInfoContainer = new BufferedContainer
|
2016-11-23 04:51:42 +08:00
|
|
|
|
{
|
2016-11-24 01:30:50 +08:00
|
|
|
|
Depth = newDepth,
|
2016-11-23 04:51:42 +08:00
|
|
|
|
PixelSnapping = true,
|
|
|
|
|
CacheDrawnFrameBuffer = true,
|
|
|
|
|
Shear = -Shear,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
// We will create the white-to-black gradient by modulating transparency and having
|
|
|
|
|
// a black backdrop. This results in an sRGB-space gradient and not linear space,
|
|
|
|
|
// transitioning from white to black more perceptually uniformly.
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Black,
|
|
|
|
|
},
|
|
|
|
|
// We use a container, such that we can set the colour gradient to go across the
|
|
|
|
|
// vertices of the masked container instead of the vertices of the (larger) sprite.
|
2016-11-24 12:48:48 +08:00
|
|
|
|
new Container
|
2016-11-23 04:51:42 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
ColourInfo = ColourInfo.GradientVertical(Color4.White, new Color4(1f, 1f, 1f, 0.3f)),
|
|
|
|
|
Children = new []
|
|
|
|
|
{
|
|
|
|
|
// Zoomed-in and cropped beatmap background
|
2016-11-24 12:48:48 +08:00
|
|
|
|
new BeatmapBackgroundSprite(beatmap)
|
2016-11-23 04:51:42 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2016-11-23 12:07:35 +08:00
|
|
|
|
FillMode = FillMode.Fill,
|
2016-11-23 04:51:42 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
// Text for beatmap info
|
|
|
|
|
new FlowContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
Direction = FlowDirection.VerticalOnly,
|
|
|
|
|
Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 40 },
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
new SpriteText
|
|
|
|
|
{
|
|
|
|
|
Font = @"Exo2.0-MediumItalic",
|
|
|
|
|
Text = beatmapSetInfo.Metadata.Artist + " -- " + beatmapSetInfo.Metadata.Title,
|
|
|
|
|
TextSize = 28,
|
|
|
|
|
Shadow = true,
|
|
|
|
|
},
|
|
|
|
|
new SpriteText
|
|
|
|
|
{
|
|
|
|
|
Font = @"Exo2.0-MediumItalic",
|
|
|
|
|
Text = beatmapInfo.Version,
|
|
|
|
|
TextSize = 17,
|
|
|
|
|
Shadow = true,
|
|
|
|
|
},
|
|
|
|
|
new FlowContainer
|
|
|
|
|
{
|
|
|
|
|
Margin = new MarginPadding { Top = 10 },
|
|
|
|
|
Direction = FlowDirection.HorizontalOnly,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Children = new []
|
|
|
|
|
{
|
|
|
|
|
new SpriteText
|
|
|
|
|
{
|
|
|
|
|
Font = @"Exo2.0-Medium",
|
|
|
|
|
Text = "mapped by ",
|
|
|
|
|
TextSize = 15,
|
|
|
|
|
Shadow = true,
|
|
|
|
|
},
|
|
|
|
|
new SpriteText
|
|
|
|
|
{
|
|
|
|
|
Font = @"Exo2.0-Bold",
|
|
|
|
|
Text = beatmapSetInfo.Metadata.Author,
|
|
|
|
|
TextSize = 15,
|
|
|
|
|
Shadow = true,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-11-24 12:48:48 +08:00
|
|
|
|
}).Preload(game, delegate(Drawable d)
|
|
|
|
|
{
|
2016-11-26 16:31:35 +08:00
|
|
|
|
FadeIn(250);
|
|
|
|
|
|
2016-11-24 12:48:48 +08:00
|
|
|
|
lastContainer?.FadeOut(250);
|
|
|
|
|
lastContainer?.Expire();
|
|
|
|
|
|
|
|
|
|
Add(d);
|
2016-11-23 04:51:42 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|