mirror of
https://github.com/ppy/osu.git
synced 2025-02-19 18:22:59 +08:00
Match approval type-dependent icon appearance with web
This commit is contained in:
parent
f3ecd73e0b
commit
f1e0dd2da3
@ -120,7 +120,7 @@ namespace osu.Game.Overlays.Profile.Sections.Recent
|
|||||||
};
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return new RecentActivityIcon(activity.Type)
|
return new RecentActivityIcon(activity)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = 11,
|
Height = 11,
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Recent
|
namespace osu.Game.Overlays.Profile.Sections.Recent
|
||||||
@ -14,11 +16,11 @@ namespace osu.Game.Overlays.Profile.Sections.Recent
|
|||||||
public class RecentActivityIcon : Container
|
public class RecentActivityIcon : Container
|
||||||
{
|
{
|
||||||
private readonly SpriteIcon icon;
|
private readonly SpriteIcon icon;
|
||||||
private readonly RecentActivityType type;
|
private readonly APIRecentActivity activity;
|
||||||
|
|
||||||
public RecentActivityIcon(RecentActivityType type)
|
public RecentActivityIcon(APIRecentActivity activity)
|
||||||
{
|
{
|
||||||
this.type = type;
|
this.activity = activity;
|
||||||
Child = icon = new SpriteIcon
|
Child = icon = new SpriteIcon
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -27,13 +29,16 @@ namespace osu.Game.Overlays.Profile.Sections.Recent
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuColour colours { get; set; } = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load()
|
||||||
{
|
{
|
||||||
// references:
|
// references:
|
||||||
// https://github.com/ppy/osu-web/blob/659b371dcadf25b4f601a4c9895a813078301084/resources/assets/lib/profile-page/parse-event.tsx
|
// https://github.com/ppy/osu-web/blob/659b371dcadf25b4f601a4c9895a813078301084/resources/assets/lib/profile-page/parse-event.tsx
|
||||||
// https://github.com/ppy/osu-web/blob/master/resources/assets/less/bem/profile-extra-entries.less#L98-L128
|
// https://github.com/ppy/osu-web/blob/master/resources/assets/less/bem/profile-extra-entries.less#L98-L128
|
||||||
switch (type)
|
switch (activity.Type)
|
||||||
{
|
{
|
||||||
case RecentActivityType.BeatmapPlaycount:
|
case RecentActivityType.BeatmapPlaycount:
|
||||||
icon.Icon = FontAwesome.Solid.Play;
|
icon.Icon = FontAwesome.Solid.Play;
|
||||||
@ -42,7 +47,7 @@ namespace osu.Game.Overlays.Profile.Sections.Recent
|
|||||||
|
|
||||||
case RecentActivityType.BeatmapsetApprove:
|
case RecentActivityType.BeatmapsetApprove:
|
||||||
icon.Icon = FontAwesome.Solid.ArrowUp;
|
icon.Icon = FontAwesome.Solid.ArrowUp;
|
||||||
icon.Colour = colours.Blue1;
|
icon.Colour = getColorForApprovalType(activity.Approval);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RecentActivityType.BeatmapsetDelete:
|
case RecentActivityType.BeatmapsetDelete:
|
||||||
@ -91,5 +96,24 @@ namespace osu.Game.Overlays.Profile.Sections.Recent
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Color4 getColorForApprovalType(BeatmapApproval approvalType)
|
||||||
|
{
|
||||||
|
switch (approvalType)
|
||||||
|
{
|
||||||
|
case BeatmapApproval.Approved:
|
||||||
|
case BeatmapApproval.Ranked:
|
||||||
|
return colours.Lime1;
|
||||||
|
|
||||||
|
case BeatmapApproval.Loved:
|
||||||
|
return colours.Pink1;
|
||||||
|
|
||||||
|
case BeatmapApproval.Qualified:
|
||||||
|
return colours.Blue1;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException($"Unsupported {nameof(BeatmapApproval)} type", approvalType, nameof(approvalType));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user