From c680d636949521f33b8dc2b134af2cdda1e54253 Mon Sep 17 00:00:00 2001 From: jorolf Date: Mon, 25 Feb 2019 23:44:43 +0100 Subject: [PATCH 1/6] Don't show the supporter text if the user already has supporter status --- osu.Game/Screens/Menu/Disclaimer.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index c0ff37cc0b..48f15852ba 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Screens; using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Online.API; using osuTK; using osuTK.Graphics; using osu.Game.Overlays; @@ -39,7 +40,7 @@ namespace osu.Game.Screens.Menu } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, APIAccess api) { InternalChildren = new Drawable[] { @@ -107,6 +108,12 @@ namespace osu.Game.Screens.Menu t.Origin = Anchor.Centre; }).First()); + api.LocalUser.BindValueChanged(user => + { + if (user.IsSupporter) + textFlow.RemoveRange(supporterDrawables); + }, true); + iconColour = colours.Yellow; } From 796044ee7d3dabf1206947cd1c7a2c9b0c02eb8c Mon Sep 17 00:00:00 2001 From: jorolf Date: Mon, 25 Feb 2019 23:53:44 +0100 Subject: [PATCH 2/6] *I should've rechecked the code after the master merge* --- osu.Game/Screens/Menu/Disclaimer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index ccf49d7bd2..09f71da4bc 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -98,7 +98,7 @@ namespace osu.Game.Screens.Menu api.LocalUser.BindValueChanged(user => { - if (user.IsSupporter) + if (user.NewValue.IsSupporter) textFlow.RemoveRange(supporterDrawables); }, true); From 4c10185f5b5a2fbd22bb35e34539491279970401 Mon Sep 17 00:00:00 2001 From: jorolf Date: Tue, 26 Feb 2019 15:26:00 +0100 Subject: [PATCH 3/6] Fade out text instead of removing it immediately --- osu.Game/Screens/Menu/Disclaimer.cs | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 09f71da4bc..ea6abd260a 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Screens; @@ -14,6 +15,7 @@ using osu.Game.Online.API; using osuTK; using osuTK.Graphics; using osu.Game.Overlays; +using osu.Game.Users; namespace osu.Game.Screens.Menu { @@ -34,13 +36,16 @@ namespace osu.Game.Screens.Menu private const float icon_y = -85; + [Resolved] + private APIAccess api { get; set; } + public Disclaimer() { ValidForResume = false; } [BackgroundDependencyLoader] - private void load(OsuColour colours, APIAccess api) + private void load(OsuColour colours) { InternalChildren = new Drawable[] { @@ -96,12 +101,6 @@ namespace osu.Game.Screens.Menu t.Origin = Anchor.Centre; }).First()); - api.LocalUser.BindValueChanged(user => - { - if (user.NewValue.IsSupporter) - textFlow.RemoveRange(supporterDrawables); - }, true); - iconColour = colours.Yellow; } @@ -109,6 +108,8 @@ namespace osu.Game.Screens.Menu { base.LoadComplete(); LoadComponentAsync(intro = new Intro()); + + api.LocalUser.BindValueChanged(userChanged, true); } public override void OnEntering(IScreen last) @@ -134,5 +135,17 @@ namespace osu.Game.Screens.Menu heart.FlashColour(Color4.White, 750, Easing.OutQuint).Loop(); } + + public override void OnSuspending(IScreen next) + { + base.OnSuspending(next); + + api.LocalUser.ValueChanged -= userChanged; + } + + private void userChanged(ValueChangedEvent user) + { + if (user.NewValue.IsSupporter) supporterDrawables.ForEach(d => d.FadeOut(200, Easing.OutQuint).Expire()); + } } } From e8d568470dd21ecc2b8b72ad2dd1f378444953ee Mon Sep 17 00:00:00 2001 From: jorolf Date: Sat, 2 Mar 2019 19:13:38 +0100 Subject: [PATCH 4/6] use a bindable instead --- osu.Game/Screens/Menu/Disclaimer.cs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index a4736e8c60..b8b372fa24 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -36,8 +36,7 @@ namespace osu.Game.Screens.Menu private const float icon_y = -85; - [Resolved] - private APIAccess api { get; set; } + private readonly Bindable currentUser = new Bindable(); public Disclaimer() { @@ -45,7 +44,7 @@ namespace osu.Game.Screens.Menu } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, APIAccess api) { InternalChildren = new Drawable[] { @@ -102,14 +101,19 @@ namespace osu.Game.Screens.Menu }).First()); iconColour = colours.Yellow; + + currentUser.BindTo(api.LocalUser); + currentUser.BindValueChanged(e => + { + if (e.NewValue.IsSupporter) + supporterDrawables.ForEach(d => d.FadeOut(200, Easing.OutQuint).Expire()); + }, true); } protected override void LoadComplete() { base.LoadComplete(); LoadComponentAsync(intro = new Intro()); - - api.LocalUser.BindValueChanged(userChanged, true); } public override void OnEntering(IScreen last) @@ -140,12 +144,7 @@ namespace osu.Game.Screens.Menu { base.OnSuspending(next); - api.LocalUser.ValueChanged -= userChanged; - } - - private void userChanged(ValueChangedEvent user) - { - if (user.NewValue.IsSupporter) supporterDrawables.ForEach(d => d.FadeOut(200, Easing.OutQuint).Expire()); + currentUser.UnbindAll(); } } } From 6ffa139ea8ee7dcbc33a667885c29335d2a0e3d0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 3 Mar 2019 20:02:56 +0900 Subject: [PATCH 5/6] Adjust transition length slightly --- osu.Game/Screens/Menu/Disclaimer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index b8b372fa24..35a1e18097 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -106,7 +106,7 @@ namespace osu.Game.Screens.Menu currentUser.BindValueChanged(e => { if (e.NewValue.IsSupporter) - supporterDrawables.ForEach(d => d.FadeOut(200, Easing.OutQuint).Expire()); + supporterDrawables.ForEach(d => d.FadeOut(500, Easing.OutQuint).Expire()); }, true); } From 08e153208d2340119c54cb59224db9547e14993b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 3 Mar 2019 20:03:22 +0900 Subject: [PATCH 6/6] Unbinds are automatic --- osu.Game/Screens/Menu/Disclaimer.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 35a1e18097..89f4f92092 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -139,12 +139,5 @@ namespace osu.Game.Screens.Menu heart.FlashColour(Color4.White, 750, Easing.OutQuint).Loop(); } - - public override void OnSuspending(IScreen next) - { - base.OnSuspending(next); - - currentUser.UnbindAll(); - } } }