2017-05-20 07:34:51 +08:00
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
2017-05-18 03:37:34 +08:00
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
2017-05-19 23:52:23 +08:00
|
|
|
using System.Collections.Generic;
|
2017-05-18 03:37:34 +08:00
|
|
|
using OpenTK;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2017-07-26 12:22:46 +08:00
|
|
|
using osu.Game.Beatmaps;
|
2017-05-18 05:42:40 +08:00
|
|
|
using osu.Game.Beatmaps.Drawables;
|
2017-05-18 03:37:34 +08:00
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Direct
|
|
|
|
{
|
2017-05-18 05:02:33 +08:00
|
|
|
public abstract class DirectPanel : Container
|
2017-05-18 03:37:34 +08:00
|
|
|
{
|
2017-05-19 23:52:23 +08:00
|
|
|
protected readonly BeatmapSetInfo SetInfo;
|
|
|
|
|
2017-05-20 06:50:45 +08:00
|
|
|
protected DirectPanel(BeatmapSetInfo setInfo)
|
2017-05-20 03:12:47 +08:00
|
|
|
{
|
|
|
|
SetInfo = setInfo;
|
|
|
|
}
|
|
|
|
|
2017-06-24 18:56:35 +08:00
|
|
|
protected List<DifficultyIcon> GetDifficultyIcons()
|
2017-05-19 23:52:23 +08:00
|
|
|
{
|
2017-05-20 03:11:45 +08:00
|
|
|
var icons = new List<DifficultyIcon>();
|
2017-05-20 06:22:42 +08:00
|
|
|
|
2017-05-20 03:11:45 +08:00
|
|
|
foreach (var b in SetInfo.Beatmaps)
|
|
|
|
icons.Add(new DifficultyIcon(b));
|
2017-05-20 06:27:51 +08:00
|
|
|
|
2017-05-20 03:11:45 +08:00
|
|
|
return icons;
|
2017-05-19 02:01:01 +08:00
|
|
|
}
|
2017-05-20 06:27:51 +08:00
|
|
|
|
2017-07-13 12:17:47 +08:00
|
|
|
protected Drawable CreateBackground() => new DelayedLoadWrapper(new BeatmapSetCover(SetInfo)
|
2017-05-20 02:43:18 +08:00
|
|
|
{
|
2017-07-13 09:30:09 +08:00
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
FillMode = FillMode.Fill,
|
2017-07-23 02:50:25 +08:00
|
|
|
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
|
2017-07-13 09:30:09 +08:00
|
|
|
})
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
TimeBeforeLoad = 300
|
|
|
|
};
|
2017-05-19 23:52:23 +08:00
|
|
|
|
2017-05-18 05:02:33 +08:00
|
|
|
public class Statistic : FillFlowContainer
|
2017-05-18 03:37:34 +08:00
|
|
|
{
|
|
|
|
private readonly SpriteText text;
|
|
|
|
|
|
|
|
private int value;
|
2017-07-13 09:30:09 +08:00
|
|
|
|
2017-05-18 03:37:34 +08:00
|
|
|
public int Value
|
|
|
|
{
|
|
|
|
get { return value; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
this.value = value;
|
2017-05-20 07:37:13 +08:00
|
|
|
text.Text = Value.ToString(@"N0");
|
2017-05-18 03:37:34 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Statistic(FontAwesome icon, int value = 0)
|
|
|
|
{
|
|
|
|
Anchor = Anchor.TopRight;
|
|
|
|
Origin = Anchor.TopRight;
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
Direction = FillDirection.Horizontal;
|
|
|
|
Spacing = new Vector2(5f, 0f);
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
text = new OsuSpriteText
|
|
|
|
{
|
|
|
|
Font = @"Exo2.0-SemiBoldItalic",
|
|
|
|
},
|
2017-08-03 13:36:21 +08:00
|
|
|
new SpriteIcon
|
2017-05-18 03:37:34 +08:00
|
|
|
{
|
|
|
|
Icon = icon,
|
|
|
|
Shadow = true,
|
2017-08-03 13:36:21 +08:00
|
|
|
Size = new Vector2(14),
|
2017-05-18 03:37:34 +08:00
|
|
|
Margin = new MarginPadding { Top = 1 },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
Value = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|