From b2731bb0a130b26beaa0567a46e14e680a13b076 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 4 Apr 2017 17:27:08 +0200 Subject: [PATCH] some formatting --- .../Tests/TestCaseBeatmapDetails.cs | 3 +-- .../Tests/TestCaseGraphAndBar.cs | 11 +++++++++++ .../osu.Desktop.VisualTests.csproj | 1 + osu.Game/Graphics/UserInterface/BarGraph.cs | 6 +++--- osu.Game/Screens/Select/BeatmapDetailArea.cs | 13 +++++++------ osu.Game/Screens/Select/BeatmapDetails.cs | 19 ++++++++++++------- 6 files changed, 35 insertions(+), 18 deletions(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 72b27bb8b2..9af7329600 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -58,6 +58,5 @@ namespace osu.Desktop.VisualTests.Tests } private void newRatings() => details.Ratings = Enumerable.Range(1, 10); - } -} +} \ No newline at end of file diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs b/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs new file mode 100644 index 0000000000..f43b6a557d --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs @@ -0,0 +1,11 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Testing; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseGraphAndBar : TestCase + { + } +} \ No newline at end of file diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 38c574f61f..ce60d25ad3 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -190,6 +190,7 @@ + diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 5ad14a92f5..ce8a5f18b8 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -30,7 +30,6 @@ namespace osu.Game.Graphics.UserInterface } } - public IEnumerable Values { set @@ -52,7 +51,6 @@ namespace osu.Game.Graphics.UserInterface Direction = Direction, BackgroundColour = new Color4(0, 0, 0, 0), }); - } } } @@ -141,6 +139,7 @@ namespace osu.Game.Graphics.UserInterface case BarDirection.RightToLeft: bar.ResizeTo(new Vector2(length, 1), resize_duration, easing); break; + case BarDirection.TopToBottom: case BarDirection.BottomToTop: bar.ResizeTo(new Vector2(1, length), resize_duration, easing); @@ -154,6 +153,7 @@ namespace osu.Game.Graphics.UserInterface bar.Anchor = Anchor.TopLeft; bar.Origin = Anchor.TopLeft; break; + case BarDirection.RightToLeft: case BarDirection.BottomToTop: bar.Anchor = Anchor.BottomRight; @@ -170,4 +170,4 @@ namespace osu.Game.Graphics.UserInterface TopToBottom, BottomToTop, } -} +} \ No newline at end of file diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 8387e39f67..cb697c31d0 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -24,6 +24,7 @@ namespace osu.Game.Screens.Select private APIAccess api; private WorkingBeatmap beatmap; + public WorkingBeatmap Beatmap { get @@ -34,7 +35,7 @@ namespace osu.Game.Screens.Select { beatmap = value; if (IsLoaded) - if(currentTab == BeatmapDetailTab.Details) + if (currentTab == BeatmapDetailTab.Details) Schedule(updateDetails); else Schedule(updateScores); @@ -48,7 +49,7 @@ namespace osu.Game.Screens.Select new BeatmapDetailAreaTabControl { RelativeSizeAxes = Axes.X, - OnFilter = (tab, mods) => + OnFilter = (tab, mods) => { switch (tab) { @@ -57,6 +58,7 @@ namespace osu.Game.Screens.Select Leaderboard.Hide(); updateDetails(); break; + default: Details.Hide(); Leaderboard.Show(); @@ -100,6 +102,7 @@ namespace osu.Game.Screens.Select } private GetScoresRequest getScoresRequest; + private void updateScores() { if (!IsLoaded) return; @@ -114,15 +117,13 @@ namespace osu.Game.Screens.Select api.Queue(getScoresRequest); } - - private void updateDetails() { if (!IsLoaded) return; if (api == null || beatmap?.BeatmapInfo == null) return; - + Details.Beatmap = beatmap.Beatmap.BeatmapInfo; } } -} +} \ No newline at end of file diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 5adced7c95..433374509b 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -40,6 +40,7 @@ namespace osu.Game.Screens.Select private readonly BarGraph failGraph; private BeatmapInfo beatmap; + public BeatmapInfo Beatmap { get @@ -63,11 +64,12 @@ namespace osu.Game.Screens.Select drainRate.Value = beatmap.Difficulty.DrainRate; overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty; approachRate.Value = beatmap.Difficulty.ApproachRate; - stars.Value = (float) beatmap.StarDifficulty; + stars.Value = (float)beatmap.StarDifficulty; } } private List ratings; + public IEnumerable Ratings { get @@ -85,7 +87,8 @@ namespace osu.Game.Screens.Select } } - private List retries = Enumerable.Repeat(0,100).ToList(); + private List retries = Enumerable.Repeat(0, 100).ToList(); + public IEnumerable Retries { get @@ -99,7 +102,8 @@ namespace osu.Game.Screens.Select } } - private List fails = Enumerable.Repeat(0,100).ToList(); + private List fails = Enumerable.Repeat(0, 100).ToList(); + public IEnumerable Fails { get @@ -117,7 +121,6 @@ namespace osu.Game.Screens.Select { failGraph.Values = fails.Select(fail => (float)fail); retryGraph.Values = retries.Select((retry, index) => (float)retry + fails[index]); - } public BeatmapDetails() @@ -361,6 +364,7 @@ namespace osu.Game.Screens.Select private readonly OsuSpriteText valueText; private float difficultyValue; + public float Value { get @@ -370,12 +374,13 @@ namespace osu.Game.Screens.Select set { difficultyValue = value; - bar.Length = value/maxValue; + bar.Length = value / maxValue; valueText.Text = value.ToString(CultureInfo.InvariantCulture); } } private float maxValue = 10; + public float MaxValue { get @@ -385,7 +390,7 @@ namespace osu.Game.Screens.Select set { maxValue = value; - bar.Length = Value/value; + bar.Length = Value / value; } } @@ -505,4 +510,4 @@ namespace osu.Game.Screens.Select } } } -} +} \ No newline at end of file