some formatting

This commit is contained in:
Jorolf 2017-04-04 17:27:08 +02:00
parent 078d44aec3
commit b2731bb0a1
6 changed files with 35 additions and 18 deletions

View File

@ -58,6 +58,5 @@ namespace osu.Desktop.VisualTests.Tests
} }
private void newRatings() => details.Ratings = Enumerable.Range(1, 10); private void newRatings() => details.Ratings = Enumerable.Range(1, 10);
} }
} }

View File

@ -0,0 +1,11 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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
{
}
}

View File

@ -190,6 +190,7 @@
<Compile Include="Tests\TestCaseBeatmapDetails.cs" /> <Compile Include="Tests\TestCaseBeatmapDetails.cs" />
<Compile Include="Tests\TestCaseDrawings.cs" /> <Compile Include="Tests\TestCaseDrawings.cs" />
<Compile Include="Tests\TestCaseGamefield.cs" /> <Compile Include="Tests\TestCaseGamefield.cs" />
<Compile Include="Tests\TestCaseGraphAndBar.cs" />
<Compile Include="Tests\TestCaseMusicController.cs" /> <Compile Include="Tests\TestCaseMusicController.cs" />
<Compile Include="Tests\TestCaseNotificationManager.cs" /> <Compile Include="Tests\TestCaseNotificationManager.cs" />
<Compile Include="Tests\TestCasePlayer.cs" /> <Compile Include="Tests\TestCasePlayer.cs" />

View File

@ -30,7 +30,6 @@ namespace osu.Game.Graphics.UserInterface
} }
} }
public IEnumerable<float> Values public IEnumerable<float> Values
{ {
set set
@ -52,7 +51,6 @@ namespace osu.Game.Graphics.UserInterface
Direction = Direction, Direction = Direction,
BackgroundColour = new Color4(0, 0, 0, 0), BackgroundColour = new Color4(0, 0, 0, 0),
}); });
} }
} }
} }
@ -141,6 +139,7 @@ namespace osu.Game.Graphics.UserInterface
case BarDirection.RightToLeft: case BarDirection.RightToLeft:
bar.ResizeTo(new Vector2(length, 1), resize_duration, easing); bar.ResizeTo(new Vector2(length, 1), resize_duration, easing);
break; break;
case BarDirection.TopToBottom: case BarDirection.TopToBottom:
case BarDirection.BottomToTop: case BarDirection.BottomToTop:
bar.ResizeTo(new Vector2(1, length), resize_duration, easing); bar.ResizeTo(new Vector2(1, length), resize_duration, easing);
@ -154,6 +153,7 @@ namespace osu.Game.Graphics.UserInterface
bar.Anchor = Anchor.TopLeft; bar.Anchor = Anchor.TopLeft;
bar.Origin = Anchor.TopLeft; bar.Origin = Anchor.TopLeft;
break; break;
case BarDirection.RightToLeft: case BarDirection.RightToLeft:
case BarDirection.BottomToTop: case BarDirection.BottomToTop:
bar.Anchor = Anchor.BottomRight; bar.Anchor = Anchor.BottomRight;
@ -170,4 +170,4 @@ namespace osu.Game.Graphics.UserInterface
TopToBottom, TopToBottom,
BottomToTop, BottomToTop,
} }
} }

View File

