2020-08-07 17:59:45 +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.
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Dashboard.Home.News
|
|
|
|
|
{
|
2020-08-12 16:24:26 +08:00
|
|
|
|
public class NewsItemGroupPanel : HomePanel
|
2020-08-07 17:59:45 +08:00
|
|
|
|
{
|
|
|
|
|
private readonly List<APINewsPost> posts;
|
|
|
|
|
|
2020-08-12 16:24:26 +08:00
|
|
|
|
public NewsItemGroupPanel(List<APINewsPost> posts)
|
2020-08-07 17:59:45 +08:00
|
|
|
|
{
|
|
|
|
|
this.posts = posts;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
|
|
|
|
{
|
|
|
|
|
Content.Padding = new MarginPadding { Vertical = 5 };
|
|
|
|
|
|
2020-08-12 16:24:26 +08:00
|
|
|
|
Child = new FillFlowContainer<NewsGroupItem>
|
2020-08-07 17:59:45 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
2020-08-12 16:24:26 +08:00
|
|
|
|
Children = posts.Select(p => new NewsGroupItem(p)).ToArray()
|
2020-08-07 17:59:45 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|