2019-01-24 16:43:03 +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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2019-03-26 09:21:34 +08:00
|
|
|
|
using System;
|
2019-03-25 00:02:36 +08:00
|
|
|
|
using System.Collections.Generic;
|
2019-06-20 04:15:00 +08:00
|
|
|
|
using System.Linq;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
2019-03-25 00:02:36 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Framework.MathUtils;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Overlays.BeatmapSet.Scores;
|
|
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
|
using osu.Game.Rulesets.Osu.Mods;
|
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
2018-11-28 15:12:57 +08:00
|
|
|
|
using osu.Game.Scoring;
|
2019-03-25 00:02:36 +08:00
|
|
|
|
using osu.Game.Users;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2019-04-03 17:14:59 +08:00
|
|
|
|
namespace osu.Game.Tests.Visual.Online
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-05-15 03:37:25 +08:00
|
|
|
|
public class TestSceneScoresContainer : OsuTestScene
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-03-26 09:21:34 +08:00
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
|
{
|
2019-04-03 14:20:38 +08:00
|
|
|
|
typeof(DrawableTopScore),
|
2019-04-03 15:36:38 +08:00
|
|
|
|
typeof(TopScoreUserSection),
|
|
|
|
|
typeof(TopScoreStatisticsSection),
|
2019-03-26 09:21:34 +08:00
|
|
|
|
typeof(ScoreTable),
|
2019-03-26 16:38:56 +08:00
|
|
|
|
typeof(ScoreTableRowBackground),
|
2019-03-26 09:21:34 +08:00
|
|
|
|
};
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
private readonly Box background;
|
|
|
|
|
|
2019-05-15 03:37:25 +08:00
|
|
|
|
public TestSceneScoresContainer()
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
ScoresContainer scoresContainer;
|
|
|
|
|
|
2019-03-08 15:44:39 +08:00
|
|
|
|
Child = new Container
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
2019-06-20 04:15:00 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Width = 0.8f,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
background = new Box { RelativeSizeAxes = Axes.Both },
|
|
|
|
|
scoresContainer = new ScoresContainer(),
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2019-04-03 15:09:19 +08:00
|
|
|
|
var scores = new List<ScoreInfo>
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-03-27 16:08:40 +08:00
|
|
|
|
new ScoreInfo
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
User = new User
|
|
|
|
|
{
|
|
|
|
|
Id = 6602580,
|
|
|
|
|
Username = @"waaiiru",
|
|
|
|
|
Country = new Country
|
|
|
|
|
{
|
|
|
|
|
FullName = @"Spain",
|
|
|
|
|
FlagName = @"ES",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Mods = new Mod[]
|
|
|
|
|
{
|
|
|
|
|
new OsuModDoubleTime(),
|
|
|
|
|
new OsuModHidden(),
|
|
|
|
|
new OsuModFlashlight(),
|
|
|
|
|
new OsuModHardRock(),
|
|
|
|
|
},
|
|
|
|
|
Rank = ScoreRank.XH,
|
2019-03-08 15:44:39 +08:00
|
|
|
|
PP = 200,
|
2019-03-08 15:40:37 +08:00
|
|
|
|
MaxCombo = 1234,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
TotalScore = 1234567890,
|
|
|
|
|
Accuracy = 1,
|
|
|
|
|
},
|
2019-03-27 16:08:40 +08:00
|
|
|
|
new ScoreInfo
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
User = new User
|
|
|
|
|
{
|
|
|
|
|
Id = 4608074,
|
|
|
|
|
Username = @"Skycries",
|
|
|
|
|
Country = new Country
|
|
|
|
|
{
|
|
|
|
|
FullName = @"Brazil",
|
|
|
|
|
FlagName = @"BR",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Mods = new Mod[]
|
|
|
|
|
{
|
|
|
|
|
new OsuModDoubleTime(),
|
|
|
|
|
new OsuModHidden(),
|
|
|
|
|
new OsuModFlashlight(),
|
|
|
|
|
},
|
|
|
|
|
Rank = ScoreRank.S,
|
2019-03-08 15:44:39 +08:00
|
|
|
|
PP = 190,
|
2019-03-08 15:40:37 +08:00
|
|
|
|
MaxCombo = 1234,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
TotalScore = 1234789,
|
|
|
|
|
Accuracy = 0.9997,
|
|
|
|
|
},
|
2019-03-27 16:08:40 +08:00
|
|
|
|
new ScoreInfo
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
User = new User
|
|
|
|
|
{
|
|
|
|
|
Id = 1014222,
|
|
|
|
|
Username = @"eLy",
|
|
|
|
|
Country = new Country
|
|
|
|
|
{
|
|
|
|
|
FullName = @"Japan",
|
|
|
|
|
FlagName = @"JP",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Mods = new Mod[]
|
|
|
|
|
{
|
|
|
|
|
new OsuModDoubleTime(),
|
|
|
|
|
new OsuModHidden(),
|
|
|
|
|
},
|
|
|
|
|
Rank = ScoreRank.B,
|
2019-03-08 15:44:39 +08:00
|
|
|
|
PP = 180,
|
2019-03-08 15:40:37 +08:00
|
|
|
|
MaxCombo = 1234,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
TotalScore = 12345678,
|
|
|
|
|
Accuracy = 0.9854,
|
|
|
|
|
},
|
2019-03-27 16:08:40 +08:00
|
|
|
|
new ScoreInfo
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
User = new User
|
|
|
|
|
{
|
|
|
|
|
Id = 1541390,
|
|
|
|
|
Username = @"Toukai",
|
|
|
|
|
Country = new Country
|
|
|
|
|
{
|
|
|
|
|
FullName = @"Canada",
|
|
|
|
|
FlagName = @"CA",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Mods = new Mod[]
|
|
|
|
|
{
|
|
|
|
|
new OsuModDoubleTime(),
|
|
|
|
|
},
|
|
|
|
|
Rank = ScoreRank.C,
|
2019-03-08 15:44:39 +08:00
|
|
|
|
PP = 170,
|
2019-03-08 15:40:37 +08:00
|
|
|
|
MaxCombo = 1234,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
TotalScore = 1234567,
|
|
|
|
|
Accuracy = 0.8765,
|
|
|
|
|
},
|
2019-03-27 16:08:40 +08:00
|
|
|
|
new ScoreInfo
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
User = new User
|
|
|
|
|
{
|
|
|
|
|
Id = 7151382,
|
|
|
|
|
Username = @"Mayuri Hana",
|
|
|
|
|
Country = new Country
|
|
|
|
|
{
|
|
|
|
|
FullName = @"Thailand",
|
|
|
|
|
FlagName = @"TH",
|
|
|
|
|
},
|
|
|
|
|
},
|
2019-06-09 00:34:52 +08:00
|
|
|
|
Rank = ScoreRank.D,
|
2019-03-08 15:44:39 +08:00
|
|
|
|
PP = 160,
|
2019-03-08 15:40:37 +08:00
|
|
|
|
MaxCombo = 1234,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
TotalScore = 123456,
|
|
|
|
|
Accuracy = 0.6543,
|
|
|
|
|
},
|
|
|
|
|
};
|
2019-02-27 20:07:17 +08:00
|
|
|
|
|
2019-02-09 05:56:41 +08:00
|
|
|
|
foreach (var s in scores)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
s.Statistics.Add(HitResult.Great, RNG.Next(2000));
|
|
|
|
|
s.Statistics.Add(HitResult.Good, RNG.Next(2000));
|
|
|
|
|
s.Statistics.Add(HitResult.Meh, RNG.Next(2000));
|
2019-02-09 05:56:41 +08:00
|
|
|
|
s.Statistics.Add(HitResult.Miss, RNG.Next(2000));
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-06-20 04:15:00 +08:00
|
|
|
|
AddStep("Load all scores", () => scoresContainer.Scores = scores);
|
|
|
|
|
AddStep("Load null scores", () => scoresContainer.Scores = null);
|
|
|
|
|
AddStep("Load only one score", () => scoresContainer.Scores = new[] { scores.First() });
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
|
{
|
|
|
|
|
background.Colour = colours.Gray2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|