@ -24,6 +24,7 @@ namespace osu.Game.Screens.Select
private APIAccess api; private APIAccess api;
private WorkingBeatmap beatmap; private WorkingBeatmap beatmap;
public WorkingBeatmap Beatmap public WorkingBeatmap Beatmap
{ {
get get
@ -34,7 +35,7 @@ namespace osu.Game.Screens.Select
{ {
beatmap = value; beatmap = value;
if (IsLoaded) if (IsLoaded)
if(currentTab == BeatmapDetailTab.Details) if (currentTab == BeatmapDetailTab.Details)
Schedule(updateDetails); Schedule(updateDetails);
else else
Schedule(updateScores); Schedule(updateScores);
@ -48,7 +49,7 @@ namespace osu.Game.Screens.Select
new BeatmapDetailAreaTabControl new BeatmapDetailAreaTabControl
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
OnFilter = (tab, mods) => OnFilter = (tab, mods) =>
{ {
switch (tab) switch (tab)
{ {
@ -57,6 +58,7 @@ namespace osu.Game.Screens.Select
Leaderboard.Hide(); Leaderboard.Hide();
updateDetails(); updateDetails();
break; break;
default: default:
Details.Hide(); Details.Hide();
Leaderboard.Show(); Leaderboard.Show();
@ -100,6 +102,7 @@ namespace osu.Game.Screens.Select
} }
private GetScoresRequest getScoresRequest; private GetScoresRequest getScoresRequest;
private void updateScores() private void updateScores()
{ {
if (!IsLoaded) return; if (!IsLoaded) return;
@ -114,15 +117,13 @@ namespace osu.Game.Screens.Select
api.Queue(getScoresRequest); api.Queue(getScoresRequest);
} }
private void updateDetails() private void updateDetails()
{ {
if (!IsLoaded) return; if (!IsLoaded) return;
if (api == null || beatmap?.BeatmapInfo == null) return; if (api == null || beatmap?.BeatmapInfo == null) return;
Details.Beatmap = beatmap.Beatmap.BeatmapInfo; Details.Beatmap = beatmap.Beatmap.BeatmapInfo;
} }
} }
} }

View File

@ -40,6 +40,7 @@ namespace osu.Game.Screens.Select
private readonly BarGraph failGraph; private readonly BarGraph failGraph;
private BeatmapInfo beatmap; private BeatmapInfo beatmap;
public BeatmapInfo Beatmap public BeatmapInfo Beatmap
{ {
get get
@ -63,11 +64,12 @@ namespace osu.Game.Screens.Select
drainRate.Value = beatmap.Difficulty.DrainRate; drainRate.Value = beatmap.Difficulty.DrainRate;
overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty; overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty;
approachRate.Value = beatmap.Difficulty.ApproachRate; approachRate.Value = beatmap.Difficulty.ApproachRate;
stars.Value = (float) beatmap.StarDifficulty; stars.Value = (float)beatmap.StarDifficulty;
} }
} }
private List<int> ratings; private List<int> ratings;
public IEnumerable<int> Ratings public IEnumerable<int> Ratings
{ {
get get
@ -85,7 +87,8 @@ namespace osu.Game.Screens.Select
} }
} }
private List<int> retries = Enumerable.Repeat(0,100).ToList(); private List<int> retries = Enumerable.Repeat(0, 100).ToList();
public IEnumerable<int> Retries public IEnumerable<int> Retries
{ {
get get
@ -99,7 +102,8 @@ namespace osu.Game.Screens.Select
} }
} }
private List<int> fails = Enumerable.Repeat(0,100).ToList(); private List<int> fails = Enumerable.Repeat(0, 100).ToList();
public IEnumerable<int> Fails public IEnumerable<int> Fails
{ {
get get
@ -117,7 +121,6 @@ namespace osu.Game.Screens.Select
{ {
failGraph.Values = fails.Select(fail => (float)fail); failGraph.Values = fails.Select(fail => (float)fail);
retryGraph.Values = retries.Select((retry, index) => (float)retry + fails[index]); retryGraph.Values = retries.Select((retry, index) => (float)retry + fails[index]);
} }
public BeatmapDetails() public BeatmapDetails()
@ -361,6 +364,7 @@ namespace osu.Game.Screens.Select
private readonly OsuSpriteText valueText; private readonly OsuSpriteText valueText;
private float difficultyValue; private float difficultyValue;
public float Value public float Value
{ {
get get
@ -370,12 +374,13 @@ namespace osu.Game.Screens.Select
set set
{ {
difficultyValue = value; difficultyValue = value;
bar.Length = value/maxValue; bar.Length = value / maxValue;
valueText.Text = value.ToString(CultureInfo.InvariantCulture); valueText.Text = value.ToString(CultureInfo.InvariantCulture);
} }
} }
private float maxValue = 10; private float maxValue = 10;
public float MaxValue public float MaxValue
{ {
get get
@ -385,7 +390,7 @@ namespace osu.Game.Screens.Select
set set
{ {
maxValue = value; maxValue = value;
bar.Length = Value/value; bar.Length = Value / value;
} }
} }
@ -505,4 +510,4 @@ namespace osu.Game.Screens.Select
} }
} }
} }
} }