mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09: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
|
public class ArrowsOverlay : Container
|
||||||
{
|
{
|
||||||
private const int glowing_size = 60;
|
private const int glow_icon_size = 65;
|
||||||
private const float glowing_final_offset = 0.25f;
|
private const int glow_icon_blur_sigma = 8;
|
||||||
private const float glowing_offscreen_offset = 0.6f;
|
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 int blurred_icon_blur_sigma = 20;
|
||||||
private const float blurred_final_offset = 0.35f;
|
private const int blurred_icon_size = 130;
|
||||||
private const float blurred_offscreen_offset = 0.7f;
|
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 leftGlowIcon;
|
||||||
private readonly GlowIcon rightGlowIcon;
|
private readonly GlowIcon rightGlowIcon;
|
||||||
@ -32,53 +34,57 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
X = - glowing_offscreen_offset,
|
X = - glow_icon_offscreen_offset,
|
||||||
Icon = Graphics.FontAwesome.fa_chevron_right,
|
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
|
rightGlowIcon = new GlowIcon
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
X = glowing_offscreen_offset,
|
X = glow_icon_offscreen_offset,
|
||||||
Icon = Graphics.FontAwesome.fa_chevron_left,
|
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
|
leftBlurredIcon = new BlurredIcon
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
X = - blurred_offscreen_offset,
|
X = - blurred_icon_offscreen_offset,
|
||||||
Icon = Graphics.FontAwesome.fa_chevron_right,
|
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
|
rightBlurredIcon = new BlurredIcon
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
X = blurred_offscreen_offset,
|
X = blurred_icon_offscreen_offset,
|
||||||
Icon = Graphics.FontAwesome.fa_chevron_left,
|
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)
|
public void Show(double fadeDuration)
|
||||||
{
|
{
|
||||||
leftGlowIcon.MoveToX(-glowing_final_offset, fadeDuration, Easing.OutQuint);
|
leftGlowIcon.MoveToX(-glow_icon_final_offset, fadeDuration, Easing.OutQuint);
|
||||||
rightGlowIcon.MoveToX(glowing_final_offset, fadeDuration, Easing.OutQuint);
|
rightGlowIcon.MoveToX(glow_icon_final_offset, fadeDuration, Easing.OutQuint);
|
||||||
|
|
||||||
leftBlurredIcon.MoveToX(-blurred_final_offset, fadeDuration, Easing.OutQuint);
|
leftBlurredIcon.MoveToX(-blurred_icon_final_offset, fadeDuration, Easing.OutQuint);
|
||||||
rightBlurredIcon.MoveToX(blurred_final_offset, fadeDuration, Easing.OutQuint);
|
rightBlurredIcon.MoveToX(blurred_icon_final_offset, fadeDuration, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Hide(double fadeDuration)
|
public void Hide(double fadeDuration)
|
||||||
{
|
{
|
||||||
leftGlowIcon.MoveToX(-glowing_offscreen_offset, fadeDuration, Easing.OutQuint);
|
leftGlowIcon.MoveToX(-glow_icon_offscreen_offset, fadeDuration, Easing.OutQuint);
|
||||||
rightGlowIcon.MoveToX(glowing_offscreen_offset, fadeDuration, Easing.OutQuint);
|
rightGlowIcon.MoveToX(glow_icon_offscreen_offset, fadeDuration, Easing.OutQuint);
|
||||||
|
|
||||||
leftBlurredIcon.MoveToX(-blurred_offscreen_offset, fadeDuration, Easing.OutQuint);
|
leftBlurredIcon.MoveToX(-blurred_icon_offscreen_offset, fadeDuration, Easing.OutQuint);
|
||||||
rightBlurredIcon.MoveToX(blurred_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.Containers;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play.BreaksOverlay
|
namespace osu.Game.Screens.Play.BreaksOverlay
|
||||||
{
|
{
|
||||||
public class BlurredIcon : BufferedContainer
|
public class BlurredIcon : BufferedContainer
|
||||||
{
|
{
|
||||||
private const int blur_sigma = 20;
|
private readonly SpriteIcon icon;
|
||||||
|
|
||||||
private readonly GlowIcon icon;
|
|
||||||
|
|
||||||
public FontAwesome Icon
|
public FontAwesome Icon
|
||||||
{
|
{
|
||||||
@ -25,22 +24,29 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
icon.Size = value;
|
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()
|
public BlurredIcon()
|
||||||
{
|
{
|
||||||
RelativePositionAxes = Axes.X;
|
RelativePositionAxes = Axes.X;
|
||||||
BlurSigma = new Vector2(blur_sigma);
|
Alpha = 0.7f;
|
||||||
Alpha = 0.6f;
|
|
||||||
CacheDrawnFrameBuffer = true;
|
CacheDrawnFrameBuffer = true;
|
||||||
Child = icon = new GlowIcon
|
Child = icon = new SpriteIcon
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = 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
|
public class BreakOverlay : Container
|
||||||
{
|
{
|
||||||
private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2;
|
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;
|
private const int vertical_margin = 25;
|
||||||
|
|
||||||
public List<BreakPeriod> Breaks;
|
public List<BreakPeriod> Breaks;
|
||||||
|
@ -11,25 +11,29 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
|||||||
{
|
{
|
||||||
public class GlowIcon : Container
|
public class GlowIcon : Container
|
||||||
{
|
{
|
||||||
private const int blur_sigma = 5;
|
|
||||||
|
|
||||||
private readonly SpriteIcon spriteIcon;
|
private readonly SpriteIcon spriteIcon;
|
||||||
private readonly SpriteIcon glowIcon;
|
private readonly BlurredIcon blurredIcon;
|
||||||
private readonly BufferedContainer glowContainer;
|
|
||||||
|
|
||||||
public override Vector2 Size
|
public override Vector2 Size
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
spriteIcon.Size = glowIcon.Size = value;
|
blurredIcon.Size = value;
|
||||||
glowContainer.Size = value + new Vector2(blur_sigma * 2);
|
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
|
public FontAwesome Icon
|
||||||
{
|
{
|
||||||
set { spriteIcon.Icon = glowIcon.Icon = value; }
|
set { spriteIcon.Icon = blurredIcon.Icon = value; }
|
||||||
get { return spriteIcon.Icon; }
|
get { return spriteIcon.Icon; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,19 +43,10 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
|||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
glowContainer = new BufferedContainer
|
blurredIcon = new BlurredIcon
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = 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
|
spriteIcon = new SpriteIcon
|
||||||
{
|
{
|
||||||
@ -65,7 +60,7 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
glowIcon.Colour = colours.BlueLight;
|
blurredIcon.Colour = colours.Blue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user