mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:17:23 +08:00
Moved test data to visual test
This commit is contained in:
parent
a112b354f0
commit
d6f53c8b77
@ -6,24 +6,62 @@ using osu.Framework.Screens.Testing;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Screens.Select.Leaderboards;
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Allocation;
|
||||
using System;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Modes;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Desktop.VisualTests
|
||||
{
|
||||
public class TestCaseLeaderboard : TestCase
|
||||
class TestCaseLeaderboard : TestCase
|
||||
{
|
||||
public override string Name => @"Leaderboard";
|
||||
public override string Description => @"From song select";
|
||||
|
||||
private Leaderboard leaderboard;
|
||||
private TextureStore ts;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
ts = textures;
|
||||
}
|
||||
|
||||
private void newScores()
|
||||
{
|
||||
var scores = new List<LeaderboardScore>();
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
scores.Add(new LeaderboardScore
|
||||
{
|
||||
Avatar = ts.Get(@"Online/avatar-guest"),
|
||||
Flag = ts.Get(@"Flags/__"),
|
||||
Name = @"ultralaserxx",
|
||||
MaxCombo = RNG.Next(0, 3000),
|
||||
Accuracy = Math.Round(RNG.NextDouble(0, 100), 2),
|
||||
Score = RNG.Next(0, 1000000),
|
||||
Mods = new Mod[] { },
|
||||
});
|
||||
}
|
||||
|
||||
leaderboard.Scores = scores.ToArray();
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
Add(new Leaderboard
|
||||
Add(leaderboard = new Leaderboard
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Size = new Vector2(550f, 450f),
|
||||
});
|
||||
|
||||
AddButton(@"New Scores", () => newScores());
|
||||
newScores();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,31 +7,28 @@ using osu.Framework.Graphics.Containers;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Modes;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.MathUtils;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Screens.Select.Leaderboards
|
||||
{
|
||||
public class Leaderboard : Container
|
||||
{
|
||||
private FillFlowContainer scrollFlow;
|
||||
private FillFlowContainer<LeaderboardScoreDisplay> scrollFlow;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
private LeaderboardScore[] scores;
|
||||
public LeaderboardScore[] Scores
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
get { return scores; }
|
||||
set
|
||||
{
|
||||
scrollFlow.Add(new LeaderboardScoreDisplay(new LeaderboardScore
|
||||
scores = value;
|
||||
|
||||
var scoreDisplays = new List<LeaderboardScoreDisplay>();
|
||||
for (int i = 0; i < value.Length; i++)
|
||||
{
|
||||
Avatar = textures.Get(@"Online/avatar-guest"),
|
||||
Flag = textures.Get(@"Flags/__"),
|
||||
Name = @"ultralaserxx",
|
||||
MaxCombo = RNG.Next(0, 3000),
|
||||
Accuracy = Math.Round(RNG.NextDouble(0, 100), 2),
|
||||
Score = RNG.Next(0, 1000000),
|
||||
Mods = new Mod[] { },
|
||||
}, i + 1));
|
||||
scoreDisplays.Add(new LeaderboardScoreDisplay(value[i], i + 1));
|
||||
}
|
||||
|
||||
scrollFlow.Children = scoreDisplays;
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,7 +42,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
ScrollDraggerVisible = false,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
scrollFlow = new FillFlowContainer
|
||||
scrollFlow = new FillFlowContainer<LeaderboardScoreDisplay>
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
|
Loading…
Reference in New Issue
Block a user