2019-01-24 08:43:03 +00: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.
|
2018-12-14 10:52:03 +00:00
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Online.API;
|
2021-06-23 15:28:39 +00:00
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
|
|
|
|
using osu.Game.Online.Rooms;
|
2020-12-25 15:50:00 +00:00
|
|
|
|
using osu.Game.Screens.OnlinePlay.Match.Components;
|
2021-06-24 07:29:06 +00:00
|
|
|
|
using osu.Game.Tests.Visual.OnlinePlay;
|
2018-12-14 10:52:03 +00:00
|
|
|
|
using osuTK;
|
2021-11-04 09:02:44 +00:00
|
|
|
|
using APIUser = osu.Game.Online.API.Requests.Responses.APIUser;
|
2018-12-14 10:52:03 +00:00
|
|
|
|
|
2019-03-24 16:02:36 +00:00
|
|
|
|
namespace osu.Game.Tests.Visual.Multiplayer
|
2018-12-14 10:52:03 +00:00
|
|
|
|
{
|
2021-06-25 04:02:19 +00:00
|
|
|
|
public partial class TestSceneMatchLeaderboard : OnlinePlayTestScene
|
2018-12-14 10:52:03 +00:00
|
|
|
|
{
|
2022-07-29 06:27:39 +00:00
|
|
|
|
public override void SetUpSteps()
|
2018-12-14 10:52:03 +00:00
|
|
|
|
{
|
2022-07-29 06:27:39 +00:00
|
|
|
|
base.SetUpSteps();
|
|
|
|
|
|
|
|
|
|
AddStep("setup API", () =>
|
2021-06-23 15:28:39 +00:00
|
|
|
|
{
|
2022-07-29 06:27:39 +00:00
|
|
|
|
((DummyAPIAccess)API).HandleRequest = r =>
|
2021-06-23 15:28:39 +00:00
|
|
|
|
{
|
2022-07-29 06:27:39 +00:00
|
|
|
|
switch (r)
|
|
|
|
|
{
|
|
|
|
|
case GetRoomLeaderboardRequest leaderboardRequest:
|
|
|
|
|
leaderboardRequest.TriggerSuccess(new APILeaderboard
|
2021-06-23 15:28:39 +00:00
|
|
|
|
{
|
2022-07-29 06:27:39 +00:00
|
|
|
|
Leaderboard = new List<APIUserScoreAggregate>
|
2021-06-23 15:28:39 +00:00
|
|
|
|
{
|
2022-07-29 06:27:39 +00:00
|
|
|
|
new APIUserScoreAggregate
|
|
|
|
|
{
|
|
|
|
|
UserID = 2,
|
|
|
|
|
User = new APIUser { Id = 2, Username = "peppy" },
|
|
|
|
|
TotalScore = 995533,
|
|
|
|
|
RoomID = 3,
|
|
|
|
|
CompletedBeatmaps = 1,
|
|
|
|
|
TotalAttempts = 6,
|
|
|
|
|
Accuracy = 0.9851
|
|
|
|
|
},
|
|
|
|
|
new APIUserScoreAggregate
|
|
|
|
|
{
|
|
|
|
|
UserID = 1040328,
|
|
|
|
|
User = new APIUser { Id = 1040328, Username = "smoogipoo" },
|
|
|
|
|
TotalScore = 981100,
|
|
|
|
|
RoomID = 3,
|
|
|
|
|
CompletedBeatmaps = 1,
|
|
|
|
|
TotalAttempts = 9,
|
|
|
|
|
Accuracy = 0.937
|
|
|
|
|
}
|
2021-06-23 15:28:39 +00:00
|
|
|
|
}
|
2022-07-29 06:27:39 +00:00
|
|
|
|
});
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2018-12-14 10:52:03 +00:00
|
|
|
|
|
2022-07-29 06:27:39 +00:00
|
|
|
|
return false;
|
|
|
|
|
};
|
|
|
|
|
});
|
2021-06-25 04:02:19 +00:00
|
|
|
|
|
2022-07-29 06:27:39 +00:00
|
|
|
|
AddStep("create leaderboard", () =>
|
2021-06-23 15:28:39 +00:00
|
|
|
|
{
|
2022-07-29 06:27:39 +00:00
|
|
|
|
SelectedRoom.Value = new Room { RoomID = { Value = 3 } };
|
|
|
|
|
|
|
|
|
|
Child = new MatchLeaderboard
|
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Size = new Vector2(550f, 450f),
|
|
|
|
|
Scope = MatchLeaderboardScope.Overall,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
2018-12-14 10:52:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|