1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 15:12:57 +08:00

readd IOnlineComponent to be able to react to APIState changes

This commit is contained in:
Aergwyn 2017-12-30 12:56:18 +01:00
parent d37ba2c9a4
commit 760d2aff4b

View File

@ -21,7 +21,7 @@ using System.Threading.Tasks;
namespace osu.Game.Overlays
{
public class SocialOverlay : SearchableListOverlay<SocialTab, SocialSortCriteria, SortDirection>
public class SocialOverlay : SearchableListOverlay<SocialTab, SocialSortCriteria, SortDirection>, 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