1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:52:53 +08:00

Merge pull request #1061 from jorolf/ranks-section

Add best performance / first place ranks to profile overlay
This commit is contained in:
Dean Herbert 2017-10-13 23:01:16 +09:00 committed by GitHub
commit 120d3fbbec
19 changed files with 580 additions and 57 deletions

View File

@ -19,8 +19,10 @@ namespace osu.Game.Beatmaps
//TODO: should be in database
public int BeatmapVersion;
[JsonProperty("id")]
public int? OnlineBeatmapID { get; set; }
[JsonProperty("beatmapset_id")]
public int? OnlineBeatmapSetID { get; set; }
[ForeignKey(typeof(BeatmapSetInfo))]

View File

@ -0,0 +1,33 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Input;
namespace osu.Game.Graphics.Containers
{
public class OsuHoverContainer : OsuClickableContainer
{
private Color4 hoverColour;
protected override bool OnHover(InputState state)
{
this.FadeColour(hoverColour, 500, Easing.OutQuint);
return base.OnHover(state);
}
protected override void OnHoverLost(InputState state)
{
this.FadeColour(Color4.White, 500, Easing.OutQuint);
base.OnHoverLost(state);
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
hoverColour = colours.Yellow;
}
}
}

View File

@ -0,0 +1,17 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Online.API.Requests
{
public class GetBeatmapSetRequest : APIRequest<GetBeatmapSetsResponse>
{
private readonly int beatmapSetId;
public GetBeatmapSetRequest(int beatmapSetId)
{
this.beatmapSetId = beatmapSetId;
}
protected override string Target => $@"beatmapsets/{beatmapSetId}";
}
}

View File

