mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Rename classes
This commit is contained in:
@ -17,8 +17,8 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
typeof(FriendsLayout),
|
typeof(FriendDisplay),
|
||||||
typeof(FriendsOnlineStatusControl),
|
typeof(FriendOnlineStreamControl),
|
||||||
typeof(UserListToolbar)
|
typeof(UserListToolbar)
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -27,7 +27,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 FriendsLayout layout;
|
private FriendDisplay display;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup() => Schedule(() =>
|
public void Setup() => Schedule(() =>
|
||||||
@ -35,20 +35,20 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
Child = new BasicScrollContainer
|
Child = new BasicScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = layout = new FriendsLayout()
|
Child = display = new FriendDisplay()
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestOffline()
|
public void TestOffline()
|
||||||
{
|
{
|
||||||
AddStep("Populate", () => layout.Users = getUsers());
|
AddStep("Populate", () => display.Users = getUsers());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestOnline()
|
public void TestOnline()
|
||||||
{
|
{
|
||||||
AddStep("Fetch online", () => layout?.Fetch());
|
AddStep("Fetch online", () => display?.Fetch());
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<User> getUsers() => new List<User>
|
private List<User> getUsers() => new List<User>
|
||||||
|
@ -17,20 +17,20 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
typeof(FriendsOnlineStatusControl),
|
typeof(FriendOnlineStreamControl),
|
||||||
typeof(FriendsOnlineStatusItem),
|
typeof(FriendsOnlineStatusItem),
|
||||||
typeof(OverlayStreamControl<>),
|
typeof(OverlayStreamControl<>),
|
||||||
typeof(OverlayStreamItem<>),
|
typeof(OverlayStreamItem<>),
|
||||||
typeof(FriendsBundle)
|
typeof(FriendStream)
|
||||||
};
|
};
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
||||||
|
|
||||||
private FriendsOnlineStatusControl control;
|
private FriendOnlineStreamControl control;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void SetUp() => Schedule(() => Child = control = new FriendsOnlineStatusControl
|
public void SetUp() => Schedule(() => Child = control = new FriendOnlineStreamControl
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = 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("3 users", () => control.Items.FirstOrDefault(item => item.Status == OnlineStatus.All)?.Count == 3);
|
||||||
AddAssert("1 online user", () => control.Items.FirstOrDefault(item => item.Status == FriendsOnlineStatus.Online)?.Count == 1);
|
AddAssert("1 online user", () => control.Items.FirstOrDefault(item => item.Status == OnlineStatus.Online)?.Count == 1);
|
||||||
AddAssert("2 offline users", () => control.Items.FirstOrDefault(item => item.Status == FriendsOnlineStatus.Offline)?.Count == 2);
|
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
|
namespace osu.Game.Overlays.Dashboard.Friends
|
||||||
{
|
{
|
||||||
public class FriendsLayout : CompositeDrawable
|
public class FriendDisplay : CompositeDrawable
|
||||||
{
|
{
|
||||||
private List<User> users = new List<User>();
|
private List<User> users = new List<User>();
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
|||||||
{
|
{
|
||||||
users = value;
|
users = value;
|
||||||
|
|
||||||
onlineStatusControl.Populate(value);
|
onlineStreamControl.Populate(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,14 +39,14 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
|||||||
|
|
||||||
private Drawable currentContent;
|
private Drawable currentContent;
|
||||||
|
|
||||||
private readonly FriendsOnlineStatusControl onlineStatusControl;
|
private readonly FriendOnlineStreamControl onlineStreamControl;
|
||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
private readonly Box controlBackground;
|
private readonly Box controlBackground;
|
||||||
private readonly UserListToolbar userListToolbar;
|
private readonly UserListToolbar userListToolbar;
|
||||||
private readonly Container itemsPlaceholder;
|
private readonly Container itemsPlaceholder;
|
||||||
private readonly LoadingLayer loading;
|
private readonly LoadingLayer loading;
|
||||||
|
|
||||||
public FriendsLayout()
|
public FriendDisplay()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
@ -75,7 +75,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
|||||||
Top = 20,
|
Top = 20,
|
||||||
Horizontal = 45
|
Horizontal = 45
|
||||||
},
|
},
|
||||||
Child = onlineStatusControl = new FriendsOnlineStatusControl(),
|
Child = onlineStreamControl = new FriendOnlineStreamControl(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -147,7 +147,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
onlineStatusControl.Current.BindValueChanged(_ => recreatePanels());
|
onlineStreamControl.Current.BindValueChanged(_ => recreatePanels());
|
||||||
userListToolbar.DisplayStyle.BindValueChanged(_ => recreatePanels());
|
userListToolbar.DisplayStyle.BindValueChanged(_ => recreatePanels());
|
||||||
userListToolbar.SortCriteria.BindValueChanged(_ => recreatePanels());
|
userListToolbar.SortCriteria.BindValueChanged(_ => recreatePanels());
|
||||||
}
|
}
|
||||||
@ -179,16 +179,16 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
|||||||
|
|
||||||
private List<User> getUsersInCurrentGroup()
|
private List<User> getUsersInCurrentGroup()
|
||||||
{
|
{
|
||||||
switch (onlineStatusControl.Current.Value?.Status)
|
switch (onlineStreamControl.Current.Value?.Status)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case FriendsOnlineStatus.All:
|
case OnlineStatus.All:
|
||||||
return users;
|
return users;
|
||||||
|
|
||||||
case FriendsOnlineStatus.Offline:
|
case OnlineStatus.Offline:
|
||||||
return users.Where(u => !u.IsOnline).ToList();
|
return users.Where(u => !u.IsOnline).ToList();
|
||||||
|
|
||||||
case FriendsOnlineStatus.Online:
|
case OnlineStatus.Online:
|
||||||
return users.Where(u => u.IsOnline).ToList();
|
return users.Where(u => u.IsOnline).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,9 +7,9 @@ using osu.Game.Users;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.Dashboard.Friends
|
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)
|
public void Populate(List<User> users)
|
||||||
{
|
{
|
||||||
@ -18,9 +18,9 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
|||||||
var userCount = users.Count;
|
var userCount = users.Count;
|
||||||
var onlineUsersCount = users.Count(user => user.IsOnline);
|
var onlineUsersCount = users.Count(user => user.IsOnline);
|
||||||
|
|
||||||
AddItem(new FriendsBundle(FriendsOnlineStatus.All, userCount));
|
AddItem(new FriendStream(OnlineStatus.All, userCount));
|
||||||
AddItem(new FriendsBundle(FriendsOnlineStatus.Online, onlineUsersCount));
|
AddItem(new FriendStream(OnlineStatus.Online, onlineUsersCount));
|
||||||
AddItem(new FriendsBundle(FriendsOnlineStatus.Offline, userCount - onlineUsersCount));
|
AddItem(new FriendStream(OnlineStatus.Offline, userCount - onlineUsersCount));
|
||||||
|
|
||||||
Current.Value = Items.FirstOrDefault();
|
Current.Value = Items.FirstOrDefault();
|
||||||
}
|
}
|
@ -3,23 +3,16 @@
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.Dashboard.Friends
|
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 int Count { get; }
|
||||||
|
|
||||||
public FriendsBundle(FriendsOnlineStatus status, int count)
|
public FriendStream(OnlineStatus status, int count)
|
||||||
{
|
{
|
||||||
Status = status;
|
Status = status;
|
||||||
Count = count;
|
Count = count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum FriendsOnlineStatus
|
|
||||||
{
|
|
||||||
All,
|
|
||||||
Online,
|
|
||||||
Offline
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -7,9 +7,9 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.Dashboard.Friends
|
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)
|
: base(value)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -22,13 +22,13 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
|||||||
{
|
{
|
||||||
switch (Value.Status)
|
switch (Value.Status)
|
||||||
{
|
{
|
||||||
case FriendsOnlineStatus.All:
|
case OnlineStatus.All:
|
||||||
return Color4.White;
|
return Color4.White;
|
||||||
|
|
||||||
case FriendsOnlineStatus.Online:
|
case OnlineStatus.Online:
|
||||||
return colours.GreenLight;
|
return colours.GreenLight;
|
||||||
|
|
||||||
case FriendsOnlineStatus.Offline:
|
case OnlineStatus.Offline:
|
||||||
return Color4.Black;
|
return Color4.Black;
|
||||||
|
|
||||||
default:
|
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
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user