mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 22:22:55 +08:00
Handle all changelog entry types correctly
This commit is contained in:
parent
5f43299d37
commit
3ac618778f
@ -105,9 +105,23 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
new APIChangelogEntry
|
||||
{
|
||||
Category = "Test",
|
||||
Title = "Title",
|
||||
MessageHtml = "Message",
|
||||
Type = ChangelogEntryType.Fix,
|
||||
Category = "osu!",
|
||||
Title = "Fix thing",
|
||||
MessageHtml = "Additional info goes here.",
|
||||
},
|
||||
new APIChangelogEntry
|
||||
{
|
||||
Type = ChangelogEntryType.Add,
|
||||
Category = "osu!",
|
||||
Title = "Add thing",
|
||||
Major = true
|
||||
},
|
||||
new APIChangelogEntry
|
||||
{
|
||||
Type = ChangelogEntryType.Misc,
|
||||
Category = "Code quality",
|
||||
Title = "Clean up thing"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Changelog
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreRight,
|
||||
Size = new Vector2(10),
|
||||
Icon = entry.Type == ChangelogEntryType.Fix ? FontAwesome.Solid.Check : FontAwesome.Solid.Plus,
|
||||
Icon = getIconForChangelogEntry(entry.Type),
|
||||
Colour = entryColour.Opacity(0.5f),
|
||||
Margin = new MarginPadding { Right = 5 },
|
||||
},
|
||||
@ -186,6 +186,25 @@ namespace osu.Game.Overlays.Changelog
|
||||
}
|
||||
}
|
||||
|
||||
private static IconUsage getIconForChangelogEntry(ChangelogEntryType entryType)
|
||||
{
|
||||
// compare: https://github.com/ppy/osu-web/blob/master/resources/assets/coffee/react/_components/changelog-entry.coffee#L8-L11
|
||||
switch (entryType)
|
||||
{
|
||||
case ChangelogEntryType.Add:
|
||||
return FontAwesome.Solid.Plus;
|
||||
|
||||
case ChangelogEntryType.Fix:
|
||||
return FontAwesome.Solid.Check;
|
||||
|
||||
case ChangelogEntryType.Misc:
|
||||
return FontAwesome.Regular.Circle;
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(entryType), $"Unrecognised entry type {entryType}");
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual FillFlowContainer CreateHeader() => new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
|
Loading…
Reference in New Issue
Block a user