mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 07:32:55 +08:00
Arrows improvements
This commit is contained in:
parent
3202d35a79
commit
d58e5a6130
@ -9,13 +9,15 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
{
|
||||
public class ArrowsOverlay : Container
|
||||
{
|
||||
private const int glowing_size = 60;
|
||||
private const float glowing_final_offset = 0.25f;
|
||||
private const float glowing_offscreen_offset = 0.6f;
|
||||
private const int glow_icon_size = 65;
|
||||
private const int glow_icon_blur_sigma = 8;
|
||||
private const float glow_icon_final_offset = 0.2f;
|
||||
private const float glow_icon_offscreen_offset = 0.6f;
|
||||
|
||||
private const int blurred_size = 130;
|
||||
private const float blurred_final_offset = 0.35f;
|
||||
private const float blurred_offscreen_offset = 0.7f;
|
||||
private const int blurred_icon_blur_sigma = 20;
|
||||
private const int blurred_icon_size = 130;
|
||||
private const float blurred_icon_final_offset = 0.35f;
|
||||
private const float blurred_icon_offscreen_offset = 0.7f;
|
||||
|
||||
private readonly GlowIcon leftGlowIcon;
|
||||
private readonly GlowIcon rightGlowIcon;
|
||||
@ -32,53 +34,57 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreRight,
|
||||
X = - glowing_offscreen_offset,
|
||||
X = - glow_icon_offscreen_offset,
|
||||
Icon = Graphics.FontAwesome.fa_chevron_right,
|
||||
Size = new Vector2(glowing_size),
|
||||
BlurSigma = new Vector2(glow_icon_blur_sigma),
|
||||
Size = new Vector2(glow_icon_size),
|
||||
},
|
||||
rightGlowIcon = new GlowIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreLeft,
|
||||
X = glowing_offscreen_offset,
|
||||
X = glow_icon_offscreen_offset,
|
||||
Icon = Graphics.FontAwesome.fa_chevron_left,
|
||||
Size = new Vector2(glowing_size),
|
||||
BlurSigma = new Vector2(glow_icon_blur_sigma),
|
||||
Size = new Vector2(glow_icon_size),
|
||||
},
|
||||
leftBlurredIcon = new BlurredIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreRight,
|
||||
X = - blurred_offscreen_offset,
|
||||
X = - blurred_icon_offscreen_offset,
|
||||
Icon = Graphics.FontAwesome.fa_chevron_right,
|
||||
Size = new Vector2(blurred_size),
|
||||
BlurSigma = new Vector2(blurred_icon_blur_sigma),
|
||||
Size = new Vector2(blurred_icon_size),
|
||||
},
|
||||
rightBlurredIcon = new BlurredIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreLeft,
|
||||
X = blurred_offscreen_offset,
|
||||
X = blurred_icon_offscreen_offset,
|
||||
Icon = Graphics.FontAwesome.fa_chevron_left,
|
||||
Size = new Vector2(blurred_size),
|
||||
BlurSigma = new Vector2(blurred_icon_blur_sigma),
|
||||
Size = new Vector2(blurred_icon_size),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
public void Show(double fadeDuration)
|
||||
{
|
||||
leftGlowIcon.MoveToX(-glowing_final_offset, fadeDuration, Easing.OutQuint);
|
||||
rightGlowIcon.MoveToX(glowing_final_offset, fadeDuration, Easing.OutQuint);
|
||||
leftGlowIcon.MoveToX(-glow_icon_final_offset, fadeDuration, Easing.OutQuint);
|
||||
rightGlowIcon.MoveToX(glow_icon_final_offset, fadeDuration, Easing.OutQuint);
|
||||
|
||||
leftBlurredIcon.MoveToX(-blurred_final_offset, fadeDuration, Easing.OutQuint);
|
||||
rightBlurredIcon.MoveToX(blurred_final_offset, fadeDuration, Easing.OutQuint);
|
||||
leftBlurredIcon.MoveToX(-blurred_icon_final_offset, fadeDuration, Easing.OutQuint);
|
||||
rightBlurredIcon.MoveToX(blurred_icon_final_offset, fadeDuration, Easing.OutQuint);
|
||||
}
|
||||
|
||||
public void Hide(double fadeDuration)
|
||||
{
|
||||
leftGlowIcon.MoveToX(-glowing_offscreen_offset, fadeDuration, Easing.OutQuint);
|
||||
rightGlowIcon.MoveToX(glowing_offscreen_offset, fadeDuration, Easing.OutQuint);
|
||||
leftGlowIcon.MoveToX(-glow_icon_offscreen_offset, fadeDuration, Easing.OutQuint);
|
||||
rightGlowIcon.MoveToX(glow_icon_offscreen_offset, fadeDuration, Easing.OutQuint);
|
||||
|
||||
leftBlurredIcon.MoveToX(-blurred_offscreen_offset, fadeDuration, Easing.OutQuint);
|
||||
rightBlurredIcon.MoveToX(blurred_offscreen_offset, fadeDuration, Easing.OutQuint);
|
||||
leftBlurredIcon.MoveToX(-blurred_icon_offscreen_offset, fadeDuration, Easing.OutQuint);
|
||||
rightBlurredIcon.MoveToX(blurred_icon_offscreen_offset, fadeDuration, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,14 +5,13 @@ using OpenTK;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
{
|
||||
public class BlurredIcon : BufferedContainer
|
||||
{
|
||||
private const int blur_sigma = 20;
|
||||
|
||||
private readonly GlowIcon icon;
|
||||
private readonly SpriteIcon icon;
|
||||
|
||||
public FontAwesome Icon
|
||||
{
|
||||
@ -25,22 +24,29 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
set
|
||||
{
|
||||
icon.Size = value;
|
||||
base.Size = value + new Vector2(blur_sigma * 2);
|
||||
base.Size = value + BlurSigma * 2.5f;
|
||||
ForceRedraw();
|
||||
}
|
||||
get { return icon.Size; }
|
||||
get { return base.Size; }
|
||||
}
|
||||
|
||||
public BlurredIcon()
|
||||
{
|
||||
RelativePositionAxes = Axes.X;
|
||||
BlurSigma = new Vector2(blur_sigma);
|
||||
Alpha = 0.6f;
|
||||
Alpha = 0.7f;
|
||||
CacheDrawnFrameBuffer = true;
|
||||
Child = icon = new GlowIcon
|
||||
Child = icon = new SpriteIcon
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Shadow = false,
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = colours.BlueLighter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
public class BreakOverlay : Container
|
||||
{
|
||||
private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2;
|
||||
private const float remaining_time_container_max_size = 0.35f;
|
||||
private const float remaining_time_container_max_size = 0.3f;
|
||||
private const int vertical_margin = 25;
|
||||
|
||||
public List<BreakPeriod> Breaks;
|
||||
|
@ -11,25 +11,29 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
{
|
||||
public class GlowIcon : Container
|
||||
{
|
||||
private const int blur_sigma = 5;
|
||||
|
||||
private readonly SpriteIcon spriteIcon;
|
||||
private readonly SpriteIcon glowIcon;
|
||||
private readonly BufferedContainer glowContainer;
|
||||
private readonly BlurredIcon blurredIcon;
|
||||
|
||||
public override Vector2 Size
|
||||
{
|
||||
set
|
||||
{
|
||||
spriteIcon.Size = glowIcon.Size = value;
|
||||
glowContainer.Size = value + new Vector2(blur_sigma * 2);
|
||||
blurredIcon.Size = value;
|
||||
spriteIcon.Size = value - new Vector2(10); //Make it a bit smaller to make blur more visible
|
||||
blurredIcon.ForceRedraw();
|
||||
}
|
||||
get { return spriteIcon.Size; }
|
||||
get { return base.Size; }
|
||||
}
|
||||
|
||||
public Vector2 BlurSigma
|
||||
{
|
||||
set { blurredIcon.BlurSigma = value; }
|
||||
get { return blurredIcon.BlurSigma; }
|
||||
}
|
||||
|
||||
public FontAwesome Icon
|
||||
{
|
||||
set { spriteIcon.Icon = glowIcon.Icon = value; }
|
||||
set { spriteIcon.Icon = blurredIcon.Icon = value; }
|
||||
get { return spriteIcon.Icon; }
|
||||
}
|
||||
|
||||
@ -39,19 +43,10 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
glowContainer = new BufferedContainer
|
||||
blurredIcon = new BlurredIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
BlurSigma = new Vector2(blur_sigma),
|
||||
CacheDrawnFrameBuffer = true,
|
||||
Child = glowIcon = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Shadow = false,
|
||||
},
|
||||
|
||||
},
|
||||
spriteIcon = new SpriteIcon
|
||||
{
|
||||
@ -65,7 +60,7 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
glowIcon.Colour = colours.BlueLight;
|
||||
blurredIcon.Colour = colours.Blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user