@ -5,34 +5,11 @@ using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
using osu.Game.Overlays.Direct;
using osu.Game.Rulesets;
using osu.Game.Users;
namespace osu.Game.Online.API.Requests
{
public class GetBeatmapSetsRequest : APIRequest<IEnumerable<GetBeatmapSetsResponse>>
{
private readonly string query;
private readonly RulesetInfo ruleset;
private readonly RankStatus rankStatus;
private readonly DirectSortCriteria sortCriteria;
private readonly SortDirection direction;
private string directionString => direction == SortDirection.Descending ? @"desc" : @"asc";
public GetBeatmapSetsRequest(string query, RulesetInfo ruleset, RankStatus rankStatus = RankStatus.Any, DirectSortCriteria sortCriteria = DirectSortCriteria.Ranked, SortDirection direction = SortDirection.Descending)
{
this.query = System.Uri.EscapeDataString(query);
this.ruleset = ruleset;
this.rankStatus = rankStatus;
this.sortCriteria = sortCriteria;
this.direction = direction;
}
protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={(int)rankStatus}&sort={sortCriteria.ToString().ToLower()}_{directionString}";
}
public class GetBeatmapSetsResponse : BeatmapMetadata
{
[JsonProperty(@"covers")]

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Users;
using osu.Game.Rulesets.Replays;
using osu.Game.Rulesets.Scoring;
@ -67,6 +68,9 @@ namespace osu.Game.Online.API.Requests
set { Replay = value; }
}
[JsonProperty(@"mode_int")]
public int OnlineRulesetID { get; set; }
[JsonProperty(@"score_id")]
private long onlineScoreID
{
@ -79,6 +83,18 @@ namespace osu.Game.Online.API.Requests
set { Date = value; }
}
[JsonProperty(@"beatmap")]
private BeatmapInfo beatmap
{
set { Beatmap = value; }
}
[JsonProperty(@"beatmapset")]
private BeatmapMetadata metadata
{
set { Beatmap.Metadata = value; }
}
[JsonProperty(@"statistics")]
private Dictionary<string, object> jsonStats
{
@ -116,7 +132,12 @@ namespace osu.Game.Online.API.Requests
public void ApplyBeatmap(BeatmapInfo beatmap)
{
Beatmap = beatmap;
Ruleset = beatmap.Ruleset;
ApplyRuleset(beatmap.Ruleset);
}
public void ApplyRuleset(RulesetInfo ruleset)
{
Ruleset = ruleset;
// Evaluate the mod string
Mods = Ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.ShortenedName)).ToArray();

View File

@ -0,0 +1,30 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
namespace osu.Game.Online.API.Requests
{
public class GetUserScoresRequest : APIRequest<List<OnlineScore>>
{
private readonly long userId;
private readonly ScoreType type;
private readonly int offset;
public GetUserScoresRequest(long userId, ScoreType type, int offset = 0)
{
this.userId = userId;
this.type = type;
this.offset = offset;
}
protected override string Target => $@"users/{userId}/scores/{type.ToString().ToLower()}?offset={offset}";
}
public enum ScoreType
{
Best,
Firsts,
Recent
}
}

View File

@ -0,0 +1,32 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
using osu.Game.Overlays.Direct;
using osu.Game.Rulesets;
namespace osu.Game.Online.API.Requests
{
public class SearchBeatmapSetsRequest : APIRequest<IEnumerable<GetBeatmapSetsResponse>>
{
private readonly string query;
private readonly RulesetInfo ruleset;
private readonly RankStatus rankStatus;
private readonly DirectSortCriteria sortCriteria;
private readonly SortDirection direction;
private string directionString => direction == SortDirection.Descending ? @"desc" : @"asc";
public SearchBeatmapSetsRequest(string query, RulesetInfo ruleset, RankStatus rankStatus = RankStatus.Any, DirectSortCriteria sortCriteria = DirectSortCriteria.Ranked, SortDirection direction = SortDirection.Descending)
{
this.query = System.Uri.EscapeDataString(query);
this.ruleset = ruleset;
this.rankStatus = rankStatus;
this.sortCriteria = sortCriteria;
this.direction = direction;
}
protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={(int)rankStatus}&sort={sortCriteria.ToString().ToLower()}_{directionString}";
}
}

View File

@ -188,8 +188,8 @@ namespace osu.Game
GetToolbarHeight = () => ToolbarOffset,
Depth = -1
}, overlayContent.Add);
LoadComponentAsync(beatmapSetOverlay = new BeatmapSetOverlay { Depth = -2 }, mainContent.Add);
LoadComponentAsync(userProfile = new UserProfileOverlay { Depth = -3 }, mainContent.Add);
LoadComponentAsync(userProfile = new UserProfileOverlay { Depth = -2 }, mainContent.Add);
LoadComponentAsync(beatmapSetOverlay = new BeatmapSetOverlay { Depth = -3 }, mainContent.Add);
LoadComponentAsync(musicController = new MusicController
{
Depth = -4,

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
@ -11,7 +12,10 @@ using osu.Framework.Input;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays.BeatmapSet;
using osu.Game.Rulesets;
namespace osu.Game.Overlays
{
@ -23,6 +27,9 @@ namespace osu.Game.Overlays
private readonly Header header;
private readonly Info info;
private APIAccess api;
private RulesetStore rulesets;
// receive input outside our bounds so we can trigger a close event on ourselves.
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
@ -75,6 +82,13 @@ namespace osu.Game.Overlays
header.Picker.Beatmap.ValueChanged += b => info.Beatmap = b;
}
[BackgroundDependencyLoader]
private void load(APIAccess api, RulesetStore rulesets)
{
this.api = api;
this.rulesets = rulesets;
}
protected override void PopIn()
{
base.PopIn();
@ -93,6 +107,14 @@ namespace osu.Game.Overlays
return true;
}
public void ShowBeatmapSet(int beatmapSetId)
{
// todo: display the overlay while we are loading here. we need to support setting BeatmapSet to null for this to work.
var req = new GetBeatmapSetRequest(beatmapSetId);
req.Success += res => ShowBeatmapSet(res.ToBeatmapSet(rulesets));
api.Queue(req);
}
public void ShowBeatmapSet(BeatmapSetInfo set)
{
header.BeatmapSet = info.BeatmapSet = set;

View File

@ -248,7 +248,7 @@ namespace osu.Game.Overlays
});
}
private GetBeatmapSetsRequest getSetsRequest;
private SearchBeatmapSetsRequest getSetsRequest;
private readonly Bindable<string> currentQuery = new Bindable<string>();
@ -269,7 +269,7 @@ namespace osu.Game.Overlays
if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery == string.Empty)) return;
getSetsRequest = new GetBeatmapSetsRequest(currentQuery.Value ?? string.Empty,
getSetsRequest = new SearchBeatmapSetsRequest(currentQuery.Value ?? string.Empty,
((FilterControl)Filter).Ruleset.Value,
Filter.DisplayStyleControl.Dropdown.Current.Value,
Filter.Tabs.Current.Value); //todo: sort direction (?)

View File

@ -12,13 +12,13 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Users;
using System.Diagnostics;
using System.Globalization;
using System.Collections.Generic;
using osu.Framework.Graphics.Cursor;
namespace osu.Game.Overlays.Profile
@ -506,34 +506,29 @@ namespace osu.Game.Overlays.Profile
public class LinkText : OsuSpriteText
{
public override bool HandleInput => Url != null;
private readonly OsuHoverContainer content;
public string Url;
public override bool HandleInput => content.Action != null;
private Color4 hoverColour;
protected override Container<Drawable> Content => content ?? (Container<Drawable>)this;
protected override bool OnHover(InputState state)
protected override IEnumerable<Drawable> FlowingChildren => Children;
public string Url
{
this.FadeColour(hoverColour, 500, Easing.OutQuint);
return base.OnHover(state);
set
{
if(value != null)
content.Action = () => Process.Start(value);
}
}
protected override void OnHoverLost(InputState state)
public LinkText()
{
this.FadeColour(Color4.White, 500, Easing.OutQuint);
base.OnHoverLost(state);
}
protected override bool OnClick(InputState state)
{
Process.Start(Url);
return true;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
hoverColour = colours.Yellow;
AddInternal(content = new OsuHoverContainer
{
AutoSizeAxes = Axes.Both,
});
}
}

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Users;
using OpenTK.Graphics;
namespace osu.Game.Overlays.Profile
@ -18,8 +19,17 @@ namespace osu.Game.Overlays.Profile
public abstract string Identifier { get; }
private readonly FillFlowContainer content;
protected override Container<Drawable> Content => content;
public virtual User User
{
get { return user; }
set { user = value; }
}
private User user;
protected ProfileSection()
{
Direction = FillDirection.Vertical;

View File

@ -0,0 +1,164 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using OpenTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Select.Leaderboards;
using System.Linq;
using osu.Framework.Localisation;
using System.Globalization;
using osu.Game.Rulesets.Scoring;
using System;
using osu.Game.Rulesets.UI;
namespace osu.Game.Overlays.Profile.Sections.Ranks
{
public class DrawableScore : Container
{
private readonly FillFlowContainer<OsuSpriteText> stats;
private readonly FillFlowContainer metadata;
private readonly ModContainer modContainer;
private readonly Score score;
private readonly double? weight;
public DrawableScore(Score score, double? weight = null)
{
this.score = score;
this.weight = weight;
Children = new Drawable[]
{
new DrawableRank(score.Rank)
{
RelativeSizeAxes = Axes.Y,
Width = 60,
FillMode = FillMode.Fit,
},
stats = new FillFlowContainer<OsuSpriteText>
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Direction = FillDirection.Vertical,
},
metadata = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Margin = new MarginPadding { Left = 70 },
Direction = FillDirection.Vertical,
Child = new OsuSpriteText
{
Text = score.Date.LocalDateTime.ToShortDateString(),
TextSize = 11,
Colour = OsuColour.Gray(0xAA),
Depth = -1,
},
},
modContainer = new ModContainer
{
AutoSizeAxes = Axes.Y,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Width = 60,
Margin = new MarginPadding { Right = 150 }
}
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colour, LocalisationEngine locale, BeatmapSetOverlay beatmapSetOverlay)
{
stats.Add(new OsuSpriteText
{
Text = $"{Math.Round(score.PP ?? 0)}pp",
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
TextSize = 18,
Font = "Exo2.0-BoldItalic",
});
if (weight.HasValue)
{
stats.Add(new OsuSpriteText
{
Text = $"weighted: {Math.Round(score.PP * weight ?? 0)}pp ({weight.Value.ToString("0%", CultureInfo.CurrentCulture)})",
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Colour = colour.GrayA,
TextSize = 11,
Font = "Exo2.0-RegularItalic",
});
}
stats.Add(new OsuSpriteText
{
Text = "accuracy: " + score.Accuracy.ToString("0.00%"),
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Colour = colour.GrayA,
TextSize = 11,
Font = "Exo2.0-RegularItalic",
});
metadata.Add(new OsuHoverContainer
{
AutoSizeAxes = Axes.Both,
Action = () =>
{
if (score.Beatmap.OnlineBeatmapSetID.HasValue) beatmapSetOverlay.ShowBeatmapSet(score.Beatmap.OnlineBeatmapSetID.Value);
},
Child = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
new OsuSpriteText
{
Current = locale.GetUnicodePreference(
$"{score.Beatmap.Metadata.TitleUnicode ?? score.Beatmap.Metadata.Title} [{score.Beatmap.Version}] ",
$"{score.Beatmap.Metadata.Title ?? score.Beatmap.Metadata.TitleUnicode} [{score.Beatmap.Version}] "
),
TextSize = 15,
Font = "Exo2.0-SemiBoldItalic",
},
new OsuSpriteText
{
Current = locale.GetUnicodePreference(score.Beatmap.Metadata.ArtistUnicode, score.Beatmap.Metadata.Artist),
TextSize = 12,
Padding = new MarginPadding { Top = 3 },
Font = "Exo2.0-RegularItalic",
},
},
},
});
foreach (Mod mod in score.Mods)
modContainer.Add(new ModIcon(mod)
{
AutoSizeAxes = Axes.Both,
Scale = new Vector2(0.5f),
});
}
private class ModContainer : FlowContainer<ModIcon>
{
protected override IEnumerable<Vector2> ComputeLayoutPositions()
{
int count = FlowingChildren.Count();
for (int i = 0; i < count; i++)
yield return new Vector2(DrawWidth * i * (count == 1 ? 0 : 1f / (count - 1)), 0);
}
}
}
}

