mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Adjust visuals of incompatible icon and move to own class
This commit is contained in:
64
osu.Game/Overlays/Mods/IncompatibleIcon.cs
Normal file
64
osu.Game/Overlays/Mods/IncompatibleIcon.cs
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// 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.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Mods
|
||||||
|
{
|
||||||
|
public class IncompatibleIcon : VisibilityContainer, IHasTooltip
|
||||||
|
{
|
||||||
|
private Circle circle;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
Size = new Vector2(20);
|
||||||
|
|
||||||
|
State.Value = Visibility.Hidden;
|
||||||
|
Alpha = 0;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
circle = new Circle
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = colours.Gray4,
|
||||||
|
},
|
||||||
|
new SpriteIcon
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Size = new Vector2(0.6f),
|
||||||
|
Icon = FontAwesome.Solid.Slash,
|
||||||
|
Colour = Color4.White,
|
||||||
|
Shadow = true,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void PopIn()
|
||||||
|
{
|
||||||
|
this.FadeIn(200, Easing.OutQuint);
|
||||||
|
circle.FlashColour(Color4.Red, 500, Easing.OutQuint);
|
||||||
|
this.ScaleTo(1.8f).Then().ScaleTo(1, 500, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void PopOut()
|
||||||
|
{
|
||||||
|
this.FadeOut(200, Easing.OutQuint);
|
||||||
|
this.ScaleTo(0.8f, 200, Easing.In);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalisableString TooltipText => "Incompatible with current selected mods";
|
||||||
|
}
|
||||||
|
}
|
@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
private ModIcon backgroundIcon;
|
private ModIcon backgroundIcon;
|
||||||
private readonly SpriteText text;
|
private readonly SpriteText text;
|
||||||
private readonly Container<ModIcon> iconsContainer;
|
private readonly Container<ModIcon> iconsContainer;
|
||||||
private readonly SpriteIcon incompatibleIcon;
|
private readonly CompositeDrawable incompatibleIcon;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fired when the selection changes.
|
/// Fired when the selection changes.
|
||||||
@ -258,7 +258,10 @@ namespace osu.Game.Overlays.Mods
|
|||||||
if (selectedMods.Value.Count > 0 && !selectedMods.Value.Contains(m))
|
if (selectedMods.Value.Count > 0 && !selectedMods.Value.Contains(m))
|
||||||
isIncompatible = !ModUtils.CheckCompatibleSet(selectedMods.Value.Append(m));
|
isIncompatible = !ModUtils.CheckCompatibleSet(selectedMods.Value.Append(m));
|
||||||
|
|
||||||
incompatibleIcon.FadeTo(isIncompatible ? 1 : 0, 200, Easing.OutQuint);
|
if (isIncompatible)
|
||||||
|
incompatibleIcon.Show();
|
||||||
|
else
|
||||||
|
incompatibleIcon.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createIcons()
|
private void createIcons()
|
||||||
@ -315,15 +318,11 @@ namespace osu.Game.Overlays.Mods
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
},
|
},
|
||||||
incompatibleIcon = new SpriteIcon
|
incompatibleIcon = new IncompatibleIcon
|
||||||
{
|
{
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
Icon = FontAwesome.Solid.Ban,
|
Position = new Vector2(-13),
|
||||||
Colour = Color4.Red,
|
|
||||||
Size = new Vector2(30),
|
|
||||||
Shadow = true,
|
|
||||||
Alpha = 0
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Reference in New Issue
Block a user