mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:47:26 +08:00
Add a User property to the comment for easy access
This commit is contained in:
parent
275648ee4f
commit
801b5b474e
@ -24,8 +24,26 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
[JsonProperty(@"included_comments")]
|
||||
public List<Comment> IncludedComments { get; set; }
|
||||
|
||||
private List<User> users;
|
||||
|
||||
[JsonProperty(@"users")]
|
||||
public List<User> Users { get; set; }
|
||||
public List<User> Users
|
||||
{
|
||||
get => users;
|
||||
set
|
||||
{
|
||||
users = value;
|
||||
|
||||
value.ForEach(u =>
|
||||
{
|
||||
Comments.ForEach(c =>
|
||||
{
|
||||
if (c.UserId == u.Id)
|
||||
c.User = u;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[JsonProperty(@"total")]
|
||||
public int Total { get; set; }
|
||||
|
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Users;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
@ -27,6 +28,8 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
[JsonProperty(@"user_id")]
|
||||
public long UserId { get; set; }
|
||||
|
||||
public User User { get; set; }
|
||||
|
||||
[JsonProperty(@"message")]
|
||||
public string Message { get; set; }
|
||||
|
||||
|
@ -103,11 +103,29 @@ namespace osu.Game.Overlays
|
||||
Height = 70,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteText
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Text = comment.GetMessage(),
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 3),
|
||||
Children = new[]
|
||||
{
|
||||
new SpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Text = $"user: {comment.User.Username}",
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Text = $"message: {comment.GetMessage()}",
|
||||
},
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user