View File

@ -1,6 +1,21 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays.Profile.Sections.Ranks;
using System;
using System.Linq;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Rulesets;
using osu.Game.Users;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using osu.Framework.Allocation;
namespace osu.Game.Overlays.Profile.Sections
{
public class RanksSection : ProfileSection
@ -8,5 +23,148 @@ namespace osu.Game.Overlays.Profile.Sections
public override string Title => "Ranks";
public override string Identifier => "top_ranks";
private readonly ScoreContainer best, first;
public RanksSection()
{
Children = new Drawable[]
{
best = new ScoreContainer(ScoreType.Best, "Best Performance", true),
first = new ScoreContainer(ScoreType.Firsts, "First Place Ranks"),
};
}
public override User User
{
get
{
return base.User;
}
set
{
base.User = value;
best.User = value;
first.User = value;
}
}
private class ScoreContainer : FillFlowContainer
{
private readonly FillFlowContainer<DrawableScore> scoreContainer;
private readonly OsuSpriteText missing;
private readonly OsuHoverContainer showMoreButton;
private readonly LoadingAnimation showMoreLoading;
private readonly ScoreType type;
private int visiblePages;
private User user;
private readonly bool includeWeigth;
private RulesetStore rulesets;
private APIAccess api;
public User User
{
set
{
user = value;
visiblePages = 0;
scoreContainer.Clear();
showMoreButton.Hide();
missing.Show();
showMore();
}
}
public ScoreContainer(ScoreType type, string header, bool includeWeigth = false)
{
this.type = type;
this.includeWeigth = includeWeigth;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Direction = FillDirection.Vertical;
Children = new Drawable[]
{
new OsuSpriteText
{
TextSize = 15,
Text = header,
Font = "Exo2.0-RegularItalic",
Margin = new MarginPadding { Top = 10, Bottom = 10 },
},
scoreContainer = new FillFlowContainer<DrawableScore>
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
},
showMoreButton = new OsuHoverContainer
{
Alpha = 0,
Action = showMore,
AutoSizeAxes = Axes.Both,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Child = new OsuSpriteText
{
TextSize = 14,
Text = "show more",
}
},
showMoreLoading = new LoadingAnimation
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Size = new Vector2(14),
},
missing = new OsuSpriteText
{
TextSize = 14,
Text = "No awesome performance records yet. :(",
},
};
}
[BackgroundDependencyLoader]
private void load(APIAccess api, RulesetStore rulesets)
{
this.api = api;
this.rulesets = rulesets;
}
private void showMore()
{
var req = new GetUserScoresRequest(user.Id, type, visiblePages++ * 5);
showMoreLoading.Show();
showMoreButton.Hide();
req.Success += scores =>
{
foreach (var s in scores)
s.ApplyRuleset(rulesets.GetRuleset(s.OnlineRulesetID));
showMoreButton.FadeTo(scores.Count == 5 ? 1 : 0);
showMoreLoading.Hide();
if (scores.Any())
{
missing.Hide();
foreach (OnlineScore score in scores)
scoreContainer.Add(new DrawableScore(score, includeWeigth ? Math.Pow(0.95, scoreContainer.Count) : -1)
{
RelativeSizeAxes = Axes.X,
Height = 60,
});
}
};
Schedule(() => { api.Queue(req); });
}
}
}
}

