1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 18:47:27 +08:00

Merge pull request #24461 from Joehuu/changelog-entry-links

This commit is contained in:
Dean Herbert 2023-08-04 19:45:07 +08:00 committed by GitHub
commit e13eb7588d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);