mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 19:22:54 +08:00
Change DrawableProfileScore
to use APIScoreInfo
This commit is contained in:
parent
17a83f701a
commit
31403daa20
@ -7,6 +7,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.BeatmapSet.Scores;
|
using osu.Game.Overlays.BeatmapSet.Scores;
|
||||||
@ -61,10 +62,10 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
Mods = new[]
|
Mods = new[]
|
||||||
{
|
{
|
||||||
new OsuModDoubleTime().Acronym,
|
new APIMod { Acronym = new OsuModDoubleTime().Acronym },
|
||||||
new OsuModHidden().Acronym,
|
new APIMod { Acronym = new OsuModHidden().Acronym },
|
||||||
new OsuModFlashlight().Acronym,
|
new APIMod { Acronym = new OsuModFlashlight().Acronym },
|
||||||
new OsuModHardRock().Acronym,
|
new APIMod { Acronym = new OsuModHardRock().Acronym },
|
||||||
},
|
},
|
||||||
Rank = ScoreRank.XH,
|
Rank = ScoreRank.XH,
|
||||||
PP = 200,
|
PP = 200,
|
||||||
@ -86,9 +87,9 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
Mods = new[]
|
Mods = new[]
|
||||||
{
|
{
|
||||||
new OsuModDoubleTime().Acronym,
|
new APIMod { Acronym = new OsuModDoubleTime().Acronym },
|
||||||
new OsuModHidden().Acronym,
|
new APIMod { Acronym = new OsuModHidden().Acronym },
|
||||||
new OsuModFlashlight().Acronym,
|
new APIMod { Acronym = new OsuModFlashlight().Acronym },
|
||||||
},
|
},
|
||||||
Rank = ScoreRank.S,
|
Rank = ScoreRank.S,
|
||||||
PP = 190,
|
PP = 190,
|
||||||
@ -110,8 +111,8 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
Mods = new[]
|
Mods = new[]
|
||||||
{
|
{
|
||||||
new OsuModDoubleTime().Acronym,
|
new APIMod { Acronym = new OsuModDoubleTime().Acronym },
|
||||||
new OsuModHidden().Acronym,
|
new APIMod { Acronym = new OsuModHidden().Acronym },
|
||||||
},
|
},
|
||||||
Rank = ScoreRank.B,
|
Rank = ScoreRank.B,
|
||||||
PP = 180,
|
PP = 180,
|
||||||
@ -133,7 +134,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
Mods = new[]
|
Mods = new[]
|
||||||
{
|
{
|
||||||
new OsuModDoubleTime().Acronym,
|
new APIMod { Acronym = new OsuModDoubleTime().Acronym },
|
||||||
},
|
},
|
||||||
Rank = ScoreRank.C,
|
Rank = ScoreRank.C,
|
||||||
PP = 170,
|
PP = 170,
|
||||||
@ -226,10 +227,10 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
Mods = new[]
|
Mods = new[]
|
||||||
{
|
{
|
||||||
new OsuModDoubleTime().Acronym,
|
new APIMod { Acronym = new OsuModDoubleTime().Acronym },
|
||||||
new OsuModHidden().Acronym,
|
new APIMod { Acronym = new OsuModHidden().Acronym },
|
||||||
new OsuModFlashlight().Acronym,
|
new APIMod { Acronym = new OsuModFlashlight().Acronym },
|
||||||
new OsuModHardRock().Acronym,
|
new APIMod { Acronym = new OsuModHardRock().Acronym },
|
||||||
},
|
},
|
||||||
Rank = ScoreRank.XH,
|
Rank = ScoreRank.XH,
|
||||||
PP = 200,
|
PP = 200,
|
||||||
|
@ -2,16 +2,16 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Game.Overlays.Profile.Sections.Ranks;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Game.Scoring;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osuTK;
|
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Rulesets.Mods;
|
|
||||||
using osu.Game.Rulesets.Osu.Mods;
|
|
||||||
using osu.Game.Overlays;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Overlays.Profile.Sections.Ranks;
|
||||||
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Online
|
namespace osu.Game.Tests.Visual.Online
|
||||||
{
|
{
|
||||||
@ -19,79 +19,79 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
public TestSceneUserProfileScores()
|
public TestSceneUserProfileScores()
|
||||||
{
|
{
|
||||||
var firstScore = new ScoreInfo
|
var firstScore = new APIScoreInfo
|
||||||
{
|
{
|
||||||
PP = 1047.21,
|
PP = 1047.21,
|
||||||
Rank = ScoreRank.SH,
|
Rank = ScoreRank.SH,
|
||||||
BeatmapInfo = new BeatmapInfo
|
Beatmap = new APIBeatmap
|
||||||
{
|
{
|
||||||
Metadata = new BeatmapMetadata
|
BeatmapSet =
|
||||||
{
|
{
|
||||||
Title = "JUSTadICE (TV Size)",
|
Title = "JUSTadICE (TV Size)",
|
||||||
Artist = "Oomori Seiko"
|
Artist = "Oomori Seiko",
|
||||||
},
|
},
|
||||||
Version = "Extreme"
|
DifficultyName = "Extreme"
|
||||||
},
|
},
|
||||||
Date = DateTimeOffset.Now,
|
Date = DateTimeOffset.Now,
|
||||||
Mods = new Mod[]
|
Mods = new[]
|
||||||
{
|
{
|
||||||
new OsuModHidden(),
|
new APIMod { Acronym = new OsuModHidden().Acronym },
|
||||||
new OsuModHardRock(),
|
new APIMod { Acronym = new OsuModHardRock().Acronym },
|
||||||
new OsuModDoubleTime()
|
new APIMod { Acronym = new OsuModDoubleTime().Acronym },
|
||||||
},
|
},
|
||||||
Accuracy = 0.9813
|
Accuracy = 0.9813
|
||||||
};
|
};
|
||||||
|
|
||||||
var secondScore = new ScoreInfo
|
var secondScore = new APIScoreInfo
|
||||||
{
|
{
|
||||||
PP = 134.32,
|
PP = 134.32,
|
||||||
Rank = ScoreRank.A,
|
Rank = ScoreRank.A,
|
||||||
BeatmapInfo = new BeatmapInfo
|
Beatmap = new APIBeatmap
|
||||||
{
|
{
|
||||||
Metadata = new BeatmapMetadata
|
BeatmapSet =
|
||||||
{
|
{
|
||||||
Title = "Triumph & Regret",
|
Title = "Triumph & Regret",
|
||||||
Artist = "typeMARS"
|
Artist = "typeMARS",
|
||||||
},
|
},
|
||||||
Version = "[4K] Regret"
|
DifficultyName = "[4K] Regret"
|
||||||
},
|
},
|
||||||
Date = DateTimeOffset.Now,
|
Date = DateTimeOffset.Now,
|
||||||
Mods = new Mod[]
|
Mods = new[]
|
||||||
{
|
{
|
||||||
new OsuModHardRock(),
|
new APIMod { Acronym = new OsuModHardRock().Acronym },
|
||||||
new OsuModDoubleTime(),
|
new APIMod { Acronym = new OsuModDoubleTime().Acronym },
|
||||||
},
|
},
|
||||||
Accuracy = 0.998546
|
Accuracy = 0.998546
|
||||||
};
|
};
|
||||||
|
|
||||||
var thirdScore = new ScoreInfo
|
var thirdScore = new APIScoreInfo
|
||||||
{
|
{
|
||||||
PP = 96.83,
|
PP = 96.83,
|
||||||
Rank = ScoreRank.S,
|
Rank = ScoreRank.S,
|
||||||
BeatmapInfo = new BeatmapInfo
|
Beatmap = new APIBeatmap
|
||||||
{
|
{
|
||||||
Metadata = new BeatmapMetadata
|
BeatmapSet =
|
||||||
{
|
{
|
||||||
Title = "Idolize",
|
Title = "Idolize",
|
||||||
Artist = "Creo"
|
Artist = "Creo",
|
||||||
},
|
},
|
||||||
Version = "Insane"
|
DifficultyName = "Insane"
|
||||||
},
|
},
|
||||||
Date = DateTimeOffset.Now,
|
Date = DateTimeOffset.Now,
|
||||||
Accuracy = 0.9726
|
Accuracy = 0.9726
|
||||||
};
|
};
|
||||||
|
|
||||||
var noPPScore = new ScoreInfo
|
var noPPScore = new APIScoreInfo
|
||||||
{
|
{
|
||||||
Rank = ScoreRank.B,
|
Rank = ScoreRank.B,
|
||||||
BeatmapInfo = new BeatmapInfo
|
Beatmap = new APIBeatmap
|
||||||
{
|
{
|
||||||
Metadata = new BeatmapMetadata
|
BeatmapSet =
|
||||||
{
|
{
|
||||||
Title = "C18H27NO3(extend)",
|
Title = "C18H27NO3(extend)",
|
||||||
Artist = "Team Grimoire"
|
Artist = "Team Grimoire",
|
||||||
},
|
},
|
||||||
Version = "[4K] Cataclysmic Hypernova"
|
DifficultyName = "[4K] Cataclysmic Hypernova"
|
||||||
},
|
},
|
||||||
Date = DateTimeOffset.Now,
|
Date = DateTimeOffset.Now,
|
||||||
Accuracy = 0.55879
|
Accuracy = 0.55879
|
||||||
|
@ -12,9 +12,11 @@ using osu.Framework.Localisation;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Online.Leaderboards;
|
using osu.Game.Online.Leaderboards;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Utils;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Ranks
|
namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||||
@ -26,7 +28,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
|
|
||||||
private const float performance_background_shear = 0.45f;
|
private const float performance_background_shear = 0.45f;
|
||||||
|
|
||||||
protected readonly ScoreInfo Score;
|
protected readonly APIScoreInfo Score;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuColour colours { get; set; }
|
private OsuColour colours { get; set; }
|
||||||
@ -34,7 +36,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private OverlayColourProvider colourProvider { get; set; }
|
private OverlayColourProvider colourProvider { get; set; }
|
||||||
|
|
||||||
public DrawableProfileScore(ScoreInfo score)
|
public DrawableProfileScore(APIScoreInfo score)
|
||||||
{
|
{
|
||||||
Score = score;
|
Score = score;
|
||||||
|
|
||||||
@ -43,7 +45,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load(RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
AddInternal(new ProfileItemContainer
|
AddInternal(new ProfileItemContainer
|
||||||
{
|
{
|
||||||
@ -79,7 +81,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
Spacing = new Vector2(0, 2),
|
Spacing = new Vector2(0, 2),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new ScoreBeatmapMetadataContainer(Score.BeatmapInfo),
|
new ScoreBeatmapMetadataContainer(Score.Beatmap),
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
@ -89,7 +91,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = $"{Score.BeatmapInfo.Version}",
|
Text = $"{Score.Beatmap.DifficultyName}",
|
||||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular),
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular),
|
||||||
Colour = colours.Yellow
|
Colour = colours.Yellow
|
||||||
},
|
},
|
||||||
@ -129,7 +131,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Spacing = new Vector2(2),
|
Spacing = new Vector2(2),
|
||||||
Children = Score.Mods.Select(mod => new ModIcon(mod)
|
Children = Score.Mods.Select(mod => new ModIcon(rulesets.GetRuleset(Score.RulesetID).CreateInstance().CreateModFromAcronym(mod.Acronym))
|
||||||
{
|
{
|
||||||
Scale = new Vector2(0.35f)
|
Scale = new Vector2(0.35f)
|
||||||
}).ToList(),
|
}).ToList(),
|
||||||
@ -198,7 +200,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Child = new OsuSpriteText
|
Child = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = Score.DisplayAccuracy,
|
Text = Score.Accuracy.FormatAccuracy(),
|
||||||
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
|
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
|
||||||
Colour = colours.Yellow,
|
Colour = colours.Yellow,
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
|
@ -6,8 +6,8 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Game.Scoring;
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Ranks
|
namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||||
@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
{
|
{
|
||||||
private readonly double weight;
|
private readonly double weight;
|
||||||
|
|
||||||
public DrawableProfileWeightedScore(ScoreInfo score, double weight)
|
public DrawableProfileWeightedScore(APIScoreInfo score, double weight)
|
||||||
: base(score)
|
: base(score)
|
||||||
{
|
{
|
||||||
this.weight = weight;
|
this.weight = weight;
|
||||||
|
@ -69,10 +69,10 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return new DrawableProfileScore(model.CreateScoreInfo(Rulesets));
|
return new DrawableProfileScore(model);
|
||||||
|
|
||||||
case ScoreType.Best:
|
case ScoreType.Best:
|
||||||
return new DrawableProfileWeightedScore(model.CreateScoreInfo(Rulesets), Math.Pow(0.95, drawableItemIndex++));
|
return new DrawableProfileWeightedScore(model, Math.Pow(0.95, drawableItemIndex++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user