View File

@ -92,12 +92,12 @@ namespace osu.Game.Overlays
sections = new ProfileSection[]
{
new AboutSection(),
new RecentSection(),
//new RecentSection(),
new RanksSection(),
new MedalsSection(),
new HistoricalSection(),
new BeatmapsSection(),
new KudosuSection()
//new MedalsSection(),
//new HistoricalSection(),
//new BeatmapsSection(),
//new KudosuSection()
};
tabs = new ProfileTabControl
{
@ -175,6 +175,8 @@ namespace osu.Game.Overlays
var sec = sections.FirstOrDefault(s => s.Identifier == id);
if (sec != null)
{
sec.User = user;
sectionsContainer.Add(sec);
tabs.AddItem(sec);
}

View File

@ -20,6 +20,8 @@ namespace osu.Game.Rulesets.Scoring
public double Health { get; set; } = 1;
public double? PP { get; set; }
public int MaxCombo { get; set; }
public int Combo { get; set; }

View File

@ -6,13 +6,14 @@ using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mods;
using OpenTK;
namespace osu.Game.Rulesets.UI
{
public class ModIcon : Container
public class ModIcon : Container, IHasTooltip
{
private readonly SpriteIcon modIcon;
private readonly SpriteIcon background;
@ -27,12 +28,16 @@ namespace osu.Game.Rulesets.UI
private readonly ModType type;
public string TooltipText { get; }
public ModIcon(Mod mod)
{
if (mod == null) throw new ArgumentNullException(nameof(mod));
type = mod.Type;
TooltipText = mod.Name;
Children = new Drawable[]
{
background = new SpriteIcon

View File

@ -0,0 +1,47 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Overlays.Profile.Sections;
using osu.Game.Overlays.Profile.Sections.Ranks;
using osu.Game.Users;
using System;
using System.Collections.Generic;
namespace osu.Game.Tests.Visual
{
internal class TestCaseUserRanks : OsuTestCase
{
public override string Description => "showing your latest achievements";
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(DrawableScore), typeof(RanksSection) };
public TestCaseUserRanks()
{
RanksSection ranks;
Add(new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.2f)
},
new ScrollContainer
{
RelativeSizeAxes = Axes.Both,
Child = ranks = new RanksSection(),
},
}
});
AddStep("Show cookiezi", () => ranks.User = new User { Id = 124493 });
}
}
}

