mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Inline everything in RecentActivityIcon
This commit is contained in:
parent
bd27995c71
commit
3000d9b9c6
@ -1,93 +0,0 @@
|
||||
// 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 readonly SpriteIcon icon;
|
||||
private readonly 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,8 +16,6 @@ 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
|
||||
{
|
||||
@ -121,107 +119,14 @@ 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();
|
||||
return new RecentActivityIcon(activity.Type)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 11,
|
||||
FillMode = FillMode.Fit,
|
||||
Margin = new MarginPadding { Top = 2, Vertical = 2 }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
// 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,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
// 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.Sprites;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Sections.Recent
|
||||
{
|
||||
public class RecentActivityIcon : Container
|
||||
{
|
||||
private readonly SpriteIcon icon;
|
||||
private readonly RecentActivityType type;
|
||||
|
||||
public RecentActivityIcon(RecentActivityType type)
|
||||
{
|
||||
this.type = type;
|
||||
Child = icon = new SpriteIcon
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case RecentActivityType.BeatmapPlaycount:
|
||||
icon.Icon = FontAwesome.Solid.Play;
|
||||
icon.Colour = Color4.White;
|
||||
break;
|
||||
|
||||
case RecentActivityType.BeatmapsetApprove:
|
||||
icon.Icon = FontAwesome.Solid.ArrowUp;
|
||||
icon.Colour = colours.Blue1;
|
||||
break;
|
||||
|
||||
case RecentActivityType.BeatmapsetDelete:
|
||||
icon.Icon = FontAwesome.Solid.TrashAlt;
|
||||
icon.Colour = colours.Red1;
|
||||
break;
|
||||
|
||||
case RecentActivityType.BeatmapsetRevive:
|
||||
icon.Icon = FontAwesome.Solid.TrashRestore;
|
||||
icon.Colour = Color4.White;
|
||||
break;
|
||||
|
||||
case RecentActivityType.BeatmapsetUpdate:
|
||||
icon.Icon = FontAwesome.Solid.SyncAlt;
|
||||
icon.Colour = colours.Lime1;
|
||||
break;
|
||||
|
||||
case RecentActivityType.BeatmapsetUpload:
|
||||
icon.Icon = FontAwesome.Solid.ArrowUp;
|
||||
icon.Colour = colours.Yellow;
|
||||
break;
|
||||
|
||||
case RecentActivityType.RankLost:
|
||||
icon.Icon = FontAwesome.Solid.AngleDoubleDown;
|
||||
icon.Colour = Color4.White;
|
||||
break;
|
||||
|
||||
case RecentActivityType.UsernameChange:
|
||||
icon.Icon = FontAwesome.Solid.Tag;
|
||||
icon.Colour = Color4.White;
|
||||
break;
|
||||
|
||||
case RecentActivityType.UserSupportAgain:
|
||||
icon.Icon = FontAwesome.Solid.Heart;
|
||||
icon.Colour = colours.Pink;
|
||||
break;
|
||||
|
||||
case RecentActivityType.UserSupportFirst:
|
||||
icon.Icon = FontAwesome.Solid.Heart;
|
||||
icon.Colour = colours.Pink;
|
||||
break;
|
||||
|
||||
case RecentActivityType.UserSupportGift:
|
||||
icon.Icon = FontAwesome.Solid.Gift;
|
||||
icon.Colour = colours.Pink;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
// 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 readonly SpriteIcon icon;
|
||||
private readonly 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