mirror of
https://github.com/osukey/osukey.git
synced 2025-05-21 13:37:20 +09:00
Remove unnecessary inheritance to OverlayView
This commit is contained in:
parent
5e4f667cff
commit
9c22753f3f
@ -20,7 +20,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Cached]
|
[Cached]
|
||||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
|
||||||
|
|
||||||
private TestFriendDisplay display;
|
private FriendDisplay display;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup() => Schedule(() =>
|
public void Setup() => Schedule(() =>
|
||||||
@ -28,7 +28,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
Child = new BasicScrollContainer
|
Child = new BasicScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = display = new TestFriendDisplay()
|
Child = display = new FriendDisplay()
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestOnline()
|
public void TestOnline()
|
||||||
{
|
{
|
||||||
AddStep("Fetch online", () => display?.Fetch());
|
// No need to do anything, fetch is performed automatically.
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<User> getUsers() => new List<User>
|
private List<User> getUsers() => new List<User>
|
||||||
@ -76,10 +76,5 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
LastVisit = DateTimeOffset.Now
|
LastVisit = DateTimeOffset.Now
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private class TestFriendDisplay : FriendDisplay
|
|
||||||
{
|
|
||||||
public void Fetch() => PerformFetch();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,16 +5,18 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Dashboard.Friends
|
namespace osu.Game.Overlays.Dashboard.Friends
|
||||||
{
|
{
|
||||||
public class FriendDisplay : OverlayView<List<User>>
|
public class FriendDisplay : CompositeDrawable
|
||||||
{
|
{
|
||||||
private List<User> users = new List<User>();
|
private List<User> users = new List<User>();
|
||||||
|
|
||||||
@ -39,8 +41,16 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
|||||||
private Container itemsPlaceholder;
|
private Container itemsPlaceholder;
|
||||||
private LoadingLayer loading;
|
private LoadingLayer loading;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
private readonly IBindableList<User> apiFriends = new BindableList<User>();
|
||||||
private void load(OverlayColourProvider colourProvider)
|
|
||||||
|
public FriendDisplay()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader(true)]
|
||||||
|
private void load(OverlayColourProvider colourProvider, IAPIProvider api)
|
||||||
{
|
{
|
||||||
InternalChild = new FillFlowContainer
|
InternalChild = new FillFlowContainer
|
||||||
{
|
{
|
||||||
@ -130,6 +140,9 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
|||||||
|
|
||||||
background.Colour = colourProvider.Background4;
|
background.Colour = colourProvider.Background4;
|
||||||
controlBackground.Colour = colourProvider.Background5;
|
controlBackground.Colour = colourProvider.Background5;
|
||||||
|
|
||||||
|
apiFriends.BindTo(api.Friends);
|
||||||
|
apiFriends.BindCollectionChanged((_, __) => Schedule(() => Users = apiFriends.ToList()), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -141,13 +154,6 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
|||||||
userListToolbar.SortCriteria.BindValueChanged(_ => recreatePanels());
|
userListToolbar.SortCriteria.BindValueChanged(_ => recreatePanels());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PerformFetch()
|
|
||||||
{
|
|
||||||
base.PerformFetch();
|
|
||||||
|
|
||||||
Users = API.Friends.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void recreatePanels()
|
private void recreatePanels()
|
||||||
{
|
{
|
||||||
if (!users.Any())
|
if (!users.Any())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user