osu/osu.Game/Overlays/NewsOverlay.cs

69 lines
2.1 KiB
C#
Raw Normal View History

// 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 osu.Framework.Allocation;
2019-08-10 15:06:52 +00:00
using osu.Framework.Bindables;
2019-08-10 10:22:45 +00:00
using osu.Framework.Graphics;
2019-08-10 10:53:34 +00:00
using osu.Framework.Graphics.Containers;
2019-08-10 10:22:45 +00:00
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
2019-08-10 10:53:34 +00:00
using osu.Game.Graphics.Containers;
using osu.Game.Overlays.News;
2019-08-10 10:22:45 +00:00
namespace osu.Game.Overlays
{
public class NewsOverlay : FullscreenOverlay
{
2019-08-10 10:53:34 +00:00
private NewsHeader header;
2019-08-14 19:52:36 +00:00
//ReSharper disable NotAccessedField.Local
private Container<NewsContent> content;
2019-08-10 10:53:34 +00:00
2019-08-10 15:06:52 +00:00
public readonly Bindable<string> Current = new Bindable<string>(null);
2019-08-10 10:22:45 +00:00
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
2019-08-10 10:26:54 +00:00
Colour = colours.PurpleDarkAlternative
2019-08-10 10:53:34 +00:00
},
new OsuScrollContainer
{
RelativeSizeAxes = Axes.Both,
Child = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
2019-08-14 19:52:36 +00:00
header = new NewsHeader
{
ShowFrontPage = ShowFrontPage
},
2019-08-14 19:52:36 +00:00
content = new Container<NewsContent>
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
}
2019-08-10 10:53:34 +00:00
},
},
},
2019-08-10 10:22:45 +00:00
};
2019-08-10 15:06:52 +00:00
header.Current.BindTo(Current);
Current.TriggerChange();
}
public void ShowFrontPage()
{
Current.Value = null;
Show();
2019-08-10 10:22:45 +00:00
}
}
}