1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-24 08:07:26 +08:00
osu-lazer/osu.Game/Overlays/Changelog/ChangelogSupporterPromo.cs

154 lines
5.7 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.
2021-08-10 14:21:23 +08:00
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
2021-08-10 13:11:21 +08:00
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
2021-08-10 14:21:23 +08:00
using osu.Framework.Graphics.Sprites;
2021-08-10 15:07:20 +08:00
using osu.Framework.Graphics.Textures;
2021-08-10 14:21:23 +08:00
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web;
2021-08-10 13:11:21 +08:00
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Overlays.Changelog
{
public class ChangelogSupporterPromo : CompositeDrawable
{
2021-08-10 15:07:20 +08:00
private const float image_container_width = 164;
2021-08-10 14:53:06 +08:00
2021-08-11 13:49:22 +08:00
private readonly FillFlowContainer textContainer;
2021-08-10 15:07:20 +08:00
private readonly Container imageContainer;
2021-08-10 14:21:23 +08:00
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Pink);
public ChangelogSupporterPromo()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Padding = new MarginPadding
{
Vertical = 20,
Horizontal = 50,
};
2021-08-10 14:21:23 +08:00
InternalChildren = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
2021-08-10 13:11:21 +08:00
Masking = true,
CornerRadius = 6,
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(0.25f),
Offset = new Vector2(0, 1),
Radius = 3,
},
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black.Opacity(0.3f),
},
2021-08-10 14:53:06 +08:00
new Container
{
RelativeSizeAxes = Axes.X,
Height = 200,
2021-08-10 14:21:23 +08:00
Padding = new MarginPadding { Horizontal = 75 },
Children = new Drawable[]
{
2021-08-11 13:49:22 +08:00
textContainer = new FillFlowContainer
2021-08-10 14:21:23 +08:00
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
2021-08-10 15:07:20 +08:00
Padding = new MarginPadding { Right = 50 + image_container_width },
2021-08-10 14:21:23 +08:00
},
2021-08-10 15:07:20 +08:00
imageContainer = new Container
2021-08-10 14:53:06 +08:00
{
RelativeSizeAxes = Axes.Y,
2021-08-10 15:07:20 +08:00
Width = image_container_width,
2021-08-10 14:53:06 +08:00
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
}
2021-08-10 14:21:23 +08:00
}
},
}
},
};
}
2021-08-10 14:21:23 +08:00
[BackgroundDependencyLoader]
2021-08-10 15:07:20 +08:00
private void load(OsuColour colour, TextureStore textures)
2021-08-10 14:21:23 +08:00
{
2021-08-11 13:49:22 +08:00
LinkFlowContainer supportLinkText;
textContainer.Children = new Drawable[]
{
new OsuSpriteText
{
Text = ChangelogStrings.SupportHeading,
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Light),
Margin = new MarginPadding { Bottom = 20 },
},
supportLinkText = new LinkFlowContainer(t =>
{
t.Font = t.Font.With(size: 14);
t.Colour = colour.PinkLighter;
})
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
},
2021-08-12 20:34:44 +08:00
new OsuTextFlowContainer(t =>
2021-08-11 13:49:22 +08:00
{
t.Font = t.Font.With(size: 12);
t.Colour = colour.PinkLighter;
})
{
Text = ChangelogStrings.SupportText2.ToString(),
2021-08-11 13:49:22 +08:00
Margin = new MarginPadding { Top = 10 },
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
}
};
2021-08-10 14:21:23 +08:00
2021-08-11 13:49:22 +08:00
supportLinkText.AddText("Support further development of osu! and ");
2021-08-12 18:08:54 +08:00
supportLinkText.AddLink("become an osu!supporter", "https://osu.ppy.sh/home/support", t => t.Font = t.Font.With(weight: FontWeight.Bold));
2021-08-11 13:49:22 +08:00
supportLinkText.AddText(" today!");
2021-08-10 15:07:20 +08:00
imageContainer.Children = new Drawable[]
{
new Sprite
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fill,
Texture = textures.Get(@"Online/supporter-pippi"),
},
new Sprite
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Width = 75,
Height = 75,
Margin = new MarginPadding { Top = 70 },
Texture = textures.Get(@"Online/supporter-heart"),
},
};
2021-08-10 14:21:23 +08:00
}
}
}