View File

@ -263,6 +263,8 @@
<Compile Include="Beatmaps\Drawables\BeatmapPanel.cs" />
<Compile Include="Beatmaps\Drawables\BeatmapSetCover.cs" />
<Compile Include="Beatmaps\Drawables\BeatmapSetHeader.cs" />
<Compile Include="Online\API\Requests\GetBeatmapSetRequest.cs" />
<Compile Include="Online\API\Requests\GetBeatmapSetsResponse.cs" />
<Compile Include="Screens\Edit\Screens\Compose\Timeline\BeatmapWaveformGraph.cs" />
<Compile Include="Beatmaps\Drawables\DifficultyColouredContainer.cs" />
<Compile Include="Beatmaps\Drawables\DifficultyIcon.cs" />
@ -272,6 +274,7 @@
<Compile Include="Beatmaps\Formats\OsuLegacyDecoder.cs" />
<Compile Include="Beatmaps\IO\ArchiveReader.cs" />
<Compile Include="Beatmaps\IO\LegacyFilesystemReader.cs" />
<Compile Include="Online\API\Requests\GetUserScoresRequest.cs" />
<Compile Include="Screens\Edit\Screens\Compose\Timeline\TimelineButton.cs" />
<Compile Include="Screens\Play\BreaksOverlay\ArrowsOverlay.cs" />
<Compile Include="Screens\Play\BreaksOverlay\BlurredIcon.cs" />
@ -301,6 +304,7 @@
<Compile Include="Graphics\Containers\ConstrainedIconContainer.cs" />
<Compile Include="Graphics\Containers\OsuClickableContainer.cs" />
<Compile Include="Graphics\Containers\OsuFocusedOverlayContainer.cs" />
<Compile Include="Graphics\Containers\OsuHoverContainer.cs" />
<Compile Include="Graphics\Containers\OsuScrollContainer.cs" />
<Compile Include="Graphics\Containers\OsuTextFlowContainer.cs" />
<Compile Include="Graphics\Containers\ParallaxContainer.cs" />
@ -368,7 +372,7 @@
<Compile Include="Online\API\OAuthToken.cs" />
<Compile Include="Online\API\Requests\DownloadBeatmapSetRequest.cs" />
<Compile Include="Online\API\Requests\GetBeatmapDetailsRequest.cs" />
<Compile Include="Online\API\Requests\GetBeatmapSetsRequest.cs" />
<Compile Include="Online\API\Requests\SearchBeatmapSetsRequest.cs" />
<Compile Include="Online\API\Requests\GetMessagesRequest.cs" />
<Compile Include="Online\API\Requests\GetScoresRequest.cs" />
<Compile Include="Online\API\Requests\GetUserRequest.cs" />
@ -438,6 +442,7 @@
<Compile Include="Overlays\Notifications\ProgressNotification.cs" />
<Compile Include="Overlays\Notifications\SimpleNotification.cs" />
<Compile Include="Overlays\OnScreenDisplay.cs" />
<Compile Include="Overlays\Profile\Sections\Ranks\DrawableScore.cs" />
<Compile Include="Overlays\Profile\ProfileHeader.cs" />
<Compile Include="Overlays\Profile\ProfileSection.cs" />
<Compile Include="Overlays\Profile\RankChart.cs" />
@ -790,6 +795,7 @@
<Compile Include="Tests\Visual\TestCaseTwoLayerButton.cs" />
<Compile Include="Tests\Visual\TestCaseUserPanel.cs" />
<Compile Include="Tests\Visual\TestCaseUserProfile.cs" />
<Compile Include="Tests\Visual\TestCaseUserRanks.cs" />
<Compile Include="Tests\Visual\TestCaseWaveform.cs" />
<Compile Include="Users\Avatar.cs" />
<Compile Include="Users\Country.cs" />