1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 03:22:55 +08:00

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);
}
}
}

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\TestCaseDrawings.cs" />
<Compile Include="Tests\TestCaseGamefield.cs" />
<Compile Include="Tests\TestCaseGraphAndBar.cs" />
<Compile Include="Tests\TestCaseMusicController.cs" />
<Compile Include="Tests\TestCaseNotificationManager.cs" />
<Compile Include="Tests\TestCasePlayer.cs" />

View File

@ -30,7 +30,6 @@ namespace osu.Game.Graphics.UserInterface
}
}
public IEnumerable<float> 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,
}
}
}

View File

@ -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;
}
}
}
}

View File

@ -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<int> ratings;
public IEnumerable<int> Ratings
{
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
{
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
{
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
}
}
}
}
}