Display tournament banner on user profile

This commit is contained in:
Joseph Madamba
2023-01-31 15:02:59 -08:00
parent 2873905cc6
commit 3b5d573db1
6 changed files with 146 additions and 0 deletions

View File

@ -0,0 +1,46 @@
// 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.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Localisation;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API;
using osu.Game.Users;
namespace osu.Game.Overlays.Profile.Header.Components
{
[LongRunningLoad]
public partial class DrawableTournamentBanner : OsuClickableContainer
{
private readonly TournamentBanner banner;
public DrawableTournamentBanner(TournamentBanner banner)
{
this.banner = banner;
RelativeSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load(LargeTextureStore textures, OsuGame? game, IAPIProvider api)
{
Child = new Sprite
{
RelativeSizeAxes = Axes.Both,
Texture = textures.Get(banner.Image),
};
Action = () => game?.OpenUrlExternally($@"{api.WebsiteRootUrl}/community/tournaments/{banner.TournamentId}");
}
protected override void LoadComplete()
{
base.LoadComplete();
this.FadeInFromZero(200);
}
public override LocalisableString TooltipText => "view in browser";
}
}