1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 20:03:22 +08:00

Add support for changelog entries with url attached

This commit is contained in:
Joseph Madamba 2023-08-03 23:09:39 -07:00
parent 270c03235d
commit d179fe3d96
No known key found for this signature in database
GPG Key ID: 8B746C7BDDF0BD76
2 changed files with 26 additions and 5 deletions

View File

@ -154,7 +154,14 @@ namespace osu.Game.Tests.Visual.Online
Type = ChangelogEntryType.Misc,
Category = "Code quality",
Title = "Clean up another thing"
}
},
new APIChangelogEntry
{
Type = ChangelogEntryType.Add,
Category = "osu!",
Title = "Add entry with news url",
Url = "https://osu.ppy.sh/home/news/2023-07-27-summer-splash"
},
}
});

View File

@ -12,6 +12,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Online;
using osu.Game.Online.API.Requests.Responses;
using osuTK;
using osuTK.Graphics;
@ -29,6 +30,9 @@ namespace osu.Game.Overlays.Changelog
[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;
[Resolved]
private ILinkHandler? linkHandler { get; set; }
private FontUsage fontLarge;
private FontUsage fontMedium;
@ -86,11 +90,21 @@ namespace osu.Game.Overlays.Changelog
}
};
title.AddText(entry.Title, t =>
if (string.IsNullOrEmpty(entry.Url))
{
t.Font = fontLarge;
t.Colour = entryColour;
});
title.AddText(entry.Title, t =>
{
t.Font = fontLarge;
t.Colour = entryColour;
});
}
else
{
title.AddLink(entry.Title, () => linkHandler?.HandleLink(entry.Url), entry.Url, t =>
{
t.Font = fontLarge;
});
}
if (!string.IsNullOrEmpty(entry.Repository) && !string.IsNullOrEmpty(entry.GithubUrl))
addRepositoryReference(title, entryColour);