1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 04:07:25 +08:00
osu-lazer/osu.Game/Overlays/ChangelogOverlay.cs

108 lines
3.6 KiB
C#
Raw Normal View History

2018-07-17 05:50:22 +08:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Overlays.Changelog;
2018-07-18 07:35:06 +08:00
using osu.Game.Overlays.Changelog.Streams;
2018-07-17 05:50:22 +08:00
namespace osu.Game.Overlays
{
public class ChangelogOverlay : WaveOverlayContainer
{
private readonly ScrollContainer scroll;
2018-07-18 21:17:20 +08:00
private ChangelogHeader header;
2018-07-18 07:35:06 +08:00
public readonly ChangelogStreams streams;
2018-07-17 05:50:22 +08:00
2018-07-18 00:32:11 +08:00
protected Color4 purple = new Color4(191, 4, 255, 255);
2018-07-17 05:50:22 +08:00
public ChangelogOverlay()
{
2018-07-18 00:32:11 +08:00
// these possibly need adjusting?
Waves.FirstWaveColour = OsuColour.FromHex(@"bf04ff");
Waves.SecondWaveColour = OsuColour.FromHex(@"8F03BF");
Waves.ThirdWaveColour = OsuColour.FromHex(@"600280");
Waves.FourthWaveColour = OsuColour.FromHex(@"300140");
2018-07-17 05:50:22 +08:00
Anchor = Anchor.TopCentre;
Origin = Anchor.TopCentre;
RelativeSizeAxes = Axes.Both;
Width = 0.85f;
Masking = true;
2018-07-18 00:32:11 +08:00
2018-07-17 05:50:22 +08:00
EdgeEffect = new EdgeEffectParameters
{
Colour = Color4.Black.Opacity(0),
Type = EdgeEffectType.Shadow,
Radius = 3,
Offset = new Vector2(0f, 1f),
};
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = new Color4(20, 18, 23, 255)
},
scroll = new ScrollContainer
{
RelativeSizeAxes = Axes.Both,
ScrollbarVisible = false,
Child = new ReverseChildIDFillFlowContainer<Drawable>
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
header = new ChangelogHeader(),
2018-07-18 07:35:06 +08:00
streams = new ChangelogStreams(),
2018-07-17 05:50:22 +08:00
},
},
},
};
2018-07-18 07:35:06 +08:00
streams.SelectedRelease.ValueChanged += r =>
{
2018-07-18 09:26:08 +08:00
if (streams.SelectedRelease.Value != null)
2018-07-18 07:35:06 +08:00
header.ShowReleaseStream(r.Name, string.Join(" ", r.Name, r.DisplayVersion));
};
streams.badgesContainer.OnLoadComplete += d =>
{
header.OnListingActivated += () =>
{
2018-07-18 09:26:08 +08:00
streams.SelectedRelease.Value = null;
2018-07-18 07:35:06 +08:00
foreach (StreamBadge item in streams.badgesContainer.Children)
{
item.Activate(true);
}
};
};
2018-07-17 05:50:22 +08:00
}
2018-07-18 21:17:20 +08:00
public void ActivateListing() => header.ActivateListing();
2018-07-17 05:50:22 +08:00
// receive input outside our bounds so we can trigger a close event on ourselves.
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
protected override void PopIn()
{
base.PopIn();
FadeEdgeEffectTo(0.25f, WaveContainer.APPEAR_DURATION, Easing.In);
}
protected override void PopOut()
{
base.PopOut();
FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out);
}
}
}