mirror of
https://github.com/ppy/osu
synced 2025-03-21 18:38:25 +00:00
Move ChangelogEntries populating logic from constructor to BDL load() to use OsuColour palette +apply review suggestions.
This commit is contained in:
parent
e5b64bfa39
commit
342e39776a
@ -13,6 +13,7 @@ using System.Text.RegularExpressions;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Changelog
|
namespace osu.Game.Overlays.Changelog
|
||||||
{
|
{
|
||||||
@ -45,8 +46,12 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var categoryEntries in build.ChangelogEntries.GroupBy(b => b.Category).OrderBy(c => c.Key))
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
foreach (var categoryEntries in Build.ChangelogEntries.GroupBy(b => b.Category).OrderBy(c => c.Key))
|
||||||
{
|
{
|
||||||
ChangelogEntries.Add(new OsuSpriteText
|
ChangelogEntries.Add(new OsuSpriteText
|
||||||
{
|
{
|
||||||
@ -69,19 +74,19 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
Margin = new MarginPadding { Vertical = 5 },
|
Margin = new MarginPadding { Vertical = 5 },
|
||||||
};
|
};
|
||||||
|
|
||||||
var entryColor = entry.Major != null && (bool)entry.Major ? OsuColour.FromHex("#fd5") : Color4.White;
|
var entryColour = entry.Major != null && (bool)entry.Major ? colours.YellowLight : Color4.White;
|
||||||
|
|
||||||
title.AddIcon(FontAwesome.Solid.Check, t =>
|
title.AddIcon(FontAwesome.Solid.Check, t =>
|
||||||
{
|
{
|
||||||
t.Font = fontSmall;
|
t.Font = fontSmall;
|
||||||
t.Colour = entryColor;
|
t.Colour = entryColour;
|
||||||
t.Padding = new MarginPadding { Left = -17, Right = 5 };
|
t.Padding = new MarginPadding { Left = -17, Right = 5 };
|
||||||
});
|
});
|
||||||
|
|
||||||
title.AddText(entry.Title, t =>
|
title.AddText(entry.Title, t =>
|
||||||
{
|
{
|
||||||
t.Font = fontLarge;
|
t.Font = fontLarge;
|
||||||
t.Colour = entryColor;
|
t.Colour = entryColour;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(entry.Repository))
|
if (!string.IsNullOrEmpty(entry.Repository))
|
||||||
@ -89,25 +94,25 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
title.AddText(" (", t =>
|
title.AddText(" (", t =>
|
||||||
{
|
{
|
||||||
t.Font = fontLarge;
|
t.Font = fontLarge;
|
||||||
t.Colour = entryColor;
|
t.Colour = entryColour;
|
||||||
});
|
});
|
||||||
title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl, Online.Chat.LinkAction.External,
|
title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl, Online.Chat.LinkAction.External,
|
||||||
creationParameters: t =>
|
creationParameters: t =>
|
||||||
{
|
{
|
||||||
t.Font = fontLarge;
|
t.Font = fontLarge;
|
||||||
t.Colour = entryColor;
|
t.Colour = entryColour;
|
||||||
});
|
});
|
||||||
title.AddText(")", t =>
|
title.AddText(")", t =>
|
||||||
{
|
{
|
||||||
t.Font = fontLarge;
|
t.Font = fontLarge;
|
||||||
t.Colour = entryColor;
|
t.Colour = entryColour;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
title.AddText(" by ", t =>
|
title.AddText(" by ", t =>
|
||||||
{
|
{
|
||||||
t.Font = fontMedium;
|
t.Font = fontMedium;
|
||||||
t.Colour = entryColor;
|
t.Colour = entryColour;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (entry.GithubUser.UserId != null)
|
if (entry.GithubUser.UserId != null)
|
||||||
@ -118,19 +123,19 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
}, t =>
|
}, t =>
|
||||||
{
|
{
|
||||||
t.Font = fontMedium;
|
t.Font = fontMedium;
|
||||||
t.Colour = entryColor;
|
t.Colour = entryColour;
|
||||||
});
|
});
|
||||||
else if (entry.GithubUser.GithubUrl != null)
|
else if (entry.GithubUser.GithubUrl != null)
|
||||||
title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, Online.Chat.LinkAction.External, null, null, t =>
|
title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, Online.Chat.LinkAction.External, null, null, t =>
|
||||||
{
|
{
|
||||||
t.Font = fontMedium;
|
t.Font = fontMedium;
|
||||||
t.Colour = entryColor;
|
t.Colour = entryColour;
|
||||||
});
|
});
|
||||||
else
|
else
|
||||||
title.AddText(entry.GithubUser.DisplayName, t =>
|
title.AddText(entry.GithubUser.DisplayName, t =>
|
||||||
{
|
{
|
||||||
t.Font = fontSmall;
|
t.Font = fontSmall;
|
||||||
t.Colour = entryColor;
|
t.Colour = entryColour;
|
||||||
});
|
});
|
||||||
|
|
||||||
ChangelogEntries.Add(title);
|
ChangelogEntries.Add(title);
|
||||||
|
Loading…
Reference in New Issue
Block a user