mirror of
https://github.com/ppy/osu.git
synced 2025-02-05 08:52:55 +08:00
Add group badges to list view
This commit is contained in:
parent
d679703fa2
commit
2b9d13cfee
@ -56,7 +56,13 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
IsOnline = true,
|
IsOnline = true,
|
||||||
Statistics = new UserStatistics { GlobalRank = 1111 },
|
Statistics = new UserStatistics { GlobalRank = 1111 },
|
||||||
CountryCode = CountryCode.JP,
|
CountryCode = CountryCode.JP,
|
||||||
CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
|
CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c6.jpg",
|
||||||
|
IsSupporter = true,
|
||||||
|
SupportLevel = 1,
|
||||||
|
Groups = new[]
|
||||||
|
{
|
||||||
|
new APIUserGroup { Colour = "#EB47D0", ShortName = "DEV", Name = "Developers" }
|
||||||
|
}
|
||||||
},
|
},
|
||||||
new APIUser
|
new APIUser
|
||||||
{
|
{
|
||||||
@ -68,6 +74,11 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
|
CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
|
||||||
IsSupporter = true,
|
IsSupporter = true,
|
||||||
SupportLevel = 3,
|
SupportLevel = 3,
|
||||||
|
Groups = new[]
|
||||||
|
{
|
||||||
|
new APIUserGroup { Colour = "#0066FF", ShortName = "PPY", Name = "peppy" },
|
||||||
|
new APIUserGroup { Colour = "#EB47D0", ShortName = "DEV", Name = "Developers" }
|
||||||
|
}
|
||||||
},
|
},
|
||||||
new APIUser
|
new APIUser
|
||||||
{
|
{
|
||||||
@ -76,7 +87,9 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
CountryCode = CountryCode.BY,
|
CountryCode = CountryCode.BY,
|
||||||
CoverUrl = "https://assets.ppy.sh/user-profile-covers/8195163/4a8e2ad5a02a2642b631438cfa6c6bd7e2f9db289be881cb27df18331f64144c.jpeg",
|
CoverUrl = "https://assets.ppy.sh/user-profile-covers/8195163/4a8e2ad5a02a2642b631438cfa6c6bd7e2f9db289be881cb27df18331f64144c.jpeg",
|
||||||
IsOnline = false,
|
IsOnline = false,
|
||||||
LastVisit = DateTimeOffset.Now
|
LastVisit = DateTimeOffset.Now,
|
||||||
|
IsSupporter = true,
|
||||||
|
SupportLevel = 2
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,14 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
Clear(true);
|
Clear(true);
|
||||||
|
|
||||||
if (user.NewValue?.Groups != null)
|
if (user.NewValue?.Groups != null)
|
||||||
|
{
|
||||||
AddRange(user.NewValue.Groups.Select(g => new GroupBadge(g)));
|
AddRange(user.NewValue.Groups.Select(g => new GroupBadge(g)));
|
||||||
|
Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osu.Game.Users.Drawables;
|
using osu.Game.Users.Drawables;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
using osu.Game.Overlays.Profile.Header.Components;
|
||||||
|
|
||||||
namespace osu.Game.Users
|
namespace osu.Game.Users
|
||||||
{
|
{
|
||||||
@ -97,6 +98,13 @@ namespace osu.Game.Users
|
|||||||
return statusContainer;
|
return statusContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected FillFlowContainer CreateGroupBadges()
|
||||||
|
{
|
||||||
|
var groupBadgeFlow = new GroupBadgeFlow();
|
||||||
|
groupBadgeFlow.User.Value = User;
|
||||||
|
return groupBadgeFlow;
|
||||||
|
}
|
||||||
|
|
||||||
private void displayStatus(UserStatus status, UserActivity activity = null)
|
private void displayStatus(UserStatus status, UserActivity activity = null)
|
||||||
{
|
{
|
||||||
if (status != null)
|
if (status != null)
|
||||||
|
@ -67,6 +67,11 @@ namespace osu.Game.Users
|
|||||||
{
|
{
|
||||||
username.Anchor = Anchor.CentreLeft;
|
username.Anchor = Anchor.CentreLeft;
|
||||||
username.Origin = Anchor.CentreLeft;
|
username.Origin = Anchor.CentreLeft;
|
||||||
|
}),
|
||||||
|
CreateGroupBadges().With(badges =>
|
||||||
|
{
|
||||||
|
badges.Anchor = Anchor.CentreLeft;
|
||||||
|
badges.Origin = Anchor.CentreLeft;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user