2019-05-22 23:13:59 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2019-05-17 16:15:51 +08:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2019-05-19 01:09:08 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Containers;
|
2019-05-17 16:15:51 +08:00
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
2019-05-19 01:09:08 +08:00
|
|
|
|
using System;
|
2019-05-22 23:13:59 +08:00
|
|
|
|
using System.Linq;
|
2019-05-19 01:09:08 +08:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2019-06-08 02:59:56 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2019-05-17 16:15:51 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Changelog
|
|
|
|
|
{
|
2019-05-19 01:09:08 +08:00
|
|
|
|
public partial class ChangelogBuild : FillFlowContainer
|
2019-05-17 16:15:51 +08:00
|
|
|
|
{
|
2019-05-31 12:53:55 +08:00
|
|
|
|
public const float HORIZONTAL_PADDING = 70;
|
|
|
|
|
|
2019-05-19 01:09:08 +08:00
|
|
|
|
public Action<APIChangelogBuild> SelectBuild;
|
2019-05-17 16:15:51 +08:00
|
|
|
|
|
2019-05-19 01:09:08 +08:00
|
|
|
|
protected readonly APIChangelogBuild Build;
|
|
|
|
|
|
|
|
|
|
public readonly FillFlowContainer ChangelogEntries;
|
2019-05-17 16:15:51 +08:00
|
|
|
|
|
2019-05-19 01:09:08 +08:00
|
|
|
|
public ChangelogBuild(APIChangelogBuild build)
|
2019-05-17 16:15:51 +08:00
|
|
|
|
{
|
2019-05-19 01:09:08 +08:00
|
|
|
|
Build = build;
|
2019-05-17 16:47:28 +08:00
|
|
|
|
|
2019-05-19 01:09:08 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
Direction = FillDirection.Vertical;
|
2019-05-31 12:53:55 +08:00
|
|
|
|
Padding = new MarginPadding { Horizontal = HORIZONTAL_PADDING };
|
2019-05-19 01:09:08 +08:00
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
2019-05-17 16:47:28 +08:00
|
|
|
|
{
|
2019-05-19 01:09:08 +08:00
|
|
|
|
CreateHeader(),
|
|
|
|
|
ChangelogEntries = new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
},
|
2019-05-17 16:47:28 +08:00
|
|
|
|
};
|
2019-06-08 02:59:56 +08:00
|
|
|
|
}
|
2019-05-17 16:47:28 +08:00
|
|
|
|
|
2019-06-08 02:59:56 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
2022-01-15 08:06:39 +08:00
|
|
|
|
private void load()
|
2019-06-08 02:59:56 +08:00
|
|
|
|
{
|
|
|
|
|
foreach (var categoryEntries in Build.ChangelogEntries.GroupBy(b => b.Category).OrderBy(c => c.Key))
|
2019-05-19 01:09:08 +08:00
|
|
|
|
{
|
|
|
|
|
ChangelogEntries.Add(new OsuSpriteText
|
|
|
|
|
{
|
2019-05-22 23:13:59 +08:00
|
|
|
|
Text = categoryEntries.Key,
|
2020-02-21 22:11:29 +08:00
|
|
|
|
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 18),
|
2019-05-19 01:09:08 +08:00
|
|
|
|
Margin = new MarginPadding { Top = 35, Bottom = 15 },
|
|
|
|
|
});
|
|
|
|
|
|
2020-12-26 03:31:12 +08:00
|
|
|
|
ChangelogEntries.AddRange(categoryEntries.Select(entry => new ChangelogEntry(entry)));
|
2020-12-26 03:08:57 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-19 01:09:08 +08:00
|
|
|
|
protected virtual FillFlowContainer CreateHeader() => new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Margin = new MarginPadding { Top = 20 },
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new OsuHoverContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Action = () => SelectBuild?.Invoke(Build),
|
|
|
|
|
Child = new FillFlowContainer<SpriteText>
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Margin = new MarginPadding { Horizontal = 40 },
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = Build.UpdateStream.DisplayName,
|
|
|
|
|
Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 19),
|
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = " ",
|
|
|
|
|
Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 19),
|
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = Build.DisplayVersion,
|
|
|
|
|
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 19),
|
|
|
|
|
Colour = Build.UpdateStream.Colour,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
};
|
2019-05-17 16:15:51 +08:00
|
|
|
|
}
|
|
|
|
|
}
|