From fb7ed08bab60c42b68bb3d3816259cd8bbeb8c70 Mon Sep 17 00:00:00 2001 From: Gagah Pangeran Rosfatiputra Date: Wed, 11 Aug 2021 12:49:22 +0700 Subject: [PATCH] move text creation to load method --- .../Changelog/ChangelogSupporterPromo.cs | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogSupporterPromo.cs b/osu.Game/Overlays/Changelog/ChangelogSupporterPromo.cs index f5638293bb..c0d78cc887 100644 --- a/osu.Game/Overlays/Changelog/ChangelogSupporterPromo.cs +++ b/osu.Game/Overlays/Changelog/ChangelogSupporterPromo.cs @@ -22,8 +22,7 @@ public class ChangelogSupporterPromo : CompositeDrawable { private const float image_container_width = 164; - private readonly LinkFlowContainer supportLinkText; - private readonly TextFlowContainer supportNoteText; + private readonly FillFlowContainer textContainer; private readonly Container imageContainer; public ChangelogSupporterPromo() @@ -65,7 +64,7 @@ public ChangelogSupporterPromo() Padding = new MarginPadding { Horizontal = 75 }, Children = new Drawable[] { - new FillFlowContainer + textContainer = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -73,32 +72,6 @@ public ChangelogSupporterPromo() Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Padding = new MarginPadding { Right = 50 + image_container_width }, - 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); - }) - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - }, - supportNoteText = new TextFlowContainer(t => - { - t.Font = t.Font.With(size: 12); - }) - { - Margin = new MarginPadding { Top = 10 }, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - } - }, }, imageContainer = new Container { @@ -117,17 +90,44 @@ public ChangelogSupporterPromo() [BackgroundDependencyLoader] private void load(OsuColour colour, TextureStore textures) { - void fontPinkColour(SpriteText t) => t.Colour = colour.PinkLighter; + 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, + }, + new TextFlowContainer(t => + { + t.Font = t.Font.With(size: 12); + t.Colour = colour.PinkLighter; + }) + { + Text = "Not only will you help speed development, but you will also get some extra features and customisations!", + Margin = new MarginPadding { Top = 10 }, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + } + }; - supportLinkText.AddText("Support further development of osu! and ", fontPinkColour); + supportLinkText.AddText("Support further development of osu! and "); supportLinkText.AddLink("become an osu!supporter", "https://osu.ppy.sh/home/support", t => { t.Colour = colour.PinkDark; t.Font = t.Font.With(weight: FontWeight.Bold); }); - supportLinkText.AddText(" today!", fontPinkColour); - - supportNoteText.AddText("Not only will you help speed development, but you will also get some extra features and customisations!", fontPinkColour); + supportLinkText.AddText(" today!"); imageContainer.Children = new Drawable[] {