diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs
index 36e52717e4..d0d7602831 100644
--- a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs
+++ b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs
@@ -40,6 +40,10 @@ namespace osu.Desktop.VisualTests.Tests
},
StarDifficulty = 5.3f,
},
+ Ratings = new[]
+ {
+ 1,2,3,4,5,6,7,8,9,10
+ }
});
}
}
diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj
index d94358a6a1..19b679dc1c 100644
--- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj
+++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj
@@ -212,7 +212,7 @@
-
+
diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs
index f2e5388d0c..337ad04e7d 100644
--- a/osu.Game/Screens/Select/BeatmapDetailArea.cs
+++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs
@@ -124,6 +124,7 @@ namespace osu.Game.Screens.Select
if (api == null || beatmap?.BeatmapInfo == null) return;
Details.Beatmap = beatmap.Beatmap.BeatmapInfo;
+
}
}
}
diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details.cs
index 2374d0a674..54f3d5b519 100644
--- a/osu.Game/Screens/Select/Details.cs
+++ b/osu.Game/Screens/Select/Details.cs
@@ -11,6 +11,7 @@ using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Game.Database;
using osu.Game.Graphics;
+using System.Collections.Generic;
using System.Linq;
namespace osu.Game.Screens.Select
@@ -23,10 +24,15 @@ namespace osu.Game.Screens.Select
private DifficultyRow circleSize;
private DifficultyRow drainRate;
- private DifficultyRow approachRate;
private DifficultyRow overallDifficulty;
+ private DifficultyRow approachRate;
private DifficultyRow stars;
+ private DetailsBar ratingsBar;
+ private SpriteText negativeRatings;
+ private SpriteText positiveRatings;
+ private FillFlowContainer ratingsGraph;
+
private BeatmapInfo beatmap;
public BeatmapInfo Beatmap
{
@@ -50,12 +56,43 @@ namespace osu.Game.Screens.Select
circleSize.Value = beatmap.Difficulty.CircleSize;
drainRate.Value = beatmap.Difficulty.DrainRate;
- approachRate.Value = beatmap.Difficulty.ApproachRate;
overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty;
+ approachRate.Value = beatmap.Difficulty.ApproachRate;
stars.Value = (float) beatmap.StarDifficulty;
}
}
+ private List ratings;
+ public IEnumerable Ratings
+ {
+ get
+ {
+ return ratings;
+ }
+ set
+ {
+ ratings = value.ToList();
+ 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();
+
+ List ratingsGraphBars = ratingsGraph.Children.ToList();
+ for (int i = 0; i < 10; i++)
+ if(ratingsGraphBars.Count > i)
+ ratingsGraphBars[i].Length = (float)ratings[i] / ratings.Max();
+ else
+ ratingsGraph.Add(new DetailsBar
+ {
+ RelativeSizeAxes = Axes.Both,
+ Width = 0.1f,
+ Length = (float)ratings[i] / ratings.Max(),
+ Direction = BarDirection.BottomToTop,
+ BackgroundColour = new Color4(0, 0, 0, 0),
+ });
+ }
+ }
+
+
public Details()
{
Children = new Drawable[]
@@ -74,7 +111,7 @@ namespace osu.Game.Screens.Select
AutoSizeAxes = Axes.Y,
Width = 0.4f,
Direction = FillDirection.Vertical,
- Padding = new MarginPadding(5),
+ Padding = new MarginPadding(10) { Top = 25 },
Children = new Drawable[]
{
new SpriteText
@@ -116,59 +153,143 @@ namespace osu.Game.Screens.Select
},
},
},
- new Container
+ new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Width = 0.6f,
- Padding = new MarginPadding(5) { Top = 0 },
- Children = new Drawable[]
+ Direction = FillDirection.Vertical,
+ Spacing = new Vector2(0,15),
+ Padding = new MarginPadding(10) { Top = 0 },
+ Children = new []
{
- new Box
- {
- RelativeSizeAxes = Axes.Both,
- Colour = Color4.Black,
- Alpha = 0.5f,
- },
- new FillFlowContainer
+ new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
- Direction = FillDirection.Vertical,
- Spacing = new Vector2(0,10),
- Padding = new MarginPadding(7),
- Children = new []
+ Children = new Drawable[]
{
- circleSize = new DifficultyRow
+ new Box
{
- DifficultyName = "Circle Size",
- AutoSizeAxes = Axes.Y,
- RelativeSizeAxes = Axes.X,
- MaxValue = 7,
+ RelativeSizeAxes = Axes.Both,
+ Colour = Color4.Black,
+ Alpha = 0.5f,
},
- drainRate = new DifficultyRow
+ new FillFlowContainer
{
- DifficultyName = "HP Drain",
- AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Direction = FillDirection.Vertical,
+ Spacing = new Vector2(0,10),
+ Padding = new MarginPadding(15) { Top = 25 },
+ Children = new []
+ {
+ circleSize = new DifficultyRow
+ {
+ DifficultyName = "Circle Size",
+ AutoSizeAxes = Axes.Y,
+ RelativeSizeAxes = Axes.X,
+ MaxValue = 7,
+ },
+ drainRate = new DifficultyRow
+ {
+ DifficultyName = "HP Drain",
+ AutoSizeAxes = Axes.Y,
+ RelativeSizeAxes = Axes.X,
+ },
+ overallDifficulty = new DifficultyRow
+ {
+ DifficultyName = "Accuracy",
+ AutoSizeAxes = Axes.Y,
+ RelativeSizeAxes = Axes.X,
+ },
+ approachRate = new DifficultyRow
+ {
+ DifficultyName = "Approach Rate",
+ AutoSizeAxes = Axes.Y,
+ RelativeSizeAxes = Axes.X,
+ },
+ stars = new DifficultyRow
+ {
+ DifficultyName = "Star Difficulty",
+ AutoSizeAxes = Axes.Y,
+ RelativeSizeAxes = Axes.X,
+ },
+ },
},
- approachRate = new DifficultyRow
+ },
+ },
+ new Container
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Children = new Drawable[]
+ {
+ new Box
{
- DifficultyName = "Accuracy",
- AutoSizeAxes = Axes.Y,
- RelativeSizeAxes = Axes.X,
+ RelativeSizeAxes = Axes.Both,
+ Colour = Color4.Black,
+ Alpha = 0.5f,
},
- overallDifficulty = new DifficultyRow
+ new FillFlowContainer
{
- DifficultyName = "Limit Break",
- AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
- },
- stars = new DifficultyRow
- {
- DifficultyName = "Star Difficulty",
AutoSizeAxes = Axes.Y,
- RelativeSizeAxes = Axes.X,
+ Direction = FillDirection.Vertical,
+ Padding = new MarginPadding(15) { Top = 25, Bottom = 0 },
+ Children = new Drawable[]
+ {
+ new SpriteText
+ {
+ Text = "User Rating",
+ TextSize = 14,
+ Font = @"Exo2.0-Medium",
+ Anchor = Anchor.TopCentre,
+ Origin = Anchor.TopCentre,
+ },
+ ratingsBar = new DetailsBar
+ {
+ RelativeSizeAxes = Axes.X,
+ Height = 5,
+ Length = 0,
+ },
+ new Container
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Children = new[]
+ {
+ negativeRatings = new SpriteText
+ {
+ TextSize = 14,
+ Font = @"Exo2.0-Medium",
+ Text = "0",
+ },
+ positiveRatings = new SpriteText
+ {
+ TextSize = 14,
+ Font = @"Exo2.0-Medium",
+ Text = "0",
+ Anchor = Anchor.TopRight,
+ Origin = Anchor.TopRight,
+ },
+ },
+ },
+ new SpriteText
+ {
+ Text = "Rating Spread",
+ TextSize = 14,
+ Font = @"Exo2.0-Medium",
+ Anchor = Anchor.BottomCentre,
+ Origin = Anchor.TopCentre,
+ },
+ ratingsGraph = new FillFlowContainer
+ {
+ RelativeSizeAxes = Axes.X,
+ Direction = FillDirection.Horizontal,
+ Height = 50,
+ }
+ },
},
},
},
@@ -183,7 +304,13 @@ namespace osu.Game.Screens.Select
description.Colour = colour.GrayB;
source.Colour = colour.GrayB;
tags.Colour = colour.YellowLight;
+
stars.BarColour = colour.YellowLight;
+
+ ratingsBar.BackgroundColour = colour.Green;
+ ratingsBar.BarColour = colour.YellowDark;
+
+ ratingsGraph.Colour = colour.BlueDark;
}
private class DifficultyRow : Container
@@ -202,7 +329,7 @@ namespace osu.Game.Screens.Select
set
{
difficultyValue = value;
- bar.Value = value/maxValue;
+ bar.Length = value/maxValue;
valueText.Text = value.ToString();
}
}
@@ -217,7 +344,7 @@ namespace osu.Game.Screens.Select
set
{
maxValue = value;
- bar.Value = Value/value;
+ bar.Length = Value/value;
}
}
diff --git a/osu.Game/Screens/Select/DetailsBar.cs b/osu.Game/Screens/Select/DetailsBar.cs
index aabdf6809f..650d690a78 100644
--- a/osu.Game/Screens/Select/DetailsBar.cs
+++ b/osu.Game/Screens/Select/DetailsBar.cs
@@ -9,20 +9,24 @@ using osu.Framework.Graphics.Sprites;
namespace osu.Game.Screens.Select
{
- class DetailsBar : Container
+ public class DetailsBar : Container
{
private Box background;
private Box bar;
- public float Value
+ private const int resizeDuration = 250;
+
+ private float length;
+ public float Length
{
get
{
- return bar.Width;
+ return length;
}
set
{
- bar.ResizeTo(new Vector2(value, 1), 200);
+ length = value;
+ updateBarLength();
}
}
@@ -50,6 +54,20 @@ namespace osu.Game.Screens.Select
}
}
+ private BarDirection direction = BarDirection.LeftToRight;
+ public BarDirection Direction
+ {
+ get
+ {
+ return direction;
+ }
+ set
+ {
+ direction = value;
+ updateBarLength();
+ }
+ }
+
public DetailsBar()
{
Children = new []
@@ -64,5 +82,42 @@ namespace osu.Game.Screens.Select
}
};
}
+
+ private void updateBarLength()
+ {
+ switch (direction)
+ {
+ case BarDirection.LeftToRight:
+ case BarDirection.RightToLeft:
+ bar.ResizeTo(new Vector2(length, 1), resizeDuration);
+ break;
+ case BarDirection.TopToBottom:
+ case BarDirection.BottomToTop:
+ bar.ResizeTo(new Vector2(1, length), resizeDuration);
+ break;
+ }
+
+ switch (direction)
+ {
+ case BarDirection.LeftToRight:
+ case BarDirection.TopToBottom:
+ bar.Anchor = Anchor.TopLeft;
+ bar.Origin = Anchor.TopLeft;
+ break;
+ case BarDirection.RightToLeft:
+ case BarDirection.BottomToTop:
+ bar.Anchor = Anchor.BottomRight;
+ bar.Origin = Anchor.BottomRight;
+ break;
+ }
+ }
+ }
+
+ public enum BarDirection
+ {
+ LeftToRight,
+ RightToLeft,
+ TopToBottom,
+ BottomToTop,
}
}