1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-23 00:07:24 +08:00
osu-lazer/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScore.cs

99 lines
3.5 KiB
C#
Raw Normal View History

2019-07-14 17:34:12 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Screens.Select.Details;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osuTK.Graphics;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Scoring;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Users;
namespace osu.Game.Tests.Visual.SongSelect
{
public class TestSceneUserTopScore : OsuTestScene
{
private readonly UserTopScoreContainer topScoreContainer;
private readonly APILegacyUserTopScoreInfo[] scores;
public TestSceneUserTopScore()
{
Add(new Container
{
Origin = Anchor.BottomCentre,
Anchor = Anchor.Centre,
AutoSizeAxes = Axes.Y,
Width = 500,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.DarkGreen,
},
topScoreContainer = new UserTopScoreContainer
{
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre,
}
}
});
AddStep(@"Trigger visibility", topScoreContainer.ToggleVisibility);
2019-07-14 17:40:54 +08:00
AddStep(@"Add score", () => topScoreContainer.TopScore.Value = scores[0]);
AddStep(@"Add another score", () => topScoreContainer.TopScore.Value = scores[1]);
AddStep(@"Add null score", () => topScoreContainer.TopScore.Value = null);
2019-07-14 17:34:12 +08:00
scores = new APILegacyUserTopScoreInfo[]
{
new APILegacyUserTopScoreInfo
{
Position = 999,
Score = new APILegacyScoreInfo
{
Rank = ScoreRank.XH,
Accuracy = 1,
MaxCombo = 244,
TotalScore = 1707827,
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 6602580,
Username = @"waaiiru",
Country = new Country
{
FullName = @"Spain",
FlagName = @"ES",
},
},
}
},
new APILegacyUserTopScoreInfo
{
Position = 110000,
Score = new APILegacyScoreInfo
{
Rank = ScoreRank.X,
Accuracy = 1,
MaxCombo = 244,
TotalScore = 1707827,
User = new User
{
Id = 4608074,
Username = @"Skycries",
Country = new Country
{
FullName = @"Brazil",
FlagName = @"BR",
},
},
}
}
};
}
}
}