1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-28 23:35:37 +08:00
osu-lazer/osu.Game/Overlays/Changelog/ChangelogSupporterPromo.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

189 lines
8.4 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.
2022-06-17 15:37:17 +08:00
#nullable disable
2021-08-12 21:36:47 +08:00
using System;
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;
2021-08-12 21:36:47 +08:00
using osu.Game.Online.Chat;
2021-08-10 14:21:23 +08:00
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;
private const float heart_size = 75;
2021-08-10 14:53:06 +08:00
public ChangelogSupporterPromo()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Padding = new MarginPadding
{
Vertical = 20,
Horizontal = 50,
};
2021-09-10 12:11:55 +08:00
}
[BackgroundDependencyLoader]
private void load(OsuColour colour, TextureStore textures, OverlayColourProvider colourProvider)
{
SupporterPromoLinkFlowContainer supportLinkText;
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[]
{
2021-09-10 12:11:55 +08:00
new Box
{
RelativeSizeAxes = Axes.Both,
2021-09-10 12:11:55 +08:00
Colour = colourProvider.Background5,
},
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-09-10 12:11:55 +08:00
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-09-10 12:11:55 +08:00
Children = new Drawable[]
{
new OsuSpriteText
{
Text = ChangelogStrings.SupportHeading,
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Light),
Margin = new MarginPadding { Bottom = 20 },
},
supportLinkText = new SupporterPromoLinkFlowContainer(t =>
{
t.Font = t.Font.With(size: 14);
t.Colour = colour.PinkLighter;
})
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
},
new OsuTextFlowContainer(t =>
{
t.Font = t.Font.With(size: 12);
t.Colour = colour.PinkLighter;
})
{
Text = ChangelogStrings.SupportText2,
2021-09-10 12:11:55 +08:00
Margin = new MarginPadding { Top = 10 },
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
}
},
2021-08-10 14:21:23 +08:00
},
2021-09-10 12:11:55 +08:00
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-09-10 12:11:55 +08:00
Children = new Drawable[]
{
new Sprite
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Margin = new MarginPadding { Bottom = 28 },
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fill,
Texture = textures.Get(@"Online/supporter-pippi"),
},
new Container
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Size = new Vector2(heart_size),
Margin = new MarginPadding { Top = 70 },
Masking = true,
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Shadow,
Colour = colour.Pink,
Radius = 10,
Roundness = heart_size / 2,
},
Child = new Sprite
{
Size = new Vector2(heart_size),
Texture = textures.Get(@"Online/supporter-heart"),
},
},
}
2021-08-10 14:53:06 +08:00
}
2021-08-10 14:21:23 +08:00
}
},
}
},
};
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-09-08 14:52:01 +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 14:21:23 +08:00
}
2021-08-12 21:36:47 +08:00
private class SupporterPromoLinkFlowContainer : LinkFlowContainer
{
public SupporterPromoLinkFlowContainer(Action<SpriteText> defaultCreationParameters)
: base(defaultCreationParameters)
{
}
protected override DrawableLinkCompiler CreateLinkCompiler(ITextPart textPart) => new SupporterPromoLinkCompiler(textPart);
2021-08-12 21:36:47 +08:00
private class SupporterPromoLinkCompiler : DrawableLinkCompiler
{
public SupporterPromoLinkCompiler(ITextPart part)
: base(part)
2021-08-12 21:36:47 +08:00
{
}
[BackgroundDependencyLoader]
private void load(OsuColour colour)
{
IdleColour = colour.PinkDark;
HoverColour = Color4.White;
}
}
}
}
}