mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Split out ChangelogContent into two classes
This commit is contained in:
@ -3,20 +3,17 @@
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Changelog
|
||||
{
|
||||
public class ChangelogContent : FillFlowContainer
|
||||
{
|
||||
private ChangelogContentGroup changelogContentGroup;
|
||||
|
||||
public event Action<APIChangelogBuild> BuildSelected;
|
||||
|
||||
public void SelectBuild(APIChangelogBuild build) => BuildSelected?.Invoke(build);
|
||||
|
||||
public ChangelogContent()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
@ -24,58 +21,5 @@ namespace osu.Game.Overlays.Changelog
|
||||
Direction = FillDirection.Vertical;
|
||||
Padding = new MarginPadding { Bottom = 100 };
|
||||
}
|
||||
|
||||
public void ShowListing(List<APIChangelogBuild> changelog)
|
||||
{
|
||||
DateTime currentDate = new DateTime();
|
||||
Clear();
|
||||
|
||||
foreach (APIChangelogBuild build in changelog)
|
||||
{
|
||||
if (build.CreatedAt.Date != currentDate)
|
||||
{
|
||||
if (Children.Count != 0)
|
||||
{
|
||||
Add(new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 2,
|
||||
Colour = new Color4(17, 17, 17, 255),
|
||||
Margin = new MarginPadding { Top = 30 },
|
||||
});
|
||||
}
|
||||
|
||||
changelogContentGroup = new ChangelogContentGroup(build, true);
|
||||
changelogContentGroup.BuildSelected += b => BuildSelected?.Invoke(b);
|
||||
changelogContentGroup.GenerateText(build.ChangelogEntries);
|
||||
Add(changelogContentGroup);
|
||||
currentDate = build.CreatedAt.Date;
|
||||
}
|
||||
else
|
||||
{
|
||||
changelogContentGroup.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 += b => BuildSelected?.Invoke(b);
|
||||
changelogContentGroup.GenerateText(build.ChangelogEntries);
|
||||
Add(changelogContentGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowBuild(APIChangelogBuild changelogBuild)
|
||||
{
|
||||
Child = changelogContentGroup = new ChangelogContentGroup(changelogBuild);
|
||||
changelogContentGroup.GenerateText(changelogBuild.ChangelogEntries);
|
||||
changelogContentGroup.UpdateChevronTooltips(changelogBuild.Versions.Previous?.DisplayVersion,
|
||||
changelogBuild.Versions.Next?.DisplayVersion);
|
||||
changelogContentGroup.BuildSelected += b => BuildSelected?.Invoke(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user