mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 04:02:59 +08:00
Add missing icons to UserProfileRecentSection
This commit is contained in:
parent
de966c2ba1
commit
33b442d5d0
93
osu.Game/Overlays/Profile/Sections/Recent/BeatmapIcon.cs
Normal file
93
osu.Game/Overlays/Profile/Sections/Recent/BeatmapIcon.cs
Normal file
@ -0,0 +1,93 @@
|
||||
// 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 osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Sections.Recent
|
||||
{
|
||||
public class BeatmapIcon : Container
|
||||
{
|
||||
private SpriteIcon icon;
|
||||
private BeatmapActionType type;
|
||||
|
||||
public enum BeatmapActionType
|
||||
{
|
||||
PlayedTimes,
|
||||
Qualified,
|
||||
Deleted,
|
||||
Revived,
|
||||
Updated,
|
||||
Submitted
|
||||
}
|
||||
|
||||
public BeatmapIcon(BeatmapActionType type)
|
||||
{
|
||||
this.type = type;
|
||||
Child = icon = new SpriteIcon
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
icon.Icon = getIcon(type);
|
||||
icon.Colour = getColor(type, colours);
|
||||
}
|
||||
|
||||
private IconUsage getIcon(BeatmapActionType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case BeatmapActionType.Qualified:
|
||||
|
||||
case BeatmapActionType.Submitted:
|
||||
return FontAwesome.Solid.ArrowUp;
|
||||
|
||||
case BeatmapActionType.Updated:
|
||||
return FontAwesome.Solid.SyncAlt;
|
||||
|
||||
case BeatmapActionType.Revived:
|
||||
return FontAwesome.Solid.TrashRestore;
|
||||
|
||||
case BeatmapActionType.Deleted:
|
||||
return FontAwesome.Solid.TrashAlt;
|
||||
|
||||
case BeatmapActionType.PlayedTimes:
|
||||
return FontAwesome.Solid.Play;
|
||||
|
||||
default:
|
||||
return FontAwesome.Solid.Map;
|
||||
}
|
||||
}
|
||||
|
||||
private Color4 getColor(BeatmapActionType type, OsuColour colours)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case BeatmapActionType.Qualified:
|
||||
return colours.Blue1;
|
||||
|
||||
case BeatmapActionType.Submitted:
|
||||
return colours.Yellow;
|
||||
|
||||
case BeatmapActionType.Updated:
|
||||
return colours.Lime1;
|
||||
|
||||
case BeatmapActionType.Deleted:
|
||||
return colours.Red1;
|
||||
|
||||
default:
|
||||
return Color4.White;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -16,6 +16,8 @@ using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Online.Leaderboards;
|
||||
using osu.Game.Rulesets;
|
||||
using static osu.Game.Overlays.Profile.Sections.Recent.BeatmapIcon;
|
||||
using static osu.Game.Overlays.Profile.Sections.Recent.SupporterIcon;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Sections.Recent
|
||||
{
|
||||
@ -119,6 +121,105 @@ namespace osu.Game.Overlays.Profile.Sections.Recent
|
||||
Height = 18
|
||||
};
|
||||
|
||||
case RecentActivityType.UserSupportAgain:
|
||||
return new SupporterIcon(SupporterType.SupportAgain)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 11,
|
||||
FillMode = FillMode.Fit,
|
||||
Margin = new MarginPadding { Top = 2, Vertical = 2 }
|
||||
};
|
||||
|
||||
case RecentActivityType.UserSupportFirst:
|
||||
return new SupporterIcon(SupporterType.SupportFirst)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 11,
|
||||
FillMode = FillMode.Fit,
|
||||
Margin = new MarginPadding { Top = 2, Vertical = 2 }
|
||||
};
|
||||
|
||||
case RecentActivityType.UserSupportGift:
|
||||
return new SupporterIcon(SupporterType.SupportGift)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 11,
|
||||
FillMode = FillMode.Fit,
|
||||
Margin = new MarginPadding { Top = 2, Vertical = 2 }
|
||||
};
|
||||
|
||||
case RecentActivityType.BeatmapsetUpload:
|
||||
return new BeatmapIcon(BeatmapActionType.Submitted)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 11,
|
||||
FillMode = FillMode.Fit,
|
||||
Margin = new MarginPadding { Top = 2, Vertical = 2 }
|
||||
};
|
||||
|
||||
case RecentActivityType.BeatmapsetUpdate:
|
||||
return new BeatmapIcon(BeatmapActionType.Updated)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 11,
|
||||
FillMode = FillMode.Fit,
|
||||
Margin = new MarginPadding { Top = 2, Vertical = 2 }
|
||||
};
|
||||
|
||||
case RecentActivityType.BeatmapsetRevive:
|
||||
return new BeatmapIcon(BeatmapActionType.Revived)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 11,
|
||||
FillMode = FillMode.Fit,
|
||||
Margin = new MarginPadding { Top = 2, Vertical = 2 }
|
||||
};
|
||||
|
||||
case RecentActivityType.BeatmapsetDelete:
|
||||
return new BeatmapIcon(BeatmapActionType.Deleted)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 11,
|
||||
FillMode = FillMode.Fit,
|
||||
Margin = new MarginPadding { Top = 2, Vertical = 2 }
|
||||
};
|
||||
|
||||
case RecentActivityType.BeatmapsetApprove:
|
||||
return new BeatmapIcon(BeatmapActionType.Qualified)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 11,
|
||||
FillMode = FillMode.Fit,
|
||||
Margin = new MarginPadding { Top = 2, Vertical = 2 }
|
||||
};
|
||||
|
||||
case RecentActivityType.BeatmapPlaycount:
|
||||
return new BeatmapIcon(BeatmapActionType.PlayedTimes)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 11,
|
||||
FillMode = FillMode.Fit,
|
||||
Margin = new MarginPadding { Top = 2, Vertical = 2 }
|
||||
};
|
||||
|
||||
case RecentActivityType.RankLost:
|
||||
return new OtherIcon(FontAwesome.Solid.AngleDoubleDown)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 11,
|
||||
FillMode = FillMode.Fit,
|
||||
Margin = new MarginPadding { Top = 2, Vertical = 2 }
|
||||
};
|
||||
|
||||
case RecentActivityType.UsernameChange:
|
||||
return new OtherIcon(FontAwesome.Solid.Tag)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 11,
|
||||
FillMode = FillMode.Fit,
|
||||
Margin = new MarginPadding { Top = 2, Vertical = 2 }
|
||||
};
|
||||
|
||||
default:
|
||||
return Empty();
|
||||
}
|
||||
|
26
osu.Game/Overlays/Profile/Sections/Recent/OtherIcon.cs
Normal file
26
osu.Game/Overlays/Profile/Sections/Recent/OtherIcon.cs
Normal file
@ -0,0 +1,26 @@
|
||||
// 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 osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Sections.Recent
|
||||
{
|
||||
public class OtherIcon : Container
|
||||
{
|
||||
public OtherIcon(IconUsage inputIcon)
|
||||
{
|
||||
{
|
||||
Child = new SpriteIcon
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Icon = inputIcon,
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
59
osu.Game/Overlays/Profile/Sections/Recent/SupporterIcon.cs
Normal file
59
osu.Game/Overlays/Profile/Sections/Recent/SupporterIcon.cs
Normal file
@ -0,0 +1,59 @@
|
||||
// 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 osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Sections.Recent
|
||||
{
|
||||
public class SupporterIcon : Container
|
||||
{
|
||||
private SpriteIcon icon;
|
||||
private SupporterType type;
|
||||
|
||||
public enum SupporterType
|
||||
{
|
||||
SupportFirst,
|
||||
SupportAgain,
|
||||
SupportGift
|
||||
}
|
||||
|
||||
public SupporterIcon(SupporterType type)
|
||||
{
|
||||
this.type = type;
|
||||
Child = icon = new SpriteIcon
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
icon.Icon = getIcon(type);
|
||||
icon.Colour = colours.Pink;
|
||||
}
|
||||
|
||||
private IconUsage getIcon(SupporterType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SupporterType.SupportFirst:
|
||||
|
||||
case SupporterType.SupportAgain:
|
||||
return FontAwesome.Solid.Heart;
|
||||
|
||||
case SupporterType.SupportGift:
|
||||
return FontAwesome.Solid.Gift;
|
||||
|
||||
default:
|
||||
return FontAwesome.Solid.Heart;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user