1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-18 15:32:55 +08:00
osu-lazer/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs

65 lines
1.7 KiB
C#
Raw Normal View History

2019-06-27 14:31:47 +08:00
// 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;
2022-04-30 20:35:04 +08:00
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites;
2022-04-30 20:35:04 +08:00
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Rulesets;
using osuTK;
2020-01-04 02:02:56 +08:00
using osuTK.Graphics;
namespace osu.Game.Overlays.Profile.Header.Components
{
public class ProfileRulesetTabItem : OverlayRulesetTabItem
{
private bool isDefault;
public bool IsDefault
{
get => isDefault;
set
{
if (isDefault == value)
return;
isDefault = value;
icon.Alpha = isDefault ? 1 : 0;
}
}
protected override Color4 AccentColour
{
get => base.AccentColour;
set
{
base.AccentColour = value;
icon.FadeColour(value, 120, Easing.OutQuint);
}
}
2020-01-04 02:02:56 +08:00
private readonly SpriteIcon icon;
public ProfileRulesetTabItem(RulesetInfo value)
: base(value)
{
2022-04-30 20:35:04 +08:00
Add(icon = new DefaultRulesetIcon { Alpha = 0 });
}
public class DefaultRulesetIcon : SpriteIcon, IHasTooltip
{
public LocalisableString TooltipText => UsersStrings.ShowEditDefaultPlaymodeIsDefaultTooltip;
public DefaultRulesetIcon()
{
2022-04-30 20:35:04 +08:00
Origin = Anchor.Centre;
Anchor = Anchor.Centre;
Icon = FontAwesome.Solid.Star;
Size = new Vector2(12);
}
2020-01-04 02:02:56 +08:00
}
}
}