mirror of
https://github.com/osukey/osukey.git
synced 2025-06-23 20:27:58 +09:00
Implement UserSortTabControl component
This commit is contained in:
parent
66317f9fcd
commit
0cfe1ac823
@ -0,0 +1,41 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Overlays.Home.Friends;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
|
{
|
||||||
|
public class TestSceneUserSortTabControl : OsuTestScene
|
||||||
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(UserSortTabControl),
|
||||||
|
typeof(OverlaySortTabControl<>),
|
||||||
|
};
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
|
||||||
|
|
||||||
|
public TestSceneUserSortTabControl()
|
||||||
|
{
|
||||||
|
UserSortTabControl control;
|
||||||
|
OsuSpriteText current;
|
||||||
|
|
||||||
|
Add(control = new UserSortTabControl
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
});
|
||||||
|
|
||||||
|
Add(current = new OsuSpriteText());
|
||||||
|
|
||||||
|
control.Current.BindValueChanged(criteria => current.Text = $"Criteria: {criteria.NewValue}", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,8 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using Container = osu.Framework.Graphics.Containers.Container;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Comments
|
namespace osu.Game.Overlays.Comments
|
||||||
{
|
{
|
||||||
@ -109,6 +111,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
|
|
||||||
public enum CommentsSortCriteria
|
public enum CommentsSortCriteria
|
||||||
{
|
{
|
||||||
|
[Description(@"Recent")]
|
||||||
New,
|
New,
|
||||||
Old,
|
Old,
|
||||||
Top
|
Top
|
||||||
|
19
osu.Game/Overlays/Home/Friends/UserSortTabControl.cs
Normal file
19
osu.Game/Overlays/Home/Friends/UserSortTabControl.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Home.Friends
|
||||||
|
{
|
||||||
|
public class UserSortTabControl : OverlaySortTabControl<UserSortCriteria>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum UserSortCriteria
|
||||||
|
{
|
||||||
|
[Description(@"Recently Active")]
|
||||||
|
LastVisit,
|
||||||
|
Rank,
|
||||||
|
Username
|
||||||
|
}
|
||||||
|
}
|
@ -15,6 +15,8 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Game.Overlays.Comments;
|
using osu.Game.Overlays.Comments;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
@ -132,7 +134,7 @@ namespace osu.Game.Overlays
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Font = OsuFont.GetFont(size: 12),
|
Font = OsuFont.GetFont(size: 12),
|
||||||
Text = value.ToString()
|
Text = (value as Enum)?.GetDescription() ?? value.ToString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user