mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 16:52:55 +08:00
Update design in line with web
This commit is contained in:
parent
6b8fbf0eb1
commit
f1d02d8169
@ -12,49 +12,100 @@ using osu.Game.Online.Chat;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Kudosu
|
namespace osu.Game.Overlays.Profile.Sections.Kudosu
|
||||||
{
|
{
|
||||||
public class DrawableKudosuHistoryItem : DrawableProfileRow
|
public class DrawableKudosuHistoryItem : CompositeDrawable
|
||||||
{
|
{
|
||||||
|
private const int height = 25;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuColour colours { get; set; }
|
||||||
|
|
||||||
private readonly APIKudosuHistory historyItem;
|
private readonly APIKudosuHistory historyItem;
|
||||||
private LinkFlowContainer content;
|
private readonly LinkFlowContainer linkFlowContainer;
|
||||||
|
private readonly DrawableDate date;
|
||||||
|
|
||||||
public DrawableKudosuHistoryItem(APIKudosuHistory historyItem)
|
public DrawableKudosuHistoryItem(APIKudosuHistory historyItem)
|
||||||
{
|
{
|
||||||
this.historyItem = historyItem;
|
this.historyItem = historyItem;
|
||||||
|
|
||||||
|
Height = height;
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AddRangeInternal(new Drawable[]
|
||||||
|
{
|
||||||
|
linkFlowContainer = new LinkFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
date = new DrawableDate(historyItem.CreatedAt)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
LeftFlowContainer.Padding = new MarginPadding { Left = 10 };
|
date.Colour = colours.GreySeafoamLighter;
|
||||||
|
|
||||||
LeftFlowContainer.Add(content = new LinkFlowContainer
|
switch (historyItem.Action)
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Y,
|
case KudosuAction.VoteGive:
|
||||||
RelativeSizeAxes = Axes.X,
|
case KudosuAction.Give:
|
||||||
});
|
linkFlowContainer.AddText($@"Received ");
|
||||||
|
addKudosuPart();
|
||||||
|
addMainPart();
|
||||||
|
addPostPart();
|
||||||
|
break;
|
||||||
|
|
||||||
RightFlowContainer.Add(new DrawableDate(historyItem.CreatedAt)
|
case KudosuAction.Reset:
|
||||||
{
|
addMainPart();
|
||||||
Font = OsuFont.GetFont(size: 13),
|
addPostPart();
|
||||||
Colour = OsuColour.Gray(0xAA),
|
break;
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
});
|
|
||||||
|
|
||||||
var formatted = createMessage();
|
case KudosuAction.VoteReset:
|
||||||
|
linkFlowContainer.AddText($@"Lost ");
|
||||||
|
addKudosuPart();
|
||||||
|
addMainPart();
|
||||||
|
addPostPart();
|
||||||
|
break;
|
||||||
|
|
||||||
content.AddLinks(formatted.Text, formatted.Links);
|
case KudosuAction.DenyKudosuReset:
|
||||||
|
linkFlowContainer.AddText($@"Denied ");
|
||||||
|
addKudosuPart();
|
||||||
|
addMainPart();
|
||||||
|
addPostPart();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KudosuAction.Revoke:
|
||||||
|
addMainPart();
|
||||||
|
addPostPart();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable CreateLeftVisual() => new Container
|
private void addKudosuPart()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y,
|
linkFlowContainer.AddText($@"{historyItem.Amount} kudosu", t =>
|
||||||
AutoSizeAxes = Axes.X,
|
{
|
||||||
};
|
t.Font = t.Font.With(italics: true);
|
||||||
|
t.Colour = colours.Blue;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addMainPart()
|
||||||
|
{
|
||||||
|
var text = createMessage();
|
||||||
|
|
||||||
|
linkFlowContainer.AddLinks(text.Text, text.Links);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addPostPart() => linkFlowContainer.AddLink(historyItem.Post.Title, historyItem.Post.Url);
|
||||||
|
|
||||||
private MessageFormatter.MessageFormatterResult createMessage()
|
private MessageFormatter.MessageFormatterResult createMessage()
|
||||||
{
|
{
|
||||||
string postLinkTemplate() => $"[{historyItem.Post.Url} {historyItem.Post.Title}]";
|
|
||||||
string userLinkTemplate() => $"[{historyItem.Giver?.Url} {historyItem.Giver?.Username}]";
|
string userLinkTemplate() => $"[{historyItem.Giver?.Url} {historyItem.Giver?.Username}]";
|
||||||
|
|
||||||
string message;
|
string message;
|
||||||
@ -62,27 +113,27 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
|
|||||||
switch (historyItem.Action)
|
switch (historyItem.Action)
|
||||||
{
|
{
|
||||||
case KudosuAction.Give:
|
case KudosuAction.Give:
|
||||||
message = $"Received {historyItem.Amount} kudosu from {userLinkTemplate()} for a post at {postLinkTemplate()}";
|
message = $" from {userLinkTemplate()} for a post at ";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KudosuAction.VoteGive:
|
case KudosuAction.VoteGive:
|
||||||
message = $"Received {historyItem.Amount} kudosu from obtaining votes in modding post of {postLinkTemplate()}";
|
message = $" from obtaining votes in modding post of ";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KudosuAction.Reset:
|
case KudosuAction.Reset:
|
||||||
message = $"Kudosu reset by {userLinkTemplate()} for the post {postLinkTemplate()}";
|
message = $"Kudosu reset by {userLinkTemplate()} for the post ";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KudosuAction.VoteReset:
|
case KudosuAction.VoteReset:
|
||||||
message = $"Lost {historyItem.Amount} kudosu from losing votes in modding post of {postLinkTemplate()}";
|
message = $" from losing votes in modding post of ";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KudosuAction.DenyKudosuReset:
|
case KudosuAction.DenyKudosuReset:
|
||||||
message = $"Denied {historyItem.Amount} kudosu from modding post {postLinkTemplate()}";
|
message = $" from modding post ";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KudosuAction.Revoke:
|
case KudosuAction.Revoke:
|
||||||
message = $"Denied kudosu by {userLinkTemplate()} for the post {postLinkTemplate()}";
|
message = $"Denied kudosu by {userLinkTemplate()} for the post ";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user