2017-03-25 06:02:24 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-03-26 06:33:03 +08:00
|
|
|
|
using OpenTK;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
using osu.Framework.Allocation;
|
2017-03-25 06:02:24 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2017-03-26 06:33:03 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2017-03-25 06:02:24 +08:00
|
|
|
|
using osu.Framework.Graphics.Primitives;
|
2017-03-26 06:33:03 +08:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Game.Database;
|
2017-03-25 06:02:24 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2017-04-02 00:12:44 +08:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2017-04-04 01:28:05 +08:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2017-03-28 23:12:54 +08:00
|
|
|
|
using System.Collections.Generic;
|
2017-03-29 22:10:07 +08:00
|
|
|
|
using System.Globalization;
|
2017-03-26 06:33:03 +08:00
|
|
|
|
using System.Linq;
|
2017-03-25 06:02:24 +08:00
|
|
|
|
|
2017-04-04 01:28:05 +08:00
|
|
|
|
namespace osu.Game.Screens.Select
|
2017-03-25 06:02:24 +08:00
|
|
|
|
{
|
2017-03-30 23:32:18 +08:00
|
|
|
|
public class BeatmapDetails : Container
|
2017-03-25 06:02:24 +08:00
|
|
|
|
{
|
2017-04-08 01:27:14 +08:00
|
|
|
|
private readonly MetadataSegment description;
|
|
|
|
|
private readonly MetadataSegment source;
|
|
|
|
|
private readonly MetadataSegment tags;
|
2017-03-26 06:33:03 +08:00
|
|
|
|
|
2017-03-29 22:00:29 +08:00
|
|
|
|
private readonly DifficultyRow circleSize;
|
|
|
|
|
private readonly DifficultyRow drainRate;
|
|
|
|
|
private readonly DifficultyRow overallDifficulty;
|
|
|
|
|
private readonly DifficultyRow approachRate;
|
|
|
|
|
private readonly DifficultyRow stars;
|
2017-03-26 06:33:03 +08:00
|
|
|
|
|
2017-04-08 01:58:49 +08:00
|
|
|
|
private readonly Container ratingsContainer;
|
2017-04-04 01:28:05 +08:00
|
|
|
|
private readonly Bar ratingsBar;
|
2017-04-02 00:12:44 +08:00
|
|
|
|
private readonly OsuSpriteText negativeRatings;
|
|
|
|
|
private readonly OsuSpriteText positiveRatings;
|
2017-04-04 01:28:05 +08:00
|
|
|
|
private readonly BarGraph ratingsGraph;
|
2017-03-28 23:12:54 +08:00
|
|
|
|
|
2017-04-11 20:02:56 +08:00
|
|
|
|
private readonly FillFlowContainer retryFailContainer;
|
2017-04-04 01:28:05 +08:00
|
|
|
|
private readonly BarGraph retryGraph;
|
|
|
|
|
private readonly BarGraph failGraph;
|
2017-03-29 02:18:56 +08:00
|
|
|
|
|
2017-03-26 06:33:03 +08:00
|
|
|
|
private BeatmapInfo beatmap;
|
|
|
|
|
public BeatmapInfo Beatmap
|
2017-03-25 06:02:24 +08:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2017-03-26 06:33:03 +08:00
|
|
|
|
return beatmap;
|
2017-03-25 06:02:24 +08:00
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
2017-03-26 06:33:03 +08:00
|
|
|
|
if (beatmap == value) return;
|
|
|
|
|
beatmap = value;
|
2017-04-08 01:27:14 +08:00
|
|
|
|
|
2017-04-10 22:42:23 +08:00
|
|
|
|
description.Text = beatmap.Version;
|
|
|
|
|
source.Text = beatmap.Metadata.Source;
|
|
|
|
|
tags.Text = beatmap.Metadata.Tags;
|
2017-03-26 06:33:03 +08:00
|
|
|
|
|
|
|
|
|
circleSize.Value = beatmap.Difficulty.CircleSize;
|
|
|
|
|
drainRate.Value = beatmap.Difficulty.DrainRate;
|
|
|
|
|
overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty;
|
2017-03-28 23:12:54 +08:00
|
|
|
|
approachRate.Value = beatmap.Difficulty.ApproachRate;
|
2017-04-04 23:27:08 +08:00
|
|
|
|
stars.Value = (float)beatmap.StarDifficulty;
|
2017-03-25 06:02:24 +08:00
|
|
|
|
|
2017-04-11 20:22:13 +08:00
|
|
|
|
if (beatmap.Metric?.Ratings == null)
|
2017-04-11 20:12:23 +08:00
|
|
|
|
ratingsContainer.Hide();
|
|
|
|
|
else
|
2017-04-08 01:58:49 +08:00
|
|
|
|
{
|
2017-04-11 20:12:23 +08:00
|
|
|
|
List<int> ratings = beatmap.Metric.Ratings;
|
2017-04-10 22:42:23 +08:00
|
|
|
|
ratingsContainer.Show();
|
2017-04-11 20:02:56 +08:00
|
|
|
|
|
2017-04-08 01:58:49 +08:00
|
|
|
|
negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString();
|
|
|
|
|
positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString();
|
|
|
|
|
ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum();
|
2017-03-28 23:12:54 +08:00
|
|
|
|
|
2017-04-08 01:58:49 +08:00
|
|
|
|
ratingsGraph.Values = ratings.Select(rating => (float)rating);
|
|
|
|
|
}
|
2017-04-11 20:02:56 +08:00
|
|
|
|
|
2017-04-11 20:40:12 +08:00
|
|
|
|
if (beatmap.Metric?.Retries == null || beatmap.Metric?.Fails == null)
|
2017-04-11 20:12:23 +08:00
|
|
|
|
retryFailContainer.Hide();
|
|
|
|
|
else
|
2017-04-10 22:42:23 +08:00
|
|
|
|
{
|
2017-04-11 20:12:23 +08:00
|
|
|
|
List<int> retries = beatmap.Metric.Retries;
|
|
|
|
|
List<int> fails = beatmap.Metric.Fails;
|
2017-04-11 20:02:56 +08:00
|
|
|
|
retryFailContainer.Show();
|
2017-04-11 20:12:23 +08:00
|
|
|
|
|
2017-04-10 22:42:23 +08:00
|
|
|
|
float maxValue = fails.Select((fail, index) => fail + retries[index]).Max();
|
|
|
|
|
failGraph.MaxValue = maxValue;
|
|
|
|
|
retryGraph.MaxValue = maxValue;
|
2017-04-11 20:12:23 +08:00
|
|
|
|
|
2017-04-10 22:42:23 +08:00
|
|
|
|
failGraph.Values = fails.Select(fail => (float)fail);
|
|
|
|
|
retryGraph.Values = retries.Select((retry, index) => retry + MathHelper.Clamp(fails[index], 0, maxValue));
|
|
|
|
|
}
|
2017-04-08 02:19:03 +08:00
|
|
|
|
}
|
2017-03-29 02:18:56 +08:00
|
|
|
|
}
|
2017-03-28 23:12:54 +08:00
|
|
|
|
|
2017-03-30 23:32:18 +08:00
|
|
|
|
public BeatmapDetails()
|
2017-03-25 06:02:24 +08:00
|
|
|
|
{
|
2017-03-26 06:33:03 +08:00
|
|
|
|
Children = new Drawable[]
|
2017-03-25 06:02:24 +08:00
|
|
|
|
{
|
2017-03-26 06:33:03 +08:00
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Black,
|
|
|
|
|
Alpha = 0.5f,
|
|
|
|
|
},
|
2017-04-08 01:27:14 +08:00
|
|
|
|
new FillFlowContainer<MetadataSegment>()
|
2017-03-25 06:02:24 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Width = 0.4f,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
2017-04-08 01:27:14 +08:00
|
|
|
|
LayoutDuration = 1,
|
|
|
|
|
LayoutEasing = EasingTypes.OutQuint,
|
2017-03-28 23:12:54 +08:00
|
|
|
|
Padding = new MarginPadding(10) { Top = 25 },
|
2017-04-08 01:27:14 +08:00
|
|
|
|
Children = new []
|
2017-03-25 06:02:24 +08:00
|
|
|
|
{
|
2017-04-10 22:42:23 +08:00
|
|
|
|
description = new MetadataSegment("Description"),
|
|
|
|
|
source = new MetadataSegment("Source"),
|
|
|
|
|
tags = new MetadataSegment("Tags")
|
2017-03-25 06:02:24 +08:00
|
|
|
|
},
|
2017-03-26 06:33:03 +08:00
|
|
|
|
},
|
2017-03-28 23:12:54 +08:00
|
|
|
|
new FillFlowContainer
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Width = 0.6f,
|
2017-03-28 23:12:54 +08:00
|
|
|
|
Direction = FillDirection.Vertical,
|
2017-04-10 22:42:23 +08:00
|
|
|
|
Spacing = new Vector2(0, 15),
|
2017-03-28 23:12:54 +08:00
|
|
|
|
Padding = new MarginPadding(10) { Top = 0 },
|
2017-03-30 23:32:18 +08:00
|
|
|
|
Children = new Drawable[]
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
2017-03-28 23:12:54 +08:00
|
|
|
|
new Container
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2017-03-28 23:12:54 +08:00
|
|
|
|
Children = new Drawable[]
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
2017-03-28 23:12:54 +08:00
|
|
|
|
new Box
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
2017-03-28 23:12:54 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Black,
|
|
|
|
|
Alpha = 0.5f,
|
2017-03-26 06:33:03 +08:00
|
|
|
|
},
|
2017-03-28 23:12:54 +08:00
|
|
|
|
new FillFlowContainer
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2017-03-28 23:12:54 +08:00
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Spacing = new Vector2(0,10),
|
|
|
|
|
Padding = new MarginPadding(15) { Top = 25 },
|
|
|
|
|
Children = new []
|
|
|
|
|
{
|
2017-04-10 22:42:23 +08:00
|
|
|
|
circleSize = new DifficultyRow("Circle Size", 7),
|
|
|
|
|
drainRate = new DifficultyRow("HP Drain"),
|
|
|
|
|
overallDifficulty = new DifficultyRow("Accuracy"),
|
|
|
|
|
approachRate = new DifficultyRow("Approach Rate"),
|
|
|
|
|
stars = new DifficultyRow("Star Diffculty"),
|
2017-03-28 23:12:54 +08:00
|
|
|
|
},
|
2017-03-26 06:33:03 +08:00
|
|
|
|
},
|
2017-03-28 23:12:54 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
2017-04-08 01:58:49 +08:00
|
|
|
|
ratingsContainer = new Container
|
2017-03-28 23:12:54 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2017-04-08 01:58:49 +08:00
|
|
|
|
Alpha = 0,
|
|
|
|
|
AlwaysPresent = true,
|
2017-03-28 23:12:54 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
2017-03-28 23:12:54 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Black,
|
|
|
|
|
Alpha = 0.5f,
|
2017-03-26 06:33:03 +08:00
|
|
|
|
},
|
2017-03-28 23:12:54 +08:00
|
|
|
|
new FillFlowContainer
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2017-03-28 23:12:54 +08:00
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Padding = new MarginPadding(15) { Top = 25, Bottom = 0 },
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2017-04-02 00:12:44 +08:00
|
|
|
|
new OsuSpriteText
|
2017-03-28 23:12:54 +08:00
|
|
|
|
{
|
|
|
|
|
Text = "User Rating",
|
|
|
|
|
Font = @"Exo2.0-Medium",
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
},
|
2017-04-04 01:28:05 +08:00
|
|
|
|
ratingsBar = new Bar
|
2017-03-28 23:12:54 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = 5,
|
|
|
|
|
Length = 0,
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
2017-04-02 00:12:44 +08:00
|
|
|
|
negativeRatings = new OsuSpriteText
|
2017-03-28 23:12:54 +08:00
|
|
|
|
{
|
2017-04-04 05:03:49 +08:00
|
|
|
|
Font = @"Exo2.0-Regular",
|
2017-03-28 23:12:54 +08:00
|
|
|
|
Text = "0",
|
|
|
|
|
},
|
2017-04-02 00:12:44 +08:00
|
|
|
|
positiveRatings = new OsuSpriteText
|
2017-03-28 23:12:54 +08:00
|
|
|
|
{
|
2017-04-04 05:03:49 +08:00
|
|
|
|
Font = @"Exo2.0-Regular",
|
2017-03-28 23:12:54 +08:00
|
|
|
|
Text = "0",
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2017-04-02 00:12:44 +08:00
|
|
|
|
new OsuSpriteText
|
2017-03-28 23:12:54 +08:00
|
|
|
|
{
|
|
|
|
|
Text = "Rating Spread",
|
|
|
|
|
TextSize = 14,
|
2017-04-04 05:03:49 +08:00
|
|
|
|
Font = @"Exo2.0-Regular",
|
2017-03-29 02:18:56 +08:00
|
|
|
|
Anchor = Anchor.TopCentre,
|
2017-03-28 23:12:54 +08:00
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
},
|
2017-04-04 01:28:05 +08:00
|
|
|
|
ratingsGraph = new BarGraph
|
2017-03-28 23:12:54 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = 50,
|
2017-03-29 02:18:56 +08:00
|
|
|
|
},
|
2017-03-28 23:12:54 +08:00
|
|
|
|
},
|
2017-03-26 06:33:03 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2017-04-11 20:02:56 +08:00
|
|
|
|
retryFailContainer = new FillFlowContainer
|
2017-03-30 23:32:18 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2017-04-08 02:19:03 +08:00
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Alpha = 0,
|
|
|
|
|
Children = new Drawable[]
|
2017-03-30 23:32:18 +08:00
|
|
|
|
{
|
2017-04-08 02:19:03 +08:00
|
|
|
|
new OsuSpriteText
|
2017-03-30 23:32:18 +08:00
|
|
|
|
{
|
2017-04-08 02:19:03 +08:00
|
|
|
|
Text = "Points of Failure",
|
2017-04-10 22:42:23 +08:00
|
|
|
|
Font = @"Exo2.0-Regular",
|
2017-03-30 23:32:18 +08:00
|
|
|
|
},
|
2017-04-08 02:19:03 +08:00
|
|
|
|
new Container<BarGraph>
|
2017-03-30 23:32:18 +08:00
|
|
|
|
{
|
2017-04-08 02:19:03 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Size = new Vector2(1/0.6f, 50),
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
retryGraph = new BarGraph
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
|
|
|
|
failGraph = new BarGraph
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
|
|
|
|
},
|
2017-03-30 23:32:18 +08:00
|
|
|
|
},
|
2017-04-08 02:19:03 +08:00
|
|
|
|
}
|
2017-03-29 02:18:56 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
2017-04-10 22:42:23 +08:00
|
|
|
|
}
|
2017-03-25 06:02:24 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colour)
|
|
|
|
|
{
|
2017-04-08 19:31:55 +08:00
|
|
|
|
description.AccentColour = colour.GrayB;
|
|
|
|
|
source.AccentColour = colour.GrayB;
|
|
|
|
|
tags.AccentColour = colour.YellowLight;
|
2017-03-28 23:12:54 +08:00
|
|
|
|
|
2017-04-08 19:31:55 +08:00
|
|
|
|
stars.AccentColour = colour.Yellow;
|
2017-03-28 23:12:54 +08:00
|
|
|
|
|
|
|
|
|
ratingsBar.BackgroundColour = colour.Green;
|
2017-04-08 19:53:11 +08:00
|
|
|
|
ratingsBar.AccentColour = colour.YellowDark;
|
2017-03-28 23:12:54 +08:00
|
|
|
|
ratingsGraph.Colour = colour.BlueDark;
|
2017-03-30 23:32:18 +08:00
|
|
|
|
|
|
|
|
|
failGraph.Colour = colour.YellowDarker;
|
|
|
|
|
retryGraph.Colour = colour.Yellow;
|
2017-03-26 06:33:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-04-08 19:31:55 +08:00
|
|
|
|
private class DifficultyRow : Container, IHasAccentColour
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
2017-04-02 00:12:44 +08:00
|
|
|
|
private readonly OsuSpriteText name;
|
2017-04-04 01:28:05 +08:00
|
|
|
|
private readonly Bar bar;
|
2017-04-02 00:12:44 +08:00
|
|
|
|
private readonly OsuSpriteText valueText;
|
2017-03-26 06:33:03 +08:00
|
|
|
|
|
2017-04-10 22:42:23 +08:00
|
|
|
|
private readonly float maxValue;
|
2017-04-04 23:27:08 +08:00
|
|
|
|
|
2017-04-10 22:42:23 +08:00
|
|
|
|
private float difficultyValue;
|
2017-03-26 06:33:03 +08:00
|
|
|
|
public float Value
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return difficultyValue;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
difficultyValue = value;
|
2017-04-04 23:27:08 +08:00
|
|
|
|
bar.Length = value / maxValue;
|
2017-03-29 22:10:07 +08:00
|
|
|
|
valueText.Text = value.ToString(CultureInfo.InvariantCulture);
|
2017-03-26 06:33:03 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-08 19:31:55 +08:00
|
|
|
|
public Color4 AccentColour
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2017-04-08 19:53:11 +08:00
|
|
|
|
return bar.AccentColour;
|
2017-03-26 06:33:03 +08:00
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
2017-04-08 19:53:11 +08:00
|
|
|
|
bar.AccentColour = value;
|
2017-03-26 06:33:03 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-10 22:42:23 +08:00
|
|
|
|
public DifficultyRow(string difficultyName, float maxValue = 10)
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
2017-04-10 22:42:23 +08:00
|
|
|
|
this.maxValue = maxValue;
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
2017-03-26 06:33:03 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2017-04-02 00:12:44 +08:00
|
|
|
|
name = new OsuSpriteText
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
2017-04-04 05:03:49 +08:00
|
|
|
|
Font = @"Exo2.0-Regular",
|
2017-04-10 22:42:23 +08:00
|
|
|
|
Text = difficultyName,
|
2017-03-26 06:33:03 +08:00
|
|
|
|
},
|
2017-04-04 01:28:05 +08:00
|
|
|
|
bar = new Bar
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Size = new Vector2(1, 0.35f),
|
|
|
|
|
Padding = new MarginPadding { Left = 100, Right = 25 },
|
|
|
|
|
},
|
2017-04-02 00:12:44 +08:00
|
|
|
|
valueText = new OsuSpriteText
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
2017-04-04 05:03:49 +08:00
|
|
|
|
Font = @"Exo2.0-Regular",
|
2017-03-26 06:33:03 +08:00
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colour)
|
|
|
|
|
{
|
|
|
|
|
name.Colour = colour.GrayB;
|
|
|
|
|
bar.BackgroundColour = colour.Gray7;
|
|
|
|
|
valueText.Colour = colour.GrayB;
|
|
|
|
|
}
|
2017-03-25 06:02:24 +08:00
|
|
|
|
}
|
2017-04-08 01:27:14 +08:00
|
|
|
|
|
2017-04-08 19:31:55 +08:00
|
|
|
|
private class MetadataSegment : Container, IHasAccentColour
|
2017-04-08 01:27:14 +08:00
|
|
|
|
{
|
|
|
|
|
private readonly OsuSpriteText header;
|
|
|
|
|
private readonly FillFlowContainer<OsuSpriteText> content;
|
|
|
|
|
|
2017-04-10 22:42:23 +08:00
|
|
|
|
public string Text
|
2017-04-08 01:27:14 +08:00
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
2017-04-10 22:42:23 +08:00
|
|
|
|
if (string.IsNullOrEmpty(value))
|
|
|
|
|
Hide();
|
2017-04-08 01:27:14 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
2017-04-10 22:42:23 +08:00
|
|
|
|
Show();
|
|
|
|
|
if (header.Text == "Tags")
|
|
|
|
|
content.Children = value.Split(' ').Select(text => new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = text,
|
|
|
|
|
Font = "Exo2.0-Regular",
|
|
|
|
|
});
|
|
|
|
|
else
|
|
|
|
|
content.Children = new[]
|
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = value,
|
|
|
|
|
Font = "Exo2.0-Regular",
|
|
|
|
|
}
|
|
|
|
|
};
|
2017-04-08 01:27:14 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-08 19:31:55 +08:00
|
|
|
|
public Color4 AccentColour
|
2017-04-08 01:27:14 +08:00
|
|
|
|
{
|
2017-04-08 19:31:55 +08:00
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return content.Colour;
|
|
|
|
|
}
|
2017-04-08 01:27:14 +08:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
content.Colour = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-10 22:42:23 +08:00
|
|
|
|
public MetadataSegment(string headerText)
|
2017-04-08 01:27:14 +08:00
|
|
|
|
{
|
2017-04-10 22:42:23 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
Margin = new MarginPadding { Top = 10 };
|
2017-04-08 01:27:14 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
header = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Font = @"Exo2.0-Bold",
|
2017-04-10 22:42:23 +08:00
|
|
|
|
Text = headerText,
|
2017-04-08 01:27:14 +08:00
|
|
|
|
},
|
|
|
|
|
content = new FillFlowContainer<OsuSpriteText>
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Direction = FillDirection.Full,
|
2017-04-08 19:59:22 +08:00
|
|
|
|
Spacing = new Vector2(5,0),
|
2017-04-08 01:27:14 +08:00
|
|
|
|
Margin = new MarginPadding { Top = header.TextSize }
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-25 06:02:24 +08:00
|
|
|
|
}
|
2017-04-04 23:27:08 +08:00
|
|
|
|
}
|