osu/osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs

265 lines
9.2 KiB
C#
Raw Normal View History

// 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.
2018-04-13 09:19:50 +00:00
2018-06-28 04:04:39 +00:00
using System;
using System.Collections.Generic;
2018-04-13 09:19:50 +00:00
using System.ComponentModel;
2019-03-24 16:02:36 +00:00
using osu.Framework.Graphics;
2018-04-13 09:19:50 +00:00
using osu.Game.Beatmaps;
using osu.Game.Online.Leaderboards;
2018-11-28 07:12:57 +00:00
using osu.Game.Scoring;
2019-03-24 16:02:36 +00:00
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Users;
using osuTK;
2018-04-13 09:19:50 +00:00
2019-03-24 16:02:36 +00:00
namespace osu.Game.Tests.Visual.SongSelect
2018-04-13 09:19:50 +00:00
{
[Description("PlaySongSelect leaderboard")]
public class TestSceneLeaderboard : OsuTestScene
2018-04-13 09:19:50 +00:00
{
2019-02-28 04:31:40 +00:00
public override IReadOnlyList<Type> RequiredTypes => new[]
{
2018-06-28 04:04:39 +00:00
typeof(Placeholder),
typeof(MessagePlaceholder),
typeof(RetrievalFailurePlaceholder),
};
2018-04-13 09:19:50 +00:00
private readonly FailableLeaderboard leaderboard;
public TestSceneLeaderboard()
2018-04-13 09:19:50 +00:00
{
Add(leaderboard = new FailableLeaderboard
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Size = new Vector2(550f, 450f),
Scope = BeatmapLeaderboardScope.Global,
2018-04-13 09:19:50 +00:00
});
AddStep(@"New Scores", newScores);
AddStep(@"Empty Scores", () => leaderboard.SetRetrievalState(PlaceholderState.NoScores));
AddStep(@"Network failure", () => leaderboard.SetRetrievalState(PlaceholderState.NetworkFailure));
AddStep(@"No supporter", () => leaderboard.SetRetrievalState(PlaceholderState.NotSupporter));
AddStep(@"Not logged in", () => leaderboard.SetRetrievalState(PlaceholderState.NotLoggedIn));
AddStep(@"Unavailable", () => leaderboard.SetRetrievalState(PlaceholderState.Unavailable));
2019-07-05 04:25:10 +00:00
AddStep(@"Ranked beatmap", rankedBeatmap);
AddStep(@"Pending beatmap", pendingBeatmap);
2018-04-13 09:19:50 +00:00
}
private void newScores()
{
var scores = new[]
{
2018-11-28 09:33:01 +00:00
new ScoreInfo
2018-04-13 09:19:50 +00:00
{
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",
},
},
},
2018-11-28 09:33:01 +00:00
new ScoreInfo
2018-04-13 09:19:50 +00:00
{
Rank = ScoreRank.X,
Accuracy = 1,
MaxCombo = 244,
TotalScore = 1707827,
//Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 4608074,
Username = @"Skycries",
Country = new Country
{
FullName = @"Brazil",
FlagName = @"BR",
},
},
},
2018-11-28 09:33:01 +00:00
new ScoreInfo
2018-04-13 09:19:50 +00:00
{
Rank = ScoreRank.SH,
Accuracy = 1,
MaxCombo = 244,
TotalScore = 1707827,
//Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 1014222,
Username = @"eLy",
Country = new Country
{
FullName = @"Japan",
FlagName = @"JP",
},
},
},
2018-11-28 09:33:01 +00:00
new ScoreInfo
2018-04-13 09:19:50 +00:00
{
Rank = ScoreRank.S,
Accuracy = 1,
MaxCombo = 244,
TotalScore = 1707827,
//Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 1541390,
Username = @"Toukai",
Country = new Country
{
FullName = @"Canada",
FlagName = @"CA",
},
},
},
2018-11-28 09:33:01 +00:00
new ScoreInfo
2018-04-13 09:19:50 +00:00
{
Rank = ScoreRank.A,
Accuracy = 1,
MaxCombo = 244,
TotalScore = 1707827,
//Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 2243452,
Username = @"Satoruu",
Country = new Country
{
FullName = @"Venezuela",
FlagName = @"VE",
},
},
},
2018-11-28 09:33:01 +00:00
new ScoreInfo
2018-04-13 09:19:50 +00:00
{
Rank = ScoreRank.B,
Accuracy = 0.9826,
MaxCombo = 244,
TotalScore = 1707827,
//Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 2705430,
Username = @"Mooha",
Country = new Country
{
FullName = @"France",
FlagName = @"FR",
},
},
},
2018-11-28 09:33:01 +00:00
new ScoreInfo
2018-04-13 09:19:50 +00:00
{
Rank = ScoreRank.C,
Accuracy = 0.9654,
MaxCombo = 244,
TotalScore = 1707827,
//Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 7151382,
Username = @"Mayuri Hana",
Country = new Country
{
FullName = @"Thailand",
FlagName = @"TH",
},
},
},
2018-11-28 09:33:01 +00:00
new ScoreInfo
2018-04-13 09:19:50 +00:00
{
2019-06-08 16:34:03 +00:00
Rank = ScoreRank.D,
2018-04-13 09:19:50 +00:00
Accuracy = 0.6025,
MaxCombo = 244,
TotalScore = 1707827,
//Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 2051389,
Username = @"FunOrange",
Country = new Country
{
FullName = @"Canada",
FlagName = @"CA",
},
},
},
2018-11-28 09:33:01 +00:00
new ScoreInfo
2018-04-13 09:19:50 +00:00
{
2019-06-08 16:34:03 +00:00
Rank = ScoreRank.D,
2018-04-13 09:19:50 +00:00
Accuracy = 0.5140,
MaxCombo = 244,
TotalScore = 1707827,
//Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 6169483,
Username = @"-Hebel-",
Country = new Country
{
FullName = @"Mexico",
FlagName = @"MX",
},
},
},
2018-11-28 09:33:01 +00:00
new ScoreInfo
2018-04-13 09:19:50 +00:00
{
2019-06-08 16:34:03 +00:00
Rank = ScoreRank.D,
2018-04-13 09:19:50 +00:00
Accuracy = 0.4222,
MaxCombo = 244,
TotalScore = 1707827,
//Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 6702666,
Username = @"prhtnsm",
Country = new Country
{
FullName = @"Germany",
FlagName = @"DE",
},
},
},
};
leaderboard.Scores = scores;
}
2019-07-05 04:25:10 +00:00
private void rankedBeatmap()
2018-04-13 09:19:50 +00:00
{
leaderboard.Beatmap = new BeatmapInfo
{
OnlineBeatmapID = 1113057,
2019-07-05 04:25:10 +00:00
Status = BeatmapSetOnlineStatus.Ranked,
};
}
private void pendingBeatmap()
{
leaderboard.Beatmap = new BeatmapInfo
{
OnlineBeatmapID = 1113057,
Status = BeatmapSetOnlineStatus.Pending,
};
}
private class FailableLeaderboard : BeatmapLeaderboard
2018-04-13 09:19:50 +00:00
{
public void SetRetrievalState(PlaceholderState state)
{
PlaceholderState = state;
}
}
}
}