mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 06:36:31 +09:00
Split out classes into own files and rename GroupInfoContainer
to a flow
This commit is contained in:
@ -1,9 +1,8 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// 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.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -74,7 +73,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
if (group.Playmodes?.Length > 0)
|
||||
{
|
||||
innerContainer.AddRange(group.Playmodes.Select(p =>
|
||||
(rulesets.GetRuleset(p)?.CreateInstance().CreateIcon() ?? new SpriteIcon { Icon = FontAwesome.Regular.QuestionCircle }).With(icon =>
|
||||
(rulesets.GetRuleset((string)p)?.CreateInstance().CreateIcon() ?? new SpriteIcon { Icon = FontAwesome.Regular.QuestionCircle }).With(icon =>
|
||||
{
|
||||
icon.Size = new Vector2(TextSize - 1);
|
||||
})).ToList()
|
||||
@ -82,25 +81,4 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public partial class GroupInfoContainer : FillFlowContainer
|
||||
{
|
||||
public readonly Bindable<APIUser?> User = new Bindable<APIUser?>();
|
||||
|
||||
public GroupInfoContainer()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Direction = FillDirection.Horizontal;
|
||||
Spacing = new Vector2(2);
|
||||
|
||||
User.BindValueChanged(val =>
|
||||
{
|
||||
if (val.NewValue?.Groups?.Length > 0)
|
||||
{
|
||||
Clear(true);
|
||||
Children = val.NewValue?.Groups.Select(g => new GroupBadge(g)).ToList();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
// 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.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
public partial class GroupBadgeFlow : FillFlowContainer
|
||||
{
|
||||
public readonly Bindable<APIUser?> User = new Bindable<APIUser?>();
|
||||
|
||||
public GroupBadgeFlow()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Direction = FillDirection.Horizontal;
|
||||
Spacing = new Vector2(2);
|
||||
|
||||
User.BindValueChanged(val =>
|
||||
{
|
||||
if (val.NewValue?.Groups?.Length > 0)
|
||||
{
|
||||
Clear(true);
|
||||
Children = val.NewValue?.Groups.Select(g => new GroupBadge(g)).ToList();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user