Huge refactor pass focusing on ChangelogContent

This commit is contained in:
Dean Herbert
2019-05-19 02:09:08 +09:00
parent 5d6c599129
commit 3fa1545ea4
10 changed files with 294 additions and 331 deletions

View File

@ -6,6 +6,8 @@ using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.API.Requests.Responses;
using osuTK.Graphics;
@ -23,10 +25,7 @@ namespace osu.Game.Overlays.Changelog
[BackgroundDependencyLoader]
private void load()
{
DateTime currentDate = new DateTime();
Clear();
ChangelogContentGroup changelogContentGroup = null;
DateTime currentDate = DateTime.MinValue;
foreach (APIChangelogBuild build in entries)
{
@ -43,27 +42,32 @@ namespace osu.Game.Overlays.Changelog
});
}
changelogContentGroup = new ChangelogContentGroup(build, true);
changelogContentGroup.BuildSelected += SelectBuild;
changelogContentGroup.GenerateText(build.ChangelogEntries);
Add(changelogContentGroup);
Add(new OsuSpriteText
{
// do we need .ToUniversalTime() here?
// also, this should be a temporary solution to weekdays in >localized< date strings
Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""),
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 24),
Colour = OsuColour.FromHex(@"FD5"),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Margin = new MarginPadding { Top = 15 },
});
currentDate = build.CreatedAt.Date;
}
else
{
changelogContentGroup?.Add(new Box
Add(new Box
{
RelativeSizeAxes = Axes.X,
Height = 1,
Colour = new Color4(32, 24, 35, 255),
Margin = new MarginPadding { Top = 30 },
});
changelogContentGroup = new ChangelogContentGroup(build, false);
changelogContentGroup.BuildSelected += SelectBuild;
changelogContentGroup.GenerateText(build.ChangelogEntries);
Add(changelogContentGroup);
}
Add(new ChangelogBuild(build) { SelectBuild = SelectBuild });
}
}
}