mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
changes and fixes
This commit is contained in:
@ -42,9 +42,9 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
StarDifficulty = 5.3f,
|
StarDifficulty = 5.3f,
|
||||||
Metric = new BeatmapMetric
|
Metric = new BeatmapMetric
|
||||||
{
|
{
|
||||||
Ratings = Enumerable.Range(0,10).ToArray(),
|
Ratings = Enumerable.Range(0,10).ToList(),
|
||||||
Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToArray(),
|
Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToList(),
|
||||||
Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToArray(),
|
Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToList(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -74,9 +74,9 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
StarDifficulty = 5.3f,
|
StarDifficulty = 5.3f,
|
||||||
Metric = new BeatmapMetric
|
Metric = new BeatmapMetric
|
||||||
{
|
{
|
||||||
Ratings = Enumerable.Range(0, 10).ToArray(),
|
Ratings = Enumerable.Range(0, 10).ToList(),
|
||||||
Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToArray(),
|
Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToList(),
|
||||||
Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToArray(),
|
Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToList(),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
lastRange += 100;
|
lastRange += 100;
|
||||||
|
@ -9,9 +9,9 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
{
|
{
|
||||||
internal class TestCaseGraphAndBar : TestCase
|
internal class TestCaseGraph : TestCase
|
||||||
{
|
{
|
||||||
public override string Description => "graphs and bars, bars and graphs";
|
public override string Description => "graph";
|
||||||
|
|
||||||
private BarGraph graph;
|
private BarGraph graph;
|
||||||
|
|
||||||
@ -31,6 +31,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
};
|
};
|
||||||
|
|
||||||
AddStep("values from 1-10", () => graph.Values = Enumerable.Range(1,10).Select(i => (float)i));
|
AddStep("values from 1-10", () => graph.Values = Enumerable.Range(1,10).Select(i => (float)i));
|
||||||
|
AddStep("values from 1-100", () => graph.Values = Enumerable.Range(1, 100).Select(i => (float)i));
|
||||||
AddStep("reversed values from 1-10", () => graph.Values = Enumerable.Range(1, 10).Reverse().Select(i => (float)i));
|
AddStep("reversed values from 1-10", () => graph.Values = Enumerable.Range(1, 10).Reverse().Select(i => (float)i));
|
||||||
AddStep("Bottom to top", () => graph.Direction = BarDirection.BottomToTop);
|
AddStep("Bottom to top", () => graph.Direction = BarDirection.BottomToTop);
|
||||||
AddStep("Top to bottom", () => graph.Direction = BarDirection.TopToBottom);
|
AddStep("Top to bottom", () => graph.Direction = BarDirection.TopToBottom);
|
@ -190,7 +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\TestCaseGraph.cs" />
|
||||||
<Compile Include="Tests\TestCaseMenuOverlays.cs" />
|
<Compile Include="Tests\TestCaseMenuOverlays.cs" />
|
||||||
<Compile Include="Tests\TestCaseMusicController.cs" />
|
<Compile Include="Tests\TestCaseMusicController.cs" />
|
||||||
<Compile Include="Tests\TestCaseNotificationManager.cs" />
|
<Compile Include="Tests\TestCaseNotificationManager.cs" />
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace osu.Game.Database
|
namespace osu.Game.Database
|
||||||
{
|
{
|
||||||
public class BeatmapMetric
|
public class BeatmapMetric
|
||||||
@ -8,16 +10,16 @@ namespace osu.Game.Database
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ratings for a beatmap, length should be 10
|
/// Ratings for a beatmap, length should be 10
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int[] Ratings { get; set; }
|
public List<int> Ratings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fails for a beatmap, length should be 100
|
/// Fails for a beatmap, length should be 100
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int[] Fails { get; set; }
|
public List<int> Fails { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retries for a beatmap, length should be 100
|
/// Retries for a beatmap, length should be 100
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int[] Retries { get; set; }
|
public List<int> Retries { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Length = values[i] / (MaxValue ?? values.Max()),
|
Length = values[i] / (MaxValue ?? values.Max()),
|
||||||
Direction = Direction,
|
Direction = Direction,
|
||||||
});
|
});
|
||||||
Remove(Children.Where((bar, index) => index >= values.Count));
|
Remove(Children.Where((bar, index) => index >= values.Count).ToList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Screens.Select
|
|||||||
private readonly OsuSpriteText positiveRatings;
|
private readonly OsuSpriteText positiveRatings;
|
||||||
private readonly BarGraph ratingsGraph;
|
private readonly BarGraph ratingsGraph;
|
||||||
|
|
||||||
private readonly FillFlowContainer retryAndFailContainer;
|
private readonly FillFlowContainer retryFailContainer;
|
||||||
private readonly BarGraph retryGraph;
|
private readonly BarGraph retryGraph;
|
||||||
private readonly BarGraph failGraph;
|
private readonly BarGraph failGraph;
|
||||||
|
|
||||||
@ -62,34 +62,34 @@ namespace osu.Game.Screens.Select
|
|||||||
approachRate.Value = beatmap.Difficulty.ApproachRate;
|
approachRate.Value = beatmap.Difficulty.ApproachRate;
|
||||||
stars.Value = (float)beatmap.StarDifficulty;
|
stars.Value = (float)beatmap.StarDifficulty;
|
||||||
|
|
||||||
|
if (beatmap.Metric?.Ratings.Count != 0)
|
||||||
List<int> ratings = beatmap.Metric?.Ratings?.ToList() ?? new List<int>();
|
|
||||||
if (ratings.Count == 0)
|
|
||||||
ratingsContainer.Hide();
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
List<int> ratings = beatmap.Metric?.Ratings;
|
||||||
ratingsContainer.Show();
|
ratingsContainer.Show();
|
||||||
|
|
||||||
negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString();
|
negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString();
|
||||||
positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString();
|
positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString();
|
||||||
ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum();
|
ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum();
|
||||||
|
|
||||||
ratingsGraph.Values = ratings.Select(rating => (float)rating);
|
ratingsGraph.Values = ratings.Select(rating => (float)rating);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<int> retries = beatmap.Metric?.Retries?.ToList() ?? new List<int>();
|
|
||||||
List<int> fails = beatmap.Metric?.Fails?.ToList() ?? new List<int>();
|
|
||||||
|
|
||||||
if (fails.Count == 0 || retries.Count == 0)
|
|
||||||
retryAndFailContainer.Hide();
|
|
||||||
else
|
else
|
||||||
|
ratingsContainer.Hide();
|
||||||
|
|
||||||
|
if (beatmap.Metric?.Retries.Count != 0 && beatmap.Metric?.Fails.Count != 0)
|
||||||
{
|
{
|
||||||
retryAndFailContainer.Show();
|
List<int> retries = beatmap.Metric?.Retries;
|
||||||
|
List<int> fails = beatmap.Metric?.Fails;
|
||||||
|
|
||||||
|
retryFailContainer.Show();
|
||||||
float maxValue = fails.Select((fail, index) => fail + retries[index]).Max();
|
float maxValue = fails.Select((fail, index) => fail + retries[index]).Max();
|
||||||
failGraph.MaxValue = maxValue;
|
failGraph.MaxValue = maxValue;
|
||||||
retryGraph.MaxValue = maxValue;
|
retryGraph.MaxValue = maxValue;
|
||||||
failGraph.Values = fails.Select(fail => (float)fail);
|
failGraph.Values = fails.Select(fail => (float)fail);
|
||||||
retryGraph.Values = retries.Select((retry, index) => retry + MathHelper.Clamp(fails[index], 0, maxValue));
|
retryGraph.Values = retries.Select((retry, index) => retry + MathHelper.Clamp(fails[index], 0, maxValue));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
retryFailContainer.Hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ namespace osu.Game.Screens.Select
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
retryAndFailContainer = new FillFlowContainer
|
retryFailContainer = new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Reference in New Issue
Block a user