From f00676e6ee8121a6344bd04f3b4814711319429b Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sun, 24 Dec 2017 20:25:23 +0100 Subject: [PATCH 01/31] initial commit to allow filtering / selecting different tabs / etc still wip tho bleh bleh --- osu.Game/Overlays/Social/FilterControl.cs | 2 +- osu.Game/Overlays/Social/Header.cs | 4 +- osu.Game/Overlays/SocialOverlay.cs | 167 +++++++++++++++------- 3 files changed, 119 insertions(+), 54 deletions(-) diff --git a/osu.Game/Overlays/Social/FilterControl.cs b/osu.Game/Overlays/Social/FilterControl.cs index cf4097643e..03acd9bf13 100644 --- a/osu.Game/Overlays/Social/FilterControl.cs +++ b/osu.Game/Overlays/Social/FilterControl.cs @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Social public enum SocialSortCriteria { Rank, - //Location, + Location, //[Description("Time Zone")] //TimeZone, //[Description("World Map")] diff --git a/osu.Game/Overlays/Social/Header.cs b/osu.Game/Overlays/Social/Header.cs index 2674854327..e15b16085b 100644 --- a/osu.Game/Overlays/Social/Header.cs +++ b/osu.Game/Overlays/Social/Header.cs @@ -55,8 +55,8 @@ namespace osu.Game.Overlays.Social { [Description("Online Players")] OnlinePlayers, - //[Description("Online Friends")] - //OnlineFriends, + [Description("Online Friends")] + OnlineFriends, //[Description("Online Team Members")] //OnlineTeamMembers, //[Description("Chat Channels")] diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 954a838461..84469c5e40 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -9,19 +9,23 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; -using osu.Game.Graphics.Cursor; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Overlays.SearchableList; using osu.Game.Overlays.Social; using osu.Game.Users; +using osu.Framework.Configuration; +using osu.Framework.Threading; +using System.Threading.Tasks; namespace osu.Game.Overlays { - public class SocialOverlay : SearchableListOverlay, IOnlineComponent + public class SocialOverlay : SearchableListOverlay { - private readonly FillFlowContainer panelFlow; + private APIAccess api; + + private FillFlowContainer panels; protected override Color4 BackgroundColour => OsuColour.FromHex(@"60284b"); protected override Color4 TrianglesColourLight => OsuColour.FromHex(@"672b51"); @@ -30,28 +34,19 @@ namespace osu.Game.Overlays protected override SearchableListHeader CreateHeader() => new Header(); protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); - private IEnumerable users; private readonly LoadingAnimation loading; + private IEnumerable users; + public IEnumerable Users { get { return users; } set { - if (users?.Equals(value) ?? false) return; - users = value; + if (users?.Equals(value) ?? false) + return; - if (users == null) - panelFlow.Clear(); - else - { - panelFlow.ChildrenEnumerable = users.Select(u => - { - var p = new UserPanel(u) { Width = 300 }; - p.Status.BindTo(u.Status); - return p; - }); - } + users = value?.ToList(); } } @@ -62,59 +57,129 @@ namespace osu.Game.Overlays ThirdWaveColour = OsuColour.FromHex(@"9b2b6e"); FourthWaveColour = OsuColour.FromHex(@"6d214d"); - ScrollFlow.Children = new[] + Add(loading = new LoadingAnimation()); + + Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; + + // TODO sort our list in some way (either locally or with API call) + //Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += rankStatus => Scheduler.AddOnce(updateSearch); + + Header.Tabs.Current.ValueChanged += tab => { - new OsuContextMenuContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Child = panelFlow = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Margin = new MarginPadding { Top = 20 }, - Spacing = new Vector2(10f), - } - }, + currentQuery.Value = string.Empty; + Filter.Tabs.Current.Value = (SocialSortCriteria)Header.Tabs.Current.Value; + Scheduler.AddOnce(updateSearch); }; - Add(loading = new LoadingAnimation()); + currentQuery.ValueChanged += v => + { + queryChangedDebounce?.Cancel(); + + if (string.IsNullOrEmpty(v)) + Scheduler.AddOnce(updateSearch); + else + { + Users = null; + queryChangedDebounce = Scheduler.AddDelayed(updateSearch, 500); + } + }; + + currentQuery.BindTo(Filter.Search.Current); + + Filter.Tabs.Current.ValueChanged += sortCriteria => Scheduler.AddOnce(updateSearch); + + Scheduler.AddOnce(updateSearch); // so it displays something once it's first opened } [BackgroundDependencyLoader] private void load(APIAccess api) { - if (Users == null) - reloadUsers(api); + this.api = api; } - private void reloadUsers(APIAccess api) + private void recreatePanels(PanelDisplayStyle displayStyle) { - Users = null; + if (Users == null) + return; - // no this is not the correct data source, but it's something. - var request = new GetUsersRequest(); - request.Success += res => + if (panels != null) { - Users = res.Select(e => e.User); - loading.Hide(); + panels.FadeOut(200); + panels.Expire(); + panels = null; + } + + var newPanels = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Spacing = new Vector2(10f), + Margin = new MarginPadding { Top = 10 }, + ChildrenEnumerable = Users.Select(u => + { + UserPanel panel = new UserPanel(u); + switch (displayStyle) + { + case PanelDisplayStyle.Grid: + panel.Width = 300; + break; + default: + panel.RelativeSizeAxes = Axes.X; + break; + } + panel.Status.BindTo(u.Status); + return panel; + }) }; - api.Queue(request); - loading.Show(); + LoadComponentAsync(newPanels, p => + { + if (panels != null) + ScrollFlow.Remove(panels); + + ScrollFlow.Add(panels = newPanels); + }); } - public void APIStateChanged(APIAccess api, APIState state) + private GetUsersRequest getUsersRequest; + + private readonly Bindable currentQuery = new Bindable(); + + private ScheduledDelegate queryChangedDebounce; + + private void updateSearch() { - switch (state) + queryChangedDebounce?.Cancel(); + + if (!IsLoaded) + return; + + Users = null; + loading.Hide(); + getUsersRequest?.Cancel(); + + if (api == null || api.State == APIState.Offline) + return; + + getUsersRequest = new GetUsersRequest(); // TODO filter/sort values?!? + + getUsersRequest.Success += response => { - case APIState.Online: - reloadUsers(api); - break; - default: - Users = null; - break; - } + Task.Run(() => + { + var newUsers = response.Select(r => r.User); + + Schedule(() => + { + Users = newUsers; + recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value); + loading.Hide(); + }); + }); + }; + + loading.Show(); + api.Queue(getUsersRequest); } } From e2a1b18a2c32108f386422366c737377021d4978 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Mon, 25 Dec 2017 14:17:35 +0100 Subject: [PATCH 02/31] fix selecting different tab causing filter to change by itself and minor cleanup --- osu.Game/Overlays/SocialOverlay.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 84469c5e40..39b644e469 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -64,12 +64,7 @@ namespace osu.Game.Overlays // TODO sort our list in some way (either locally or with API call) //Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += rankStatus => Scheduler.AddOnce(updateSearch); - Header.Tabs.Current.ValueChanged += tab => - { - currentQuery.Value = string.Empty; - Filter.Tabs.Current.Value = (SocialSortCriteria)Header.Tabs.Current.Value; - Scheduler.AddOnce(updateSearch); - }; + Header.Tabs.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch); currentQuery.ValueChanged += v => { @@ -86,7 +81,7 @@ namespace osu.Game.Overlays currentQuery.BindTo(Filter.Search.Current); - Filter.Tabs.Current.ValueChanged += sortCriteria => Scheduler.AddOnce(updateSearch); + Filter.Tabs.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch); Scheduler.AddOnce(updateSearch); // so it displays something once it's first opened } @@ -99,9 +94,6 @@ namespace osu.Game.Overlays private void recreatePanels(PanelDisplayStyle displayStyle) { - if (Users == null) - return; - if (panels != null) { panels.FadeOut(200); @@ -109,6 +101,9 @@ namespace osu.Game.Overlays panels = null; } + if (Users == null) + return; + var newPanels = new FillFlowContainer { RelativeSizeAxes = Axes.X, From 0fe78bee6ec1e81c17764982ab90e5a530196395 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Mon, 25 Dec 2017 16:11:50 +0100 Subject: [PATCH 03/31] center user panels --- osu.Game/Overlays/SocialOverlay.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 39b644e469..051cf5d6d2 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -112,7 +112,11 @@ namespace osu.Game.Overlays Margin = new MarginPadding { Top = 10 }, ChildrenEnumerable = Users.Select(u => { - UserPanel panel = new UserPanel(u); + UserPanel panel = new UserPanel(u) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre + }; switch (displayStyle) { case PanelDisplayStyle.Grid: From 66f076815f8fa82e4938e369cdb81e7118989a45 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Thu, 28 Dec 2017 19:32:06 +0100 Subject: [PATCH 04/31] query friends endpoint to fetch friendlist --- .../Online/API/Requests/GetFriendsRequest.cs | 13 +++++ osu.Game/Overlays/Social/FilterControl.cs | 2 +- osu.Game/Overlays/SocialOverlay.cs | 58 ++++++++++++------- osu.Game/osu.Game.csproj | 1 + 4 files changed, 53 insertions(+), 21 deletions(-) create mode 100644 osu.Game/Online/API/Requests/GetFriendsRequest.cs diff --git a/osu.Game/Online/API/Requests/GetFriendsRequest.cs b/osu.Game/Online/API/Requests/GetFriendsRequest.cs new file mode 100644 index 0000000000..a06471fd74 --- /dev/null +++ b/osu.Game/Online/API/Requests/GetFriendsRequest.cs @@ -0,0 +1,13 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using osu.Game.Users; + +namespace osu.Game.Online.API.Requests +{ + public class GetFriendsRequest : APIRequest> + { + protected override string Target => @"friends"; + } +} diff --git a/osu.Game/Overlays/Social/FilterControl.cs b/osu.Game/Overlays/Social/FilterControl.cs index 03acd9bf13..cf4097643e 100644 --- a/osu.Game/Overlays/Social/FilterControl.cs +++ b/osu.Game/Overlays/Social/FilterControl.cs @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Social public enum SocialSortCriteria { Rank, - Location, + //Location, //[Description("Time Zone")] //TimeZone, //[Description("World Map")] diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 051cf5d6d2..3d62775c84 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -64,7 +64,7 @@ namespace osu.Game.Overlays // TODO sort our list in some way (either locally or with API call) //Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += rankStatus => Scheduler.AddOnce(updateSearch); - Header.Tabs.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch); + Header.Tabs.Current.ValueChanged += tab => Scheduler.AddOnce(updateSearch); currentQuery.ValueChanged += v => { @@ -81,7 +81,7 @@ namespace osu.Game.Overlays currentQuery.BindTo(Filter.Search.Current); - Filter.Tabs.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch); + Filter.Tabs.Current.ValueChanged += sortCriteria => Scheduler.AddOnce(updateSearch); Scheduler.AddOnce(updateSearch); // so it displays something once it's first opened } @@ -141,6 +141,7 @@ namespace osu.Game.Overlays } private GetUsersRequest getUsersRequest; + private GetFriendsRequest getFriendsRequest; private readonly Bindable currentQuery = new Bindable(); @@ -155,33 +156,50 @@ namespace osu.Game.Overlays Users = null; loading.Hide(); - getUsersRequest?.Cancel(); + clearRequests(); if (api == null || api.State == APIState.Offline) return; - getUsersRequest = new GetUsersRequest(); // TODO filter/sort values?!? - - getUsersRequest.Success += response => + switch (Header.Tabs.Current.Value) { - Task.Run(() => - { - var newUsers = response.Select(r => r.User); - - Schedule(() => - { - Users = newUsers; - recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value); - loading.Hide(); - }); - }); - }; - + case SocialTab.OnlinePlayers: + getUsersRequest = new GetUsersRequest(); // TODO filter??? + getUsersRequest.Success += response => finishRequest(response.Select(r => r.User)); + queueRequest(getUsersRequest); + break; + case SocialTab.OnlineFriends: + getFriendsRequest = new GetFriendsRequest(); // TODO filter??? + getFriendsRequest.Success += finishRequest; + queueRequest(getFriendsRequest); + break; + } loading.Show(); - api.Queue(getUsersRequest); } + + private void clearRequests() + { + getUsersRequest?.Cancel(); + getFriendsRequest?.Cancel(); + } + + private void finishRequest(IEnumerable newUsers) + { + Task.Run(() => + { + Schedule(() => + { + Users = newUsers; + recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value); + loading.Hide(); + }); + }); + } + + private void queueRequest(APIRequest request) => api.Queue(request); } + public enum SortDirection { Descending, diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 94678106bf..29deea5771 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -268,6 +268,7 @@ + From 53cd47a192cfc051279c358c5f4d52864e98cc56 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Thu, 28 Dec 2017 19:34:49 +0100 Subject: [PATCH 05/31] Updated submodule osu-resources --- osu-resources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-resources b/osu-resources index 4287ee8043..e01f71160f 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 4287ee8043fb1419017359bc3a5db5dc06bc643f +Subproject commit e01f71160fb9b3167efcd177c7d7dba9e5d36604 From 7ecc693e3492296ace03aa0e37d271e3b92349ac Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Thu, 28 Dec 2017 19:35:29 +0100 Subject: [PATCH 06/31] Updated submodule osu-framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 08f85f9bf9..10cae790c6 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 08f85f9bf9a7376aec8dfcde8c7c96d267d8c295 +Subproject commit 10cae790c6f1d559c326f9438958d0b012d61dc6 From 8a02900c014be3b2117fef243aa099e0d7deff14 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 30 Dec 2017 11:33:06 +0100 Subject: [PATCH 07/31] changed titles from social tabs --- osu.Game/Overlays/Social/Header.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Social/Header.cs b/osu.Game/Overlays/Social/Header.cs index e15b16085b..94368d9786 100644 --- a/osu.Game/Overlays/Social/Header.cs +++ b/osu.Game/Overlays/Social/Header.cs @@ -53,9 +53,9 @@ namespace osu.Game.Overlays.Social public enum SocialTab { - [Description("Online Players")] + [Description("Players")] OnlinePlayers, - [Description("Online Friends")] + [Description("Friends")] OnlineFriends, //[Description("Online Team Members")] //OnlineTeamMembers, From 72af5bf67242133655655777e487e3f9ae1521e1 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 30 Dec 2017 11:51:49 +0100 Subject: [PATCH 08/31] simplify socialoverlay user request structure --- osu.Game/Overlays/SocialOverlay.cs | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 3d62775c84..219672b76d 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -140,8 +140,7 @@ namespace osu.Game.Overlays }); } - private GetUsersRequest getUsersRequest; - private GetFriendsRequest getFriendsRequest; + private APIRequest getUsersRequest; private readonly Bindable currentQuery = new Bindable(); @@ -156,7 +155,7 @@ namespace osu.Game.Overlays Users = null; loading.Hide(); - clearRequests(); + getUsersRequest?.Cancel(); if (api == null || api.State == APIState.Offline) return; @@ -165,24 +164,17 @@ namespace osu.Game.Overlays { case SocialTab.OnlinePlayers: getUsersRequest = new GetUsersRequest(); // TODO filter??? - getUsersRequest.Success += response => finishRequest(response.Select(r => r.User)); - queueRequest(getUsersRequest); + ((GetUsersRequest)getUsersRequest).Success += response => finishRequest(response.Select(r => r.User)); break; case SocialTab.OnlineFriends: - getFriendsRequest = new GetFriendsRequest(); // TODO filter??? - getFriendsRequest.Success += finishRequest; - queueRequest(getFriendsRequest); + getUsersRequest = new GetFriendsRequest(); // TODO filter??? + ((GetFriendsRequest)getUsersRequest).Success += finishRequest; break; } + api.Queue(getUsersRequest); loading.Show(); } - private void clearRequests() - { - getUsersRequest?.Cancel(); - getFriendsRequest?.Cancel(); - } - private void finishRequest(IEnumerable newUsers) { Task.Run(() => @@ -195,11 +187,8 @@ namespace osu.Game.Overlays }); }); } - - private void queueRequest(APIRequest request) => api.Queue(request); } - public enum SortDirection { Descending, From d37ba2c9a4b51853de432cba3f1d1992f8a7001c Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 30 Dec 2017 11:54:03 +0100 Subject: [PATCH 09/31] disable searching/filtering with textbox it doesn't do anything except from creating unnecessary requests for now --- osu.Game/Overlays/SocialOverlay.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 219672b76d..a65e2f9e77 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -66,18 +66,18 @@ namespace osu.Game.Overlays Header.Tabs.Current.ValueChanged += tab => Scheduler.AddOnce(updateSearch); - currentQuery.ValueChanged += v => - { - queryChangedDebounce?.Cancel(); + //currentQuery.ValueChanged += v => + //{ + // queryChangedDebounce?.Cancel(); - if (string.IsNullOrEmpty(v)) - Scheduler.AddOnce(updateSearch); - else - { - Users = null; - queryChangedDebounce = Scheduler.AddDelayed(updateSearch, 500); - } - }; + // if (string.IsNullOrEmpty(v)) + // Scheduler.AddOnce(updateSearch); + // else + // { + // Users = null; + // queryChangedDebounce = Scheduler.AddDelayed(updateSearch, 500); + // } + //}; currentQuery.BindTo(Filter.Search.Current); From 760d2aff4bdbd73f33ac10a9ed0858048657220f Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 30 Dec 2017 12:56:18 +0100 Subject: [PATCH 10/31] readd IOnlineComponent to be able to react to APIState changes --- osu.Game/Overlays/SocialOverlay.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index a65e2f9e77..3dafecc6df 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -21,7 +21,7 @@ using System.Threading.Tasks; namespace osu.Game.Overlays { - public class SocialOverlay : SearchableListOverlay + public class SocialOverlay : SearchableListOverlay, IOnlineComponent { private APIAccess api; @@ -90,6 +90,7 @@ namespace osu.Game.Overlays private void load(APIAccess api) { this.api = api; + api.Register(this); } private void recreatePanels(PanelDisplayStyle displayStyle) @@ -187,6 +188,20 @@ namespace osu.Game.Overlays }); }); } + + public void APIStateChanged(APIAccess api, APIState state) + { + switch (state) + { + case APIState.Online: + Scheduler.AddOnce(updateSearch); + break; + default: + Users = null; + recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value); + break; + } + } } public enum SortDirection From f03e064c430479080fc2dc70d37e4050505584a5 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 30 Dec 2017 12:57:32 +0100 Subject: [PATCH 11/31] remove unnecessary update --- osu.Game/Overlays/SocialOverlay.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 3dafecc6df..d2f56f4061 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -82,8 +82,6 @@ namespace osu.Game.Overlays currentQuery.BindTo(Filter.Search.Current); Filter.Tabs.Current.ValueChanged += sortCriteria => Scheduler.AddOnce(updateSearch); - - Scheduler.AddOnce(updateSearch); // so it displays something once it's first opened } [BackgroundDependencyLoader] From 8957d82c894e38a598dc600edf96cffc013a33f9 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Mon, 1 Jan 2018 13:54:59 +0100 Subject: [PATCH 12/31] Updated submodule osu-framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 10cae790c6..6134dafccb 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 10cae790c6f1d559c326f9438958d0b012d61dc6 +Subproject commit 6134dafccb3368dac96d837537325c04b89fb8ee From a00f92dcb459eb1354bd691b0f1e4c13151e5cc0 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Tue, 2 Jan 2018 17:18:49 +0100 Subject: [PATCH 13/31] change unnecessary cast --- osu.Game/Overlays/SocialOverlay.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index d2f56f4061..024e3aee73 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -162,15 +162,16 @@ namespace osu.Game.Overlays switch (Header.Tabs.Current.Value) { case SocialTab.OnlinePlayers: - getUsersRequest = new GetUsersRequest(); // TODO filter??? - ((GetUsersRequest)getUsersRequest).Success += response => finishRequest(response.Select(r => r.User)); + var userRequest = new GetUsersRequest(); // TODO filter??? + userRequest.Success += response => finishRequest(response.Select(r => r.User)); + api.Queue(getUsersRequest = userRequest); break; case SocialTab.OnlineFriends: - getUsersRequest = new GetFriendsRequest(); // TODO filter??? - ((GetFriendsRequest)getUsersRequest).Success += finishRequest; + var friendRequest = new GetFriendsRequest(); // TODO filter??? + friendRequest.Success += finishRequest; + api.Queue(getUsersRequest = friendRequest); break; } - api.Queue(getUsersRequest); loading.Show(); } From 313dfd4d46a9b05d72cbaab2679baebe6b3cc616 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Tue, 2 Jan 2018 17:22:12 +0100 Subject: [PATCH 14/31] remove unnecessary task + rename method --- osu.Game/Overlays/SocialOverlay.cs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 024e3aee73..b72fddc908 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -163,28 +163,25 @@ namespace osu.Game.Overlays { case SocialTab.OnlinePlayers: var userRequest = new GetUsersRequest(); // TODO filter??? - userRequest.Success += response => finishRequest(response.Select(r => r.User)); + userRequest.Success += response => updateUsers(response.Select(r => r.User)); api.Queue(getUsersRequest = userRequest); break; case SocialTab.OnlineFriends: var friendRequest = new GetFriendsRequest(); // TODO filter??? - friendRequest.Success += finishRequest; + friendRequest.Success += updateUsers; api.Queue(getUsersRequest = friendRequest); break; } loading.Show(); } - private void finishRequest(IEnumerable newUsers) + private void updateUsers(IEnumerable newUsers) { - Task.Run(() => + Schedule(() => { - Schedule(() => - { - Users = newUsers; - recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value); - loading.Hide(); - }); + Users = newUsers; + recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value); + loading.Hide(); }); } From 52c2ba49cf32415b875f3b62f32ffd0258b7cbe8 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Tue, 2 Jan 2018 17:42:44 +0100 Subject: [PATCH 15/31] make loading indicator more visible by deleting panels preemptively --- osu.Game/Overlays/SocialOverlay.cs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index b72fddc908..d9cbdf37c8 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -93,12 +93,7 @@ namespace osu.Game.Overlays private void recreatePanels(PanelDisplayStyle displayStyle) { - if (panels != null) - { - panels.FadeOut(200); - panels.Expire(); - panels = null; - } + clearPanels(); if (Users == null) return; @@ -139,6 +134,15 @@ namespace osu.Game.Overlays }); } + private void clearPanels() + { + if (panels != null) + { + panels.Expire(); + panels = null; + } + } + private APIRequest getUsersRequest; private readonly Bindable currentQuery = new Bindable(); @@ -153,10 +157,11 @@ namespace osu.Game.Overlays return; Users = null; + clearPanels(); loading.Hide(); getUsersRequest?.Cancel(); - if (api == null || api.State == APIState.Offline) + if (api?.IsLoggedIn == false) return; switch (Header.Tabs.Current.Value) @@ -180,8 +185,8 @@ namespace osu.Game.Overlays Schedule(() => { Users = newUsers; - recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value); loading.Hide(); + recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value); }); } From 699902234b395294f36dea482568ff1c1ac3507e Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Tue, 2 Jan 2018 17:58:11 +0100 Subject: [PATCH 16/31] remove unused code --- osu.Game/Overlays/SocialOverlay.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index d9cbdf37c8..979ce2c851 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -15,9 +15,6 @@ using osu.Game.Online.API.Requests; using osu.Game.Overlays.SearchableList; using osu.Game.Overlays.Social; using osu.Game.Users; -using osu.Framework.Configuration; -using osu.Framework.Threading; -using System.Threading.Tasks; namespace osu.Game.Overlays { @@ -79,7 +76,7 @@ namespace osu.Game.Overlays // } //}; - currentQuery.BindTo(Filter.Search.Current); + //currentQuery.BindTo(Filter.Search.Current); Filter.Tabs.Current.ValueChanged += sortCriteria => Scheduler.AddOnce(updateSearch); } @@ -145,13 +142,13 @@ namespace osu.Game.Overlays private APIRequest getUsersRequest; - private readonly Bindable currentQuery = new Bindable(); + //private readonly Bindable currentQuery = new Bindable(); - private ScheduledDelegate queryChangedDebounce; + //private ScheduledDelegate queryChangedDebounce; private void updateSearch() { - queryChangedDebounce?.Cancel(); + //queryChangedDebounce?.Cancel(); if (!IsLoaded) return; From 0e361aefebba2fc1d44d56313c7fc4b258a14756 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Wed, 3 Jan 2018 17:52:11 +0100 Subject: [PATCH 17/31] added new tabs and sort criteria --- osu.Game/Overlays/Social/FilterControl.cs | 2 ++ osu.Game/Overlays/Social/Header.cs | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Social/FilterControl.cs b/osu.Game/Overlays/Social/FilterControl.cs index cf4097643e..a4d623892d 100644 --- a/osu.Game/Overlays/Social/FilterControl.cs +++ b/osu.Game/Overlays/Social/FilterControl.cs @@ -21,7 +21,9 @@ namespace osu.Game.Overlays.Social public enum SocialSortCriteria { + Relevance, Rank, + Name, //Location, //[Description("Time Zone")] //TimeZone, diff --git a/osu.Game/Overlays/Social/Header.cs b/osu.Game/Overlays/Social/Header.cs index 94368d9786..7dd8222b0b 100644 --- a/osu.Game/Overlays/Social/Header.cs +++ b/osu.Game/Overlays/Social/Header.cs @@ -18,6 +18,7 @@ namespace osu.Game.Overlays.Social protected override Color4 BackgroundColour => OsuColour.FromHex(@"38202e"); protected override float TabStripWidth => 438; + protected override SocialTab DefaultTab => SocialTab.OnlinePlayers; protected override FontAwesome Icon => FontAwesome.fa_users; @@ -53,10 +54,11 @@ namespace osu.Game.Overlays.Social public enum SocialTab { + Search, [Description("Players")] - OnlinePlayers, + OnlinePlayers = SocialSortCriteria.Rank, [Description("Friends")] - OnlineFriends, + OnlineFriends = SocialSortCriteria.Name, //[Description("Online Team Members")] //OnlineTeamMembers, //[Description("Chat Channels")] From 988f6ac90128845153b30976b84f4dd62396898a Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Wed, 3 Jan 2018 17:53:50 +0100 Subject: [PATCH 18/31] fix SortDirection default to descending when retrieved data is ascending --- osu.Game.Tests/Visual/TestCaseSocial.cs | 9 +++++++++ osu.Game/Overlays/SocialOverlay.cs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseSocial.cs b/osu.Game.Tests/Visual/TestCaseSocial.cs index ff0707c8ab..3f418174c7 100644 --- a/osu.Game.Tests/Visual/TestCaseSocial.cs +++ b/osu.Game.Tests/Visual/TestCaseSocial.cs @@ -1,13 +1,22 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using System.Collections.Generic; using osu.Game.Overlays; +using osu.Game.Overlays.Social; using osu.Game.Users; namespace osu.Game.Tests.Visual { public class TestCaseSocial : OsuTestCase { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(FilterControl), + typeof(SocialOverlay) + }; + public TestCaseSocial() { SocialOverlay s = new SocialOverlay diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 979ce2c851..a0c4c2b18f 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -204,7 +204,7 @@ namespace osu.Game.Overlays public enum SortDirection { - Descending, Ascending, + Descending } } From 9d29adce27c5501bc89afbf7e1dcc7c64dee1281 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Wed, 3 Jan 2018 17:54:20 +0100 Subject: [PATCH 19/31] bring social tab+filter behaviour closer to direct --- osu.Game/Overlays/SocialOverlay.cs | 65 ++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 22 deletions(-) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index a0c4c2b18f..c4ed14022e 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays public class SocialOverlay : SearchableListOverlay, IOnlineComponent { private APIAccess api; - + private readonly LoadingAnimation loading; private FillFlowContainer panels; protected override Color4 BackgroundColour => OsuColour.FromHex(@"60284b"); @@ -31,10 +31,7 @@ namespace osu.Game.Overlays protected override SearchableListHeader CreateHeader() => new Header(); protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); - private readonly LoadingAnimation loading; - private IEnumerable users; - public IEnumerable Users { get { return users; } @@ -56,12 +53,38 @@ namespace osu.Game.Overlays Add(loading = new LoadingAnimation()); + Filter.Search.Current.ValueChanged += text => + { + if (text != string.Empty) + { + Header.Tabs.Current.Value = SocialTab.Search; + + if (Filter.Tabs.Current.Value == SocialSortCriteria.Rank) + Filter.Tabs.Current.Value = SocialSortCriteria.Relevance; + } + else + { + Header.Tabs.Current.Value = SocialTab.OnlinePlayers; + + if (Filter.Tabs.Current.Value == SocialSortCriteria.Relevance) + Filter.Tabs.Current.Value = SocialSortCriteria.Rank; + } + }; + Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; // TODO sort our list in some way (either locally or with API call) - //Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += rankStatus => Scheduler.AddOnce(updateSearch); + //Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += sortOrder => Scheduler.AddOnce(updateSearch); - Header.Tabs.Current.ValueChanged += tab => Scheduler.AddOnce(updateSearch); + Header.Tabs.Current.ValueChanged += tab => + { + if (tab != SocialTab.Search) + { + //currentQuery.Value = string.Empty; + Filter.Tabs.Current.Value = (SocialSortCriteria)Header.Tabs.Current.Value; + Scheduler.AddOnce(updateSearch); + } + }; //currentQuery.ValueChanged += v => //{ @@ -70,15 +93,18 @@ namespace osu.Game.Overlays // if (string.IsNullOrEmpty(v)) // Scheduler.AddOnce(updateSearch); // else - // { - // Users = null; // queryChangedDebounce = Scheduler.AddDelayed(updateSearch, 500); - // } //}; //currentQuery.BindTo(Filter.Search.Current); - Filter.Tabs.Current.ValueChanged += sortCriteria => Scheduler.AddOnce(updateSearch); + Filter.Tabs.Current.ValueChanged += sortCriteria => + { + if (Header.Tabs.Current.Value != SocialTab.Search && sortCriteria != (SocialSortCriteria)Header.Tabs.Current.Value) + Header.Tabs.Current.Value = SocialTab.Search; + + Scheduler.AddOnce(updateSearch); + }; } [BackgroundDependencyLoader] @@ -122,19 +148,14 @@ namespace osu.Game.Overlays }) }; - LoadComponentAsync(newPanels, p => - { - if (panels != null) - ScrollFlow.Remove(panels); - - ScrollFlow.Add(panels = newPanels); - }); + LoadComponentAsync(newPanels, p => ScrollFlow.Add(panels = newPanels)); } private void clearPanels() { if (panels != null) { + ScrollFlow.Remove(panels); panels.Expire(); panels = null; } @@ -163,16 +184,16 @@ namespace osu.Game.Overlays switch (Header.Tabs.Current.Value) { - case SocialTab.OnlinePlayers: - var userRequest = new GetUsersRequest(); // TODO filter??? - userRequest.Success += response => updateUsers(response.Select(r => r.User)); - api.Queue(getUsersRequest = userRequest); - break; case SocialTab.OnlineFriends: var friendRequest = new GetFriendsRequest(); // TODO filter??? friendRequest.Success += updateUsers; api.Queue(getUsersRequest = friendRequest); break; + default: + var userRequest = new GetUsersRequest(); // TODO filter??? + userRequest.Success += response => updateUsers(response.Select(r => r.User)); + api.Queue(getUsersRequest = userRequest); + break; } loading.Show(); } From 9b70578af621783aabe280495047d12a11021d65 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Wed, 3 Jan 2018 19:01:10 +0100 Subject: [PATCH 20/31] enabled Location as filter tab forgot it QQ --- osu.Game/Overlays/Social/FilterControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Social/FilterControl.cs b/osu.Game/Overlays/Social/FilterControl.cs index a4d623892d..bb60aaac51 100644 --- a/osu.Game/Overlays/Social/FilterControl.cs +++ b/osu.Game/Overlays/Social/FilterControl.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Social Relevance, Rank, Name, - //Location, + Location, //[Description("Time Zone")] //TimeZone, //[Description("World Map")] From d0c9d71ee79bdb0f5ef786de3eba25276aa7905a Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Thu, 4 Jan 2018 08:15:11 +0100 Subject: [PATCH 21/31] fix covers not showing in user panels --- osu.Game/Users/User.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 5c0e5f1f95..d4bdc05337 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -39,10 +39,14 @@ namespace osu.Game.Users public string AvatarUrl; [JsonProperty(@"cover_url")] - public string CoverUrl; + public string CoverUrl + { + get { return Cover?.Url; } + set { Cover = new UserCover { Url = value }; } + } - //[JsonProperty(@"cover")] - //public UserCover Cover; + [JsonProperty(@"cover")] + public UserCover Cover; public class UserCover { From bf64b8fc6966e496aadf8a747ccc47ef93d3fc29 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Thu, 4 Jan 2018 11:41:06 +0100 Subject: [PATCH 22/31] added hover effects to panels in social at least partially QQ --- osu.Game.Tests/Visual/TestCaseSocial.cs | 6 ++- osu.Game/Overlays/Social/SocialGridPanel.cs | 15 ++++++ osu.Game/Overlays/Social/SocialListPanel.cs | 16 ++++++ osu.Game/Overlays/Social/SocialPanel.cs | 60 +++++++++++++++++++++ osu.Game/Overlays/SocialOverlay.cs | 30 ++++++----- osu.Game/Users/UpdateableAvatar.cs | 2 +- osu.Game/Users/UserPanel.cs | 8 +-- osu.Game/osu.Game.csproj | 3 ++ 8 files changed, 123 insertions(+), 17 deletions(-) create mode 100644 osu.Game/Overlays/Social/SocialGridPanel.cs create mode 100644 osu.Game/Overlays/Social/SocialListPanel.cs create mode 100644 osu.Game/Overlays/Social/SocialPanel.cs diff --git a/osu.Game.Tests/Visual/TestCaseSocial.cs b/osu.Game.Tests/Visual/TestCaseSocial.cs index 3f418174c7..631f08254f 100644 --- a/osu.Game.Tests/Visual/TestCaseSocial.cs +++ b/osu.Game.Tests/Visual/TestCaseSocial.cs @@ -13,8 +13,12 @@ namespace osu.Game.Tests.Visual { public override IReadOnlyList RequiredTypes => new[] { + typeof(UserPanel), + typeof(SocialPanel), typeof(FilterControl), - typeof(SocialOverlay) + typeof(SocialOverlay), + typeof(SocialGridPanel), + typeof(SocialListPanel) }; public TestCaseSocial() diff --git a/osu.Game/Overlays/Social/SocialGridPanel.cs b/osu.Game/Overlays/Social/SocialGridPanel.cs new file mode 100644 index 0000000000..b2c6b75ab2 --- /dev/null +++ b/osu.Game/Overlays/Social/SocialGridPanel.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Users; + +namespace osu.Game.Overlays.Social +{ + public class SocialGridPanel : SocialPanel + { + public SocialGridPanel(User user) : base(user) + { + Width = 300; + } + } +} diff --git a/osu.Game/Overlays/Social/SocialListPanel.cs b/osu.Game/Overlays/Social/SocialListPanel.cs new file mode 100644 index 0000000000..f65fbe8142 --- /dev/null +++ b/osu.Game/Overlays/Social/SocialListPanel.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Game.Users; + +namespace osu.Game.Overlays.Social +{ + public class SocialListPanel : SocialPanel + { + public SocialListPanel(User user) : base(user) + { + RelativeSizeAxes = Axes.X; + } + } +} diff --git a/osu.Game/Overlays/Social/SocialPanel.cs b/osu.Game/Overlays/Social/SocialPanel.cs new file mode 100644 index 0000000000..234640482e --- /dev/null +++ b/osu.Game/Overlays/Social/SocialPanel.cs @@ -0,0 +1,60 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Input; +using osu.Game.Users; + +namespace osu.Game.Overlays.Social +{ + public class SocialPanel : UserPanel + { + private const double hover_transition_time = 400; + + public SocialPanel(User user) : base(user) + { + } + + private readonly EdgeEffectParameters edgeEffectNormal = new EdgeEffectParameters + { + Type = EdgeEffectType.Shadow, + Offset = new Vector2(0f, 1f), + Radius = 2f, + Colour = Color4.Black.Opacity(0.25f), + }; + + private readonly EdgeEffectParameters edgeEffectHovered = new EdgeEffectParameters + { + Type = EdgeEffectType.Shadow, + Offset = new Vector2(0f, 5f), + Radius = 10f, + Colour = Color4.Black.Opacity(0.3f), + }; + + protected override bool OnHover(InputState state) + { + TweenEdgeEffectTo(edgeEffectHovered, hover_transition_time, Easing.OutQuint); + //Content.MoveToY(-4, hover_transition_time, Easing.OutQuint); + + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint); + //Content.MoveToY(0, hover_transition_time, Easing.OutQuint); + + base.OnHoverLost(state); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + this.FadeInFromZero(200, Easing.Out); + } + } +} diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index c4ed14022e..823e264ebe 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -22,7 +22,7 @@ namespace osu.Game.Overlays { private APIAccess api; private readonly LoadingAnimation loading; - private FillFlowContainer panels; + private FillFlowContainer panels; protected override Color4 BackgroundColour => OsuColour.FromHex(@"60284b"); protected override Color4 TrianglesColourLight => OsuColour.FromHex(@"672b51"); @@ -121,7 +121,7 @@ namespace osu.Game.Overlays if (Users == null) return; - var newPanels = new FillFlowContainer + var newPanels = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -129,18 +129,18 @@ namespace osu.Game.Overlays Margin = new MarginPadding { Top = 10 }, ChildrenEnumerable = Users.Select(u => { - UserPanel panel = new UserPanel(u) - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre - }; + SocialPanel panel; switch (displayStyle) { case PanelDisplayStyle.Grid: - panel.Width = 300; + panel = new SocialGridPanel(u) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre + }; break; default: - panel.RelativeSizeAxes = Axes.X; + panel = new SocialListPanel(u); break; } panel.Status.BindTo(u.Status); @@ -148,14 +148,20 @@ namespace osu.Game.Overlays }) }; - LoadComponentAsync(newPanels, p => ScrollFlow.Add(panels = newPanels)); + LoadComponentAsync(newPanels, p => + { + if(panels != null) + ScrollFlow.Remove(panels); + + ScrollFlow.Add(panels = newPanels); + }); } private void clearPanels() { if (panels != null) { - ScrollFlow.Remove(panels); + panels.FadeOut(200); panels.Expire(); panels = null; } @@ -185,7 +191,7 @@ namespace osu.Game.Overlays switch (Header.Tabs.Current.Value) { case SocialTab.OnlineFriends: - var friendRequest = new GetFriendsRequest(); // TODO filter??? + var friendRequest = new GetFriendsRequest(); friendRequest.Success += updateUsers; api.Queue(getUsersRequest = friendRequest); break; diff --git a/osu.Game/Users/UpdateableAvatar.cs b/osu.Game/Users/UpdateableAvatar.cs index d55c0caad7..455856a6d4 100644 --- a/osu.Game/Users/UpdateableAvatar.cs +++ b/osu.Game/Users/UpdateableAvatar.cs @@ -44,7 +44,7 @@ namespace osu.Game.Users new Avatar(user) { RelativeSizeAxes = Axes.Both, - OnLoadComplete = d => d.FadeInFromZero(200), + OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), }) ); } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index e0a4e3184d..6690c38eca 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -65,8 +65,8 @@ namespace osu.Game.Users Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, - OnLoadComplete = d => d.FadeInFromZero(200), - }, 0) { RelativeSizeAxes = Axes.Both }, + OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out) + }, 300) { RelativeSizeAxes = Axes.Both }, new Box { RelativeSizeAxes = Axes.Both, @@ -76,7 +76,7 @@ namespace osu.Game.Users { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Top = content_padding, Left = content_padding, Right = content_padding }, + Padding = new MarginPadding { Top = content_padding, Horizontal = content_padding }, Children = new Drawable[] { new UpdateableAvatar @@ -167,11 +167,13 @@ namespace osu.Game.Users }; if (user.IsSupporter) + { infoContainer.Add(new SupporterIcon { RelativeSizeAxes = Axes.Y, Width = 20f, }); + } } [BackgroundDependencyLoader(permitNulls: true)] diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 49978693b3..dfc2120b89 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -311,6 +311,9 @@ + + + From 844c428fa7ead72a64422800feadc96fe95915ae Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Thu, 4 Jan 2018 11:49:03 +0100 Subject: [PATCH 23/31] Updated submodule osu-framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 6134dafccb..66421b8944 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 6134dafccb3368dac96d837537325c04b89fb8ee +Subproject commit 66421b894444cb9c4b792f9b93a786dcff5589dd From 57b44b8c29808fca00a10b4766ea7ebed6b1ed2a Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 6 Jan 2018 10:40:18 +0100 Subject: [PATCH 24/31] fix new panels appearing too soon --- osu.Game/Overlays/SocialOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 823e264ebe..fb111a64d2 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -153,7 +153,7 @@ namespace osu.Game.Overlays if(panels != null) ScrollFlow.Remove(panels); - ScrollFlow.Add(panels = newPanels); + Scheduler.AddDelayed(() => ScrollFlow.Add(panels = newPanels), 200); }); } From 82dcb033deaaee2bacc2476b01da2812b46217e1 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 6 Jan 2018 10:47:56 +0100 Subject: [PATCH 25/31] update submodules --- osu-framework | 2 +- osu-resources | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu-framework b/osu-framework index 66421b8944..80bcb82ef8 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 66421b894444cb9c4b792f9b93a786dcff5589dd +Subproject commit 80bcb82ef8d2e1af1ce077f4a037b6d279ad9e74 diff --git a/osu-resources b/osu-resources index e01f71160f..7724abdf1d 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit e01f71160fb9b3167efcd177c7d7dba9e5d36604 +Subproject commit 7724abdf1d7c9705ba2e3989a9c604e17ccdc871 From a61666d2a732727317f22290a3c85f02b2067440 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 6 Jan 2018 10:54:53 +0100 Subject: [PATCH 26/31] update licence headers --- osu.Game/Online/API/Requests/GetFriendsRequest.cs | 2 +- osu.Game/Overlays/Social/SocialGridPanel.cs | 2 +- osu.Game/Overlays/Social/SocialListPanel.cs | 2 +- osu.Game/Overlays/Social/SocialPanel.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetFriendsRequest.cs b/osu.Game/Online/API/Requests/GetFriendsRequest.cs index a06471fd74..5bc3d8e39e 100644 --- a/osu.Game/Online/API/Requests/GetFriendsRequest.cs +++ b/osu.Game/Online/API/Requests/GetFriendsRequest.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . +// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; diff --git a/osu.Game/Overlays/Social/SocialGridPanel.cs b/osu.Game/Overlays/Social/SocialGridPanel.cs index b2c6b75ab2..f9fbce123d 100644 --- a/osu.Game/Overlays/Social/SocialGridPanel.cs +++ b/osu.Game/Overlays/Social/SocialGridPanel.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . +// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Users; diff --git a/osu.Game/Overlays/Social/SocialListPanel.cs b/osu.Game/Overlays/Social/SocialListPanel.cs index f65fbe8142..0f102005d6 100644 --- a/osu.Game/Overlays/Social/SocialListPanel.cs +++ b/osu.Game/Overlays/Social/SocialListPanel.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . +// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Social/SocialPanel.cs b/osu.Game/Overlays/Social/SocialPanel.cs index 234640482e..2e0b7e6df2 100644 --- a/osu.Game/Overlays/Social/SocialPanel.cs +++ b/osu.Game/Overlays/Social/SocialPanel.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . +// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; From d9866a2052b5bbcc42d8537b754cc3f9e19521c6 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 6 Jan 2018 11:27:17 +0100 Subject: [PATCH 27/31] fix hover effects on social panels --- osu.Game/Overlays/Social/SocialPanel.cs | 8 +- osu.Game/Users/UserPanel.cs | 212 ++++++++++++------------ 2 files changed, 114 insertions(+), 106 deletions(-) diff --git a/osu.Game/Overlays/Social/SocialPanel.cs b/osu.Game/Overlays/Social/SocialPanel.cs index 2e0b7e6df2..54fb88f929 100644 --- a/osu.Game/Overlays/Social/SocialPanel.cs +++ b/osu.Game/Overlays/Social/SocialPanel.cs @@ -37,16 +37,16 @@ namespace osu.Game.Overlays.Social protected override bool OnHover(InputState state) { - TweenEdgeEffectTo(edgeEffectHovered, hover_transition_time, Easing.OutQuint); - //Content.MoveToY(-4, hover_transition_time, Easing.OutQuint); + Content.TweenEdgeEffectTo(edgeEffectHovered, hover_transition_time, Easing.OutQuint); + Content.MoveToY(-4, hover_transition_time, Easing.OutQuint); return base.OnHover(state); } protected override void OnHoverLost(InputState state) { - TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint); - //Content.MoveToY(0, hover_transition_time, Easing.OutQuint); + Content.TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint); + Content.MoveToY(0, hover_transition_time, Easing.OutQuint); base.OnHoverLost(state); } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 839c62ea40..c62ba392b8 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -28,9 +28,12 @@ namespace osu.Game.Users private const float content_padding = 10; private const float status_height = 30; - private readonly Container statusBar; - private readonly Box statusBg; - private readonly OsuSpriteText statusMessage; + private Container statusBar; + private Box statusBg; + private OsuSpriteText statusMessage; + + private Container content; + protected override Container Content => content; public readonly Bindable Status = new Bindable(); @@ -45,126 +48,138 @@ namespace osu.Game.Users this.user = user; + Height = height - status_height; + } + + [BackgroundDependencyLoader(permitNulls: true)] + private void load(OsuColour colours, UserProfileOverlay profile) + { + if (colours == null) + throw new ArgumentNullException(nameof(colours)); + FillFlowContainer infoContainer; - Height = height - status_height; - Masking = true; - CornerRadius = 5; - EdgeEffect = new EdgeEffectParameters + AddInternal(content = new Container { - Type = EdgeEffectType.Shadow, - Colour = Color4.Black.Opacity(0.25f), - Radius = 4, - }; - - Children = new Drawable[] - { - new DelayedLoadWrapper(new UserCoverBackground(user) + RelativeSizeAxes = Axes.Both, + Masking = true, + CornerRadius = 5, + EdgeEffect = new EdgeEffectParameters { - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - FillMode = FillMode.Fill, - OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out) - }, 300) { RelativeSizeAxes = Axes.Both }, - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black.Opacity(0.7f), + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.25f), + Radius = 4, }, - new Container + + Children = new Drawable[] { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Top = content_padding, Horizontal = content_padding }, - Children = new Drawable[] + new DelayedLoadWrapper(new UserCoverBackground(user) { - new UpdateableAvatar + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out) + }, 300) { RelativeSizeAxes = Axes.Both }, + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black.Opacity(0.7f), + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Top = content_padding, Horizontal = content_padding }, + Children = new Drawable[] { - Size = new Vector2(height - status_height - content_padding * 2), - User = user, - Masking = true, - CornerRadius = 5, - EdgeEffect = new EdgeEffectParameters + new UpdateableAvatar { - Type = EdgeEffectType.Shadow, - Colour = Color4.Black.Opacity(0.25f), - Radius = 4, - }, - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = height - status_height - content_padding }, - Children = new Drawable[] - { - new OsuSpriteText + Size = new Vector2(height - status_height - content_padding * 2), + User = user, + Masking = true, + CornerRadius = 5, + EdgeEffect = new EdgeEffectParameters { - Text = user.Username, - TextSize = 18, - Font = @"Exo2.0-SemiBoldItalic", + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.25f), + Radius = 4, }, - infoContainer = new FillFlowContainer + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = height - status_height - content_padding }, + Children = new Drawable[] { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - AutoSizeAxes = Axes.X, - Height = 20f, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5f, 0f), - Children = new Drawable[] + new OsuSpriteText { - new DrawableFlag(user.Country) + Text = user.Username, + TextSize = 18, + Font = @"Exo2.0-SemiBoldItalic", + }, + infoContainer = new FillFlowContainer + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + AutoSizeAxes = Axes.X, + Height = 20f, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5f, 0f), + Children = new Drawable[] { - Width = 30f, - RelativeSizeAxes = Axes.Y, + new DrawableFlag(user.Country) + { + Width = 30f, + RelativeSizeAxes = Axes.Y, + }, }, }, }, }, }, }, - }, - statusBar = new Container - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - Alpha = 0f, - Children = new Drawable[] + statusBar = new Container { - statusBg = new Box + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + Alpha = 0f, + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Alpha = 0.5f, - }, - new FillFlowContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - AutoSizeAxes = Axes.Both, - Spacing = new Vector2(5f, 0f), - Children = new Drawable[] + statusBg = new Box { - new SpriteIcon + RelativeSizeAxes = Axes.Both, + Alpha = 0.5f, + }, + new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Spacing = new Vector2(5f, 0f), + Children = new Drawable[] { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Icon = FontAwesome.fa_circle_o, - Shadow = true, - Size = new Vector2(14), - }, - statusMessage = new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Font = @"Exo2.0-Semibold", + new SpriteIcon + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Icon = FontAwesome.fa_circle_o, + Shadow = true, + Size = new Vector2(14), + }, + statusMessage = new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Font = @"Exo2.0-Semibold", + }, }, }, }, }, - }, - }; + } + }); if (user.IsSupporter) { @@ -174,13 +189,6 @@ namespace osu.Game.Users Width = 20f, }); } - } - - [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuColour colours, UserProfileOverlay profile) - { - if (colours == null) - throw new ArgumentNullException(nameof(colours)); Status.ValueChanged += displayStatus; Status.ValueChanged += status => statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint); From 44d821172ab2d60069e95c9986d94eda5f7b1e07 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Tue, 9 Jan 2018 16:29:12 +0100 Subject: [PATCH 28/31] tidying up --- osu.Game/Overlays/Social/FilterControl.cs | 1 - osu.Game/Overlays/Social/Header.cs | 13 +++-- osu.Game/Overlays/SocialOverlay.cs | 59 ++++++++++------------- 3 files changed, 31 insertions(+), 42 deletions(-) diff --git a/osu.Game/Overlays/Social/FilterControl.cs b/osu.Game/Overlays/Social/FilterControl.cs index c05c3eb530..382b3fd0e7 100644 --- a/osu.Game/Overlays/Social/FilterControl.cs +++ b/osu.Game/Overlays/Social/FilterControl.cs @@ -21,7 +21,6 @@ namespace osu.Game.Overlays.Social public enum SocialSortCriteria { - Relevance, Rank, Name, Location, diff --git a/osu.Game/Overlays/Social/Header.cs b/osu.Game/Overlays/Social/Header.cs index 5d243ad36f..0767e0aec0 100644 --- a/osu.Game/Overlays/Social/Header.cs +++ b/osu.Game/Overlays/Social/Header.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Social protected override Color4 BackgroundColour => OsuColour.FromHex(@"38202e"); protected override float TabStripWidth => 438; - protected override SocialTab DefaultTab => SocialTab.OnlinePlayers; + protected override SocialTab DefaultTab => SocialTab.AllPlayers; protected override FontAwesome Icon => FontAwesome.fa_users; protected override Drawable CreateHeaderText() @@ -54,13 +54,12 @@ namespace osu.Game.Overlays.Social public enum SocialTab { - Search, - [Description("Players")] - OnlinePlayers = SocialSortCriteria.Rank, + [Description("All Players")] + AllPlayers = SocialSortCriteria.Rank, [Description("Friends")] - OnlineFriends = SocialSortCriteria.Name, - //[Description("Online Team Members")] - //OnlineTeamMembers, + Friends = SocialSortCriteria.Name, + //[Description("Team Members")] + //TeamMembers, //[Description("Chat Channels")] //ChatChannels, } diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 95e588942c..6fffd37456 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -55,37 +55,35 @@ namespace osu.Game.Overlays Filter.Search.Current.ValueChanged += text => { - if (text != string.Empty) + if (!string.IsNullOrEmpty(text)) { - Header.Tabs.Current.Value = SocialTab.Search; + // force searching in players until searching for friends is supported + Header.Tabs.Current.Value = SocialTab.AllPlayers; - if (Filter.Tabs.Current.Value == SocialSortCriteria.Rank) - Filter.Tabs.Current.Value = SocialSortCriteria.Relevance; - } - else - { - Header.Tabs.Current.Value = SocialTab.OnlinePlayers; - - if (Filter.Tabs.Current.Value == SocialSortCriteria.Relevance) + if (Filter.Tabs.Current.Value != SocialSortCriteria.Rank) Filter.Tabs.Current.Value = SocialSortCriteria.Rank; } }; - Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; - - // TODO sort our list in some way (either locally or with API call) - //Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += sortOrder => Scheduler.AddOnce(updateSearch); - Header.Tabs.Current.ValueChanged += tab => { - if (tab != SocialTab.Search) - { - //currentQuery.Value = string.Empty; - Filter.Tabs.Current.Value = (SocialSortCriteria)Header.Tabs.Current.Value; - Scheduler.AddOnce(updateSearch); - } + //currentQuery.Value = string.Empty; + Filter.Tabs.Current.Value = (SocialSortCriteria)Header.Tabs.Current.Value; + Scheduler.AddOnce(updateSearch); }; + Filter.Tabs.Current.ValueChanged += sortCriteria => + { + // force searching in players until searching for friends is supported + if (Header.Tabs.Current.Value != SocialTab.AllPlayers && sortCriteria != (SocialSortCriteria)Header.Tabs.Current.Value) + Header.Tabs.Current.Value = SocialTab.AllPlayers; + + Scheduler.AddOnce(updateSearch); + }; + + Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; + Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += sortOrder => Scheduler.AddOnce(updateSearch); + //currentQuery.ValueChanged += v => //{ // queryChangedDebounce?.Cancel(); @@ -97,14 +95,6 @@ namespace osu.Game.Overlays //}; //currentQuery.BindTo(Filter.Search.Current); - - Filter.Tabs.Current.ValueChanged += sortCriteria => - { - if (Header.Tabs.Current.Value != SocialTab.Search && sortCriteria != (SocialSortCriteria)Header.Tabs.Current.Value) - Header.Tabs.Current.Value = SocialTab.Search; - - Scheduler.AddOnce(updateSearch); - }; } [BackgroundDependencyLoader] @@ -148,11 +138,12 @@ namespace osu.Game.Overlays }) }; - LoadComponentAsync(newPanels, p => + LoadComponentAsync(newPanels, f => { if(panels != null) ScrollFlow.Remove(panels); + // delay new panels so they don't get added before the old ones are gone Scheduler.AddDelayed(() => ScrollFlow.Add(panels = newPanels), 200); }); } @@ -190,13 +181,13 @@ namespace osu.Game.Overlays switch (Header.Tabs.Current.Value) { - case SocialTab.OnlineFriends: - var friendRequest = new GetFriendsRequest(); + case SocialTab.Friends: + var friendRequest = new GetFriendsRequest(); // TODO filter arguments? friendRequest.Success += updateUsers; api.Queue(getUsersRequest = friendRequest); break; default: - var userRequest = new GetUsersRequest(); // TODO filter??? + var userRequest = new GetUsersRequest(); // TODO filter arguments! userRequest.Success += response => updateUsers(response.Select(r => r.User)); api.Queue(getUsersRequest = userRequest); break; @@ -223,7 +214,7 @@ namespace osu.Game.Overlays break; default: Users = null; - recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value); + clearPanels(); break; } } From 4ce125478a533646cb5c48c4652cae99abd729c6 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Tue, 9 Jan 2018 19:03:23 +0100 Subject: [PATCH 29/31] remove unnecessary Schedules one was bugging out when rapidly switching display styles and the other was... unnecessary --- osu.Game/Overlays/SocialOverlay.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 6fffd37456..8d91ae0c18 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -143,8 +143,7 @@ namespace osu.Game.Overlays if(panels != null) ScrollFlow.Remove(panels); - // delay new panels so they don't get added before the old ones are gone - Scheduler.AddDelayed(() => ScrollFlow.Add(panels = newPanels), 200); + ScrollFlow.Add(panels = newPanels); }); } @@ -197,12 +196,9 @@ namespace osu.Game.Overlays private void updateUsers(IEnumerable newUsers) { - Schedule(() => - { - Users = newUsers; - loading.Hide(); - recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value); - }); + Users = newUsers; + loading.Hide(); + recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value); } public void APIStateChanged(APIAccess api, APIState state) From 312f52072bd4762e5cbd998e1fd905f736c13126 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Wed, 10 Jan 2018 16:46:55 +0100 Subject: [PATCH 30/31] enable query change Avatar animation too add forgotten usings --- osu.Game/Overlays/Social/Header.cs | 4 +-- osu.Game/Overlays/SocialOverlay.cs | 42 ++++++++++++------------------ osu.Game/Users/UpdateableAvatar.cs | 2 +- 3 files changed, 19 insertions(+), 29 deletions(-) diff --git a/osu.Game/Overlays/Social/Header.cs b/osu.Game/Overlays/Social/Header.cs index 0767e0aec0..7bb4b4dde9 100644 --- a/osu.Game/Overlays/Social/Header.cs +++ b/osu.Game/Overlays/Social/Header.cs @@ -55,9 +55,9 @@ namespace osu.Game.Overlays.Social public enum SocialTab { [Description("All Players")] - AllPlayers = SocialSortCriteria.Rank, + AllPlayers, [Description("Friends")] - Friends = SocialSortCriteria.Name, + Friends, //[Description("Team Members")] //TeamMembers, //[Description("Chat Channels")] diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 8d91ae0c18..161ff70dc9 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -15,6 +15,8 @@ using osu.Game.Online.API.Requests; using osu.Game.Overlays.SearchableList; using osu.Game.Overlays.Social; using osu.Game.Users; +using osu.Framework.Configuration; +using osu.Framework.Threading; namespace osu.Game.Overlays { @@ -65,36 +67,24 @@ namespace osu.Game.Overlays } }; - Header.Tabs.Current.ValueChanged += tab => - { - //currentQuery.Value = string.Empty; - Filter.Tabs.Current.Value = (SocialSortCriteria)Header.Tabs.Current.Value; - Scheduler.AddOnce(updateSearch); - }; + Header.Tabs.Current.ValueChanged += tab => Scheduler.AddOnce(updateSearch); - Filter.Tabs.Current.ValueChanged += sortCriteria => - { - // force searching in players until searching for friends is supported - if (Header.Tabs.Current.Value != SocialTab.AllPlayers && sortCriteria != (SocialSortCriteria)Header.Tabs.Current.Value) - Header.Tabs.Current.Value = SocialTab.AllPlayers; - - Scheduler.AddOnce(updateSearch); - }; + Filter.Tabs.Current.ValueChanged += sortCriteria => Scheduler.AddOnce(updateSearch); Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += sortOrder => Scheduler.AddOnce(updateSearch); - //currentQuery.ValueChanged += v => - //{ - // queryChangedDebounce?.Cancel(); + currentQuery.ValueChanged += query => + { + queryChangedDebounce?.Cancel(); - // if (string.IsNullOrEmpty(v)) - // Scheduler.AddOnce(updateSearch); - // else - // queryChangedDebounce = Scheduler.AddDelayed(updateSearch, 500); - //}; + if (string.IsNullOrEmpty(query)) + Scheduler.AddOnce(updateSearch); + else + queryChangedDebounce = Scheduler.AddDelayed(updateSearch, 500); + }; - //currentQuery.BindTo(Filter.Search.Current); + currentQuery.BindTo(Filter.Search.Current); } [BackgroundDependencyLoader] @@ -159,13 +149,13 @@ namespace osu.Game.Overlays private APIRequest getUsersRequest; - //private readonly Bindable currentQuery = new Bindable(); + private readonly Bindable currentQuery = new Bindable(); - //private ScheduledDelegate queryChangedDebounce; + private ScheduledDelegate queryChangedDebounce; private void updateSearch() { - //queryChangedDebounce?.Cancel(); + queryChangedDebounce?.Cancel(); if (!IsLoaded) return; diff --git a/osu.Game/Users/UpdateableAvatar.cs b/osu.Game/Users/UpdateableAvatar.cs index e58647c7f6..2edd7cbf55 100644 --- a/osu.Game/Users/UpdateableAvatar.cs +++ b/osu.Game/Users/UpdateableAvatar.cs @@ -44,7 +44,7 @@ namespace osu.Game.Users new Avatar(user) { RelativeSizeAxes = Axes.Both, - OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), + OnLoadComplete = d => d.FadeInFromZero(300, Easing.OutQuint), }) ); } From 0a06f8069f5d6515bd7209645bff54cf85374bf9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 12 Jan 2018 17:22:51 +0900 Subject: [PATCH 31/31] Remove panel fade out for now Should be implemented at one level above using a dedicated container. --- osu.Game/Overlays/SocialOverlay.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 161ff70dc9..e61153d290 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -137,16 +137,6 @@ namespace osu.Game.Overlays }); } - private void clearPanels() - { - if (panels != null) - { - panels.FadeOut(200); - panels.Expire(); - panels = null; - } - } - private APIRequest getUsersRequest; private readonly Bindable currentQuery = new Bindable(); @@ -191,6 +181,15 @@ namespace osu.Game.Overlays recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value); } + private void clearPanels() + { + if (panels != null) + { + panels.Expire(); + panels = null; + } + } + public void APIStateChanged(APIAccess api, APIState state) { switch (state)