From 97dbc95bc64d7a10506bdcc00f271f218ddf3853 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 29 May 2019 21:02:20 +0300 Subject: [PATCH 1/4] Kudosu section update --- .../Profile/Sections/Kudosu/KudosuInfo.cs | 75 ++++++++----------- 1 file changed, 31 insertions(+), 44 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index aeea5118a7..87a241936a 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -3,53 +3,38 @@ using osu.Framework.Bindables; using osuTK; -using osuTK.Graphics; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Users; +using osu.Framework.Allocation; namespace osu.Game.Overlays.Profile.Sections.Kudosu { public class KudosuInfo : Container { private readonly Bindable user = new Bindable(); - public KudosuInfo(Bindable user) { this.user.BindTo(user); - CountSection total; CountSection avaliable; - RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Masking = true; CornerRadius = 3; - EdgeEffect = new EdgeEffectParameters - { - Type = EdgeEffectType.Shadow, - Offset = new Vector2(0f, 1f), - Radius = 3f, - Colour = Color4.Black.Opacity(0.2f), - }; Children = new Drawable[] { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.Gray(0.2f) - }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5, 0), Children = new[] { total = new CountSection( @@ -63,31 +48,29 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu } } }; - this.user.ValueChanged += u => { total.Count = u.NewValue?.Kudosu.Total ?? 0; avaliable.Count = u.NewValue?.Kudosu.Available ?? 0; }; } - protected override bool OnClick(ClickEvent e) => true; - private class CountSection : Container { private readonly OsuSpriteText valueText; + private readonly OsuTextFlowContainer descriptionText; + private readonly Box lineBackground; public new int Count { set => valueText.Text = value.ToString(); } - public CountSection(string header, string description) { RelativeSizeAxes = Axes.X; Width = 0.5f; AutoSizeAxes = Axes.Y; - Padding = new MarginPadding { Horizontal = 10, Top = 10, Bottom = 20 }; + Padding = new MarginPadding { Top = 10, Bottom = 20 }; Child = new FillFlowContainer { AutoSizeAxes = Axes.Y, @@ -96,31 +79,28 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu Spacing = new Vector2(0, 5), Children = new Drawable[] { - new FillFlowContainer + new CircularContainer { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5, 0), - Children = new Drawable[] + Masking = true, + RelativeSizeAxes = Axes.X, + Height = 5, + Child = lineBackground = new Box { - new OsuSpriteText - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Text = header + ":", - Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular, italics: true) - }, - valueText = new OsuSpriteText - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Text = "0", - Font = OsuFont.GetFont(size: 40, weight: FontWeight.Regular, italics: true), - UseFullGlyphHeight = false, - } + RelativeSizeAxes = Axes.Both, } }, - new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 19)) + new OsuSpriteText + { + Text = header, + Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold) + }, + valueText = new OsuSpriteText + { + Text = "0", + Font = OsuFont.GetFont(size: 50, weight: FontWeight.Light), + UseFullGlyphHeight = false, + }, + descriptionText = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 17)) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -129,6 +109,13 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu } }; } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + lineBackground.Colour = colours.Yellow; + descriptionText.Colour = colours.GreySeafoamLighter; + } } } } From 9a13c52ffd860e2c05289ec5fe0a2e27bf06a717 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 29 May 2019 21:19:03 +0300 Subject: [PATCH 2/4] Add missing lines --- osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 87a241936a..c8b803eb98 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -18,6 +18,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu public class KudosuInfo : Container { private readonly Bindable user = new Bindable(); + public KudosuInfo(Bindable user) { this.user.BindTo(user); @@ -54,7 +55,9 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu avaliable.Count = u.NewValue?.Kudosu.Available ?? 0; }; } + protected override bool OnClick(ClickEvent e) => true; + private class CountSection : Container { private readonly OsuSpriteText valueText; @@ -65,6 +68,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu { set => valueText.Text = value.ToString(); } + public CountSection(string header, string description) { RelativeSizeAxes = Axes.X; From e5999dd9b1daa448638ca88c5090c0b0d10b42bb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 May 2019 16:49:18 +0900 Subject: [PATCH 3/4] Update font sizes to match web --- osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index c8b803eb98..a07ecc3bf3 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -96,15 +96,15 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu new OsuSpriteText { Text = header, - Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold) + Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold) }, valueText = new OsuSpriteText { Text = "0", - Font = OsuFont.GetFont(size: 50, weight: FontWeight.Light), + Font = OsuFont.GetFont(size: 40, weight: FontWeight.Light), UseFullGlyphHeight = false, }, - descriptionText = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 17)) + descriptionText = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 14)) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, From c950f37497da2b3bee4f65fbbb32f845ac445c32 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 May 2019 16:57:54 +0900 Subject: [PATCH 4/4] Ad missing link --- .../Profile/Sections/Kudosu/KudosuInfo.cs | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index a07ecc3bf3..aabfa56ee6 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -38,14 +38,8 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu Spacing = new Vector2(5, 0), Children = new[] { - total = new CountSection( - "Total Kudosu Earned", - "Based on how much of a contribution the user has made to beatmap moderation. See this link for more information." - ), - avaliable = new CountSection( - "Kudosu Avaliable", - "Kudosu can be traded for kudosu stars, which will help your beatmap get more attention. This is the number of kudosu you haven't traded in yet." - ), + total = new CountTotal(), + avaliable = new CountAvailable() } } }; @@ -58,10 +52,30 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu protected override bool OnClick(ClickEvent e) => true; + private class CountAvailable : CountSection + { + public CountAvailable() + : base("Kudosu Avaliable") + { + DescriptionText.Text = "Kudosu can be traded for kudosu stars, which will help your beatmap get more attention. This is the number of kudosu you haven't traded in yet."; + } + } + + private class CountTotal : CountSection + { + public CountTotal() + : base("Total Kudosu Earned") + { + DescriptionText.AddText("Based on how much of a contribution the user has made to beatmap moderation. See "); + DescriptionText.AddLink("this link", "https://osu.ppy.sh/wiki/Kudosu"); + DescriptionText.AddText(" for more information."); + } + } + private class CountSection : Container { private readonly OsuSpriteText valueText; - private readonly OsuTextFlowContainer descriptionText; + protected readonly LinkFlowContainer DescriptionText; private readonly Box lineBackground; public new int Count @@ -69,7 +83,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu set => valueText.Text = value.ToString(); } - public CountSection(string header, string description) + public CountSection(string header) { RelativeSizeAxes = Axes.X; Width = 0.5f; @@ -104,11 +118,10 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu Font = OsuFont.GetFont(size: 40, weight: FontWeight.Light), UseFullGlyphHeight = false, }, - descriptionText = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 14)) + DescriptionText = new LinkFlowContainer(t => t.Font = t.Font.With(size: 14)) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Text = description } } }; @@ -118,7 +131,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu private void load(OsuColour colours) { lineBackground.Colour = colours.Yellow; - descriptionText.Colour = colours.GreySeafoamLighter; + DescriptionText.Colour = colours.GreySeafoamLighter; } } }