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.
|
|
|
|
|
|
2019-12-20 13:29:54 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2019-07-14 17:34:12 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osuTK.Graphics;
|
2020-08-31 18:54:22 +08:00
|
|
|
|
using osu.Game.Online.Leaderboards;
|
2019-12-20 13:29:54 +08:00
|
|
|
|
using osu.Game.Overlays;
|
2020-08-31 18:54:22 +08:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2019-07-14 17:34:12 +08:00
|
|
|
|
using osu.Game.Scoring;
|
|
|
|
|
using osu.Game.Rulesets.Osu.Mods;
|
|
|
|
|
using osu.Game.Users;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.SongSelect
|
|
|
|
|
{
|
2019-07-15 13:38:05 +08:00
|
|
|
|
public class TestSceneUserTopScoreContainer : OsuTestScene
|
2019-07-14 17:34:12 +08:00
|
|
|
|
{
|
2020-01-04 03:34:26 +08:00
|
|
|
|
[Cached]
|
2019-12-20 13:57:14 +08:00
|
|
|
|
private readonly DialogOverlay dialogOverlay;
|
2019-12-20 13:29:54 +08:00
|
|
|
|
|
2019-07-15 13:38:05 +08:00
|
|
|
|
public TestSceneUserTopScoreContainer()
|
2019-07-14 17:34:12 +08:00
|
|
|
|
{
|
2020-08-31 18:54:22 +08:00
|
|
|
|
UserTopScoreContainer<ScoreInfo> topScoreContainer;
|
2019-07-14 21:16:21 +08:00
|
|
|
|
|
2019-12-20 13:57:14 +08:00
|
|
|
|
Add(dialogOverlay = new DialogOverlay
|
2019-12-20 13:29:54 +08:00
|
|
|
|
{
|
|
|
|
|
Depth = -1
|
|
|
|
|
});
|
|
|
|
|
|
2020-01-04 03:34:26 +08:00
|
|
|
|
Add(new Container
|
2019-07-14 17:34:12 +08:00
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Width = 500,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.DarkGreen,
|
|
|
|
|
},
|
2020-08-31 18:54:22 +08:00
|
|
|
|
topScoreContainer = new UserTopScoreContainer<ScoreInfo>(s => new LeaderboardScore(s, s.Position, false))
|
2019-07-14 17:34:12 +08:00
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-01-04 03:34:26 +08:00
|
|
|
|
});
|
2019-07-14 17:34:12 +08:00
|
|
|
|
|
2019-07-14 21:49:46 +08:00
|
|
|
|
var scores = new[]
|
2019-07-14 17:34:12 +08:00
|
|
|
|
{
|
2020-08-31 18:54:22 +08:00
|
|
|
|
new ScoreInfo
|
2019-07-14 17:34:12 +08:00
|
|
|
|
{
|
|
|
|
|
Position = 999,
|
2020-08-31 18:54:22 +08:00
|
|
|
|
Rank = ScoreRank.XH,
|
|
|
|
|
Accuracy = 1,
|
|
|
|
|
MaxCombo = 244,
|
|
|
|
|
TotalScore = 1707827,
|
|
|
|
|
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
|
|
|
|
User = new User
|
2019-07-14 17:34:12 +08:00
|
|
|
|
{
|
2020-08-31 18:54:22 +08:00
|
|
|
|
Id = 6602580,
|
|
|
|
|
Username = @"waaiiru",
|
|
|
|
|
Country = new Country
|
2019-07-14 17:34:12 +08:00
|
|
|
|
{
|
2020-08-31 18:54:22 +08:00
|
|
|
|
FullName = @"Spain",
|
|
|
|
|
FlagName = @"ES",
|
2019-07-14 17:34:12 +08:00
|
|
|
|
},
|
2020-08-31 18:54:22 +08:00
|
|
|
|
},
|
2019-07-14 17:34:12 +08:00
|
|
|
|
},
|
2020-08-31 18:54:22 +08:00
|
|
|
|
new ScoreInfo
|
2019-07-14 17:34:12 +08:00
|
|
|
|
{
|
|
|
|
|
Position = 110000,
|
2020-08-31 18:54:22 +08:00
|
|
|
|
Rank = ScoreRank.X,
|
|
|
|
|
Accuracy = 1,
|
|
|
|
|
MaxCombo = 244,
|
|
|
|
|
TotalScore = 1707827,
|
|
|
|
|
User = new User
|
2019-07-14 17:34:12 +08:00
|
|
|
|
{
|
2020-08-31 18:54:22 +08:00
|
|
|
|
Id = 4608074,
|
|
|
|
|
Username = @"Skycries",
|
|
|
|
|
Country = new Country
|
2019-07-14 17:34:12 +08:00
|
|
|
|
{
|
2020-08-31 18:54:22 +08:00
|
|
|
|
FullName = @"Brazil",
|
|
|
|
|
FlagName = @"BR",
|
2019-07-14 17:34:12 +08:00
|
|
|
|
},
|
2020-08-31 18:54:22 +08:00
|
|
|
|
},
|
2019-07-14 17:47:35 +08:00
|
|
|
|
},
|
2020-08-31 18:54:22 +08:00
|
|
|
|
new ScoreInfo
|
2019-07-14 17:47:35 +08:00
|
|
|
|
{
|
|
|
|
|
Position = 22333,
|
2020-08-31 18:54:22 +08:00
|
|
|
|
Rank = ScoreRank.S,
|
|
|
|
|
Accuracy = 1,
|
|
|
|
|
MaxCombo = 244,
|
|
|
|
|
TotalScore = 1707827,
|
|
|
|
|
User = new User
|
2019-07-14 17:47:35 +08:00
|
|
|
|
{
|
2020-08-31 18:54:22 +08:00
|
|
|
|
Id = 1541390,
|
|
|
|
|
Username = @"Toukai",
|
|
|
|
|
Country = new Country
|
2019-07-14 17:47:35 +08:00
|
|
|
|
{
|
2020-08-31 18:54:22 +08:00
|
|
|
|
FullName = @"Canada",
|
|
|
|
|
FlagName = @"CA",
|
2019-07-14 17:47:35 +08:00
|
|
|
|
},
|
2020-08-31 18:54:22 +08:00
|
|
|
|
},
|
2019-07-14 17:34:12 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
2019-07-14 21:16:21 +08:00
|
|
|
|
|
|
|
|
|
AddStep(@"Trigger visibility", topScoreContainer.ToggleVisibility);
|
|
|
|
|
AddStep(@"Add score(rank 999)", () => topScoreContainer.Score.Value = scores[0]);
|
|
|
|
|
AddStep(@"Add score(rank 110000)", () => topScoreContainer.Score.Value = scores[1]);
|
|
|
|
|
AddStep(@"Add score(rank 22333)", () => topScoreContainer.Score.Value = scores[2]);
|
|
|
|
|
AddStep(@"Add null score", () => topScoreContainer.Score.Value = null);
|
2019-07-14 17:34:12 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|