mirror of
https://github.com/ppy/osu
synced 2024-12-27 17:32:56 +00:00
Rename classes
This commit is contained in:
parent
9482fc5b99
commit
bfd643dd16
@ -17,8 +17,8 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(FriendsLayout),
|
||||
typeof(FriendsOnlineStatusControl),
|
||||
typeof(FriendDisplay),
|
||||
typeof(FriendOnlineStreamControl),
|
||||
typeof(UserListToolbar)
|
||||
};
|
||||
|
||||
@ -27,7 +27,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
|
||||
|
||||
private FriendsLayout layout;
|
||||
private FriendDisplay display;
|
||||
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() =>
|
||||
@ -35,20 +35,20 @@ namespace osu.Game.Tests.Visual.Online
|
||||
Child = new BasicScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = layout = new FriendsLayout()
|
||||
Child = display = new FriendDisplay()
|
||||
};
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestOffline()
|
||||
{
|
||||
AddStep("Populate", () => layout.Users = getUsers());
|
||||
AddStep("Populate", () => display.Users = getUsers());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOnline()
|
||||
{
|
||||
AddStep("Fetch online", () => layout?.Fetch());
|
||||
AddStep("Fetch online", () => display?.Fetch());
|
||||
}
|
||||
|
||||
private List<User> getUsers() => new List<User>
|
||||
|
@ -17,20 +17,20 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(FriendsOnlineStatusControl),
|
||||
typeof(FriendOnlineStreamControl),
|
||||
typeof(FriendsOnlineStatusItem),
|
||||
typeof(OverlayStreamControl<>),
|
||||
typeof(OverlayStreamItem<>),
|
||||
typeof(FriendsBundle)
|
||||
typeof(FriendStream)
|
||||
};
|
||||
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
||||
|
||||
private FriendsOnlineStatusControl control;
|
||||
private FriendOnlineStreamControl control;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() => Child = control = new FriendsOnlineStatusControl
|
||||
public void SetUp() => Schedule(() => Child = control = new FriendOnlineStreamControl
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -55,9 +55,9 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
}
|
||||
}));
|
||||
|
||||
AddAssert("3 users", () => control.Items.FirstOrDefault(item => item.Status == FriendsOnlineStatus.All)?.Count == 3);
|
||||
AddAssert("1 online user", () => control.Items.FirstOrDefault(item => item.Status == FriendsOnlineStatus.Online)?.Count == 1);
|
||||
AddAssert("2 offline users", () => control.Items.FirstOrDefault(item => item.Status == FriendsOnlineStatus.Offline)?.Count == 2);
|
||||
AddAssert("3 users", () => control.Items.FirstOrDefault(item => item.Status == OnlineStatus.All)?.Count == 3);
|
||||
AddAssert("1 online user", () => control.Items.FirstOrDefault(item => item.Status == OnlineStatus.Online)?.Count == 1);
|
||||
AddAssert("2 offline users", () => control.Items.FirstOrDefault(item => item.Status == OnlineStatus.Offline)?.Count == 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.Dashboard.Friends
|
||||
{
|
||||
public class FriendsLayout : CompositeDrawable
|
||||
public class FriendDisplay : CompositeDrawable
|
||||
{
|
||||
private List<User> users = new List<User>();
|
||||
|
||||
@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
||||
{
|
||||
users = value;
|
||||
|
||||
onlineStatusControl.Populate(value);
|
||||
onlineStreamControl.Populate(value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,14 +39,14 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
||||
|
||||
private Drawable currentContent;
|
||||
|
||||
private readonly FriendsOnlineStatusControl onlineStatusControl;
|
||||
private readonly FriendOnlineStreamControl onlineStreamControl;
|
||||
private readonly Box background;
|
||||
private readonly Box controlBackground;
|
||||
private readonly UserListToolbar userListToolbar;
|
||||
private readonly Container itemsPlaceholder;
|
||||
private readonly LoadingLayer loading;
|
||||
|
||||
public FriendsLayout()
|
||||
public FriendDisplay()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
@ -75,7 +75,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
||||
Top = 20,
|
||||
Horizontal = 45
|
||||
},
|
||||
Child = onlineStatusControl = new FriendsOnlineStatusControl(),
|
||||
Child = onlineStreamControl = new FriendOnlineStreamControl(),
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -147,7 +147,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
onlineStatusControl.Current.BindValueChanged(_ => recreatePanels());
|
||||
onlineStreamControl.Current.BindValueChanged(_ => recreatePanels());
|
||||
userListToolbar.DisplayStyle.BindValueChanged(_ => recreatePanels());
|
||||
userListToolbar.SortCriteria.BindValueChanged(_ => recreatePanels());
|
||||
}
|
||||
@ -179,16 +179,16 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
||||
|
||||
private List<User> getUsersInCurrentGroup()
|
||||
{
|
||||
switch (onlineStatusControl.Current.Value?.Status)
|
||||
switch (onlineStreamControl.Current.Value?.Status)
|
||||
{
|
||||
default:
|
||||
case FriendsOnlineStatus.All:
|
||||
case OnlineStatus.All:
|
||||
return users;
|
||||
|
||||
case FriendsOnlineStatus.Offline:
|
||||
case OnlineStatus.Offline:
|
||||
return users.Where(u => !u.IsOnline).ToList();
|
||||
|
||||
case FriendsOnlineStatus.Online:
|
||||
case OnlineStatus.Online:
|
||||
return users.Where(u => u.IsOnline).ToList();
|
||||
}
|
||||
}
|
@ -7,9 +7,9 @@ using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Overlays.Dashboard.Friends
|
||||
{
|
||||
public class FriendsOnlineStatusControl : OverlayStreamControl<FriendsBundle>
|
||||
public class FriendOnlineStreamControl : OverlayStreamControl<FriendStream>
|
||||
{
|
||||
protected override OverlayStreamItem<FriendsBundle> CreateStreamItem(FriendsBundle value) => new FriendsOnlineStatusItem(value);
|
||||
protected override OverlayStreamItem<FriendStream> CreateStreamItem(FriendStream value) => new FriendsOnlineStatusItem(value);
|
||||
|
||||
public void Populate(List<User> users)
|
||||
{
|
||||
@ -18,9 +18,9 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
||||
var userCount = users.Count;
|
||||
var onlineUsersCount = users.Count(user => user.IsOnline);
|
||||
|
||||
AddItem(new FriendsBundle(FriendsOnlineStatus.All, userCount));
|
||||
AddItem(new FriendsBundle(FriendsOnlineStatus.Online, onlineUsersCount));
|
||||
AddItem(new FriendsBundle(FriendsOnlineStatus.Offline, userCount - onlineUsersCount));
|
||||
AddItem(new FriendStream(OnlineStatus.All, userCount));
|
||||
AddItem(new FriendStream(OnlineStatus.Online, onlineUsersCount));
|
||||
AddItem(new FriendStream(OnlineStatus.Offline, userCount - onlineUsersCount));
|
||||
|
||||
Current.Value = Items.FirstOrDefault();
|
||||
}
|
@ -3,23 +3,16 @@
|
||||
|
||||
namespace osu.Game.Overlays.Dashboard.Friends
|
||||
{
|
||||
public class FriendsBundle
|
||||
public class FriendStream
|
||||
{
|
||||
public FriendsOnlineStatus Status { get; }
|
||||
public OnlineStatus Status { get; }
|
||||
|
||||
public int Count { get; }
|
||||
|
||||
public FriendsBundle(FriendsOnlineStatus status, int count)
|
||||
public FriendStream(OnlineStatus status, int count)
|
||||
{
|
||||
Status = status;
|
||||
Count = count;
|
||||
}
|
||||
}
|
||||
|
||||
public enum FriendsOnlineStatus
|
||||
{
|
||||
All,
|
||||
Online,
|
||||
Offline
|
||||
}
|
||||
}
|
@ -7,9 +7,9 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Dashboard.Friends
|
||||
{
|
||||
public class FriendsOnlineStatusItem : OverlayStreamItem<FriendsBundle>
|
||||
public class FriendsOnlineStatusItem : OverlayStreamItem<FriendStream>
|
||||
{
|
||||
public FriendsOnlineStatusItem(FriendsBundle value)
|
||||
public FriendsOnlineStatusItem(FriendStream value)
|
||||
: base(value)
|
||||
{
|
||||
}
|
||||
@ -22,13 +22,13 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
||||
{
|
||||
switch (Value.Status)
|
||||
{
|
||||
case FriendsOnlineStatus.All:
|
||||
case OnlineStatus.All:
|
||||
return Color4.White;
|
||||
|
||||
case FriendsOnlineStatus.Online:
|
||||
case OnlineStatus.Online:
|
||||
return colours.GreenLight;
|
||||
|
||||
case FriendsOnlineStatus.Offline:
|
||||
case OnlineStatus.Offline:
|
||||
return Color4.Black;
|
||||
|
||||
default:
|
||||
|
12
osu.Game/Overlays/Dashboard/Friends/OnlineStatus.cs
Normal file
12
osu.Game/Overlays/Dashboard/Friends/OnlineStatus.cs
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
namespace osu.Game.Overlays.Dashboard.Friends
|
||||
{
|
||||
public enum OnlineStatus
|
||||
{
|
||||
All,
|
||||
Online,
|
||||
Offline
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user