2019-05-17 16:15:51 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2019-05-17 16:15:51 +08:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using osu.Framework.Allocation;
|
2022-12-16 07:05:47 +08:00
|
|
|
using osu.Framework.Extensions.LocalisationExtensions;
|
2019-05-17 16:15:51 +08:00
|
|
|
using osu.Framework.Graphics;
|
2019-05-31 12:53:55 +08:00
|
|
|
using osu.Framework.Graphics.Containers;
|
2019-05-17 16:15:51 +08:00
|
|
|
using osu.Framework.Graphics.Shapes;
|
2019-05-19 01:09:08 +08:00
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2019-05-17 16:15:51 +08:00
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Changelog
|
|
|
|
{
|
|
|
|
public partial class ChangelogListing : ChangelogContent
|
|
|
|
{
|
|
|
|
private readonly List<APIChangelogBuild> entries;
|
|
|
|
|
|
|
|
public ChangelogListing(List<APIChangelogBuild> entries)
|
|
|
|
{
|
|
|
|
this.entries = entries;
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2020-02-21 22:19:49 +08:00
|
|
|
private void load(OverlayColourProvider colourProvider)
|
2019-05-17 16:15:51 +08:00
|
|
|
{
|
2020-02-21 22:19:49 +08:00
|
|
|
var currentDate = DateTime.MinValue;
|
2019-05-17 16:15:51 +08:00
|
|
|
|
2019-05-19 10:58:47 +08:00
|
|
|
if (entries == null) return;
|
|
|
|
|
2020-02-21 22:19:49 +08:00
|
|
|
foreach (var build in entries)
|
2019-05-17 16:15:51 +08:00
|
|
|
{
|
|
|
|
if (build.CreatedAt.Date != currentDate)
|
|
|
|
{
|
|
|
|
if (Children.Count != 0)
|
|
|
|
{
|
|
|
|
Add(new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
Height = 2,
|
2020-02-21 22:29:51 +08:00
|
|
|
Colour = colourProvider.Background6,
|
2019-05-17 16:15:51 +08:00
|
|
|
Margin = new MarginPadding { Top = 30 },
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-05-19 01:09:08 +08:00
|
|
|
Add(new OsuSpriteText
|
|
|
|
{
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
Origin = Anchor.TopCentre,
|
2020-02-21 22:19:49 +08:00
|
|
|
Margin = new MarginPadding { Top = 20 },
|
2022-12-16 07:05:47 +08:00
|
|
|
Text = build.CreatedAt.Date.ToLocalisableString("dd MMMM yyyy"),
|
2019-05-31 12:54:40 +08:00
|
|
|
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 24),
|
2019-05-19 01:09:08 +08:00
|
|
|
});
|
|
|
|
|
2019-05-17 16:15:51 +08:00
|
|
|
currentDate = build.CreatedAt.Date;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-05-31 12:53:55 +08:00
|
|
|
Add(new Container
|
2019-05-17 16:15:51 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
Height = 1,
|
2023-04-03 08:11:19 +08:00
|
|
|
Padding = new MarginPadding { Horizontal = WaveOverlayContainer.HORIZONTAL_PADDING },
|
2019-05-17 16:15:51 +08:00
|
|
|
Margin = new MarginPadding { Top = 30 },
|
2019-05-31 12:53:55 +08:00
|
|
|
Child = new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2020-02-21 22:19:49 +08:00
|
|
|
Colour = colourProvider.Background6,
|
2019-05-31 12:53:55 +08:00
|
|
|
}
|
2019-05-17 16:15:51 +08:00
|
|
|
});
|
|
|
|
}
|
2019-05-19 01:09:08 +08:00
|
|
|
|
|
|
|
Add(new ChangelogBuild(build) { SelectBuild = SelectBuild });
|
2019-05-17 16:15:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|