1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 10:17:43 +08:00
osu-lazer/osu.Game/Overlays/Dashboard/Home/News/NewsTitleLink.cs

46 lines
1.3 KiB
C#
Raw Normal View History

2020-08-07 17:59:45 +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.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Platform;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Overlays.Dashboard.Home.News
{
public class NewsTitleLink : OsuHoverContainer
{
private readonly APINewsPost post;
public NewsTitleLink(APINewsPost post)
{
this.post = post;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
}
[BackgroundDependencyLoader]
2020-08-12 01:17:29 +08:00
private void load(GameHost host, OverlayColourProvider colourProvider)
2020-08-07 17:59:45 +08:00
{
Child = new TextFlowContainer(t =>
{
t.Font = OsuFont.GetFont(weight: FontWeight.Bold);
})
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Text = post.Title
};
2020-08-12 01:17:29 +08:00
HoverColour = colourProvider.Light1;
2020-08-07 17:59:45 +08:00
TooltipText = "view in browser";
Action = () => host.OpenUrlExternally("https://osu.ppy.sh/home/news/" + post.Slug);
}
}
}