Add arrows overlay

This commit is contained in:
EVAST9919 2017-09-22 01:16:05 +03:00
parent 5383e33f3d
commit 56bde64839
5 changed files with 129 additions and 79 deletions

View File

@ -0,0 +1,84 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
using OpenTK;
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 blurred_size = 130;
private const float blurred_final_offset = 0.35f;
private const float blurred_offscreen_offset = 0.7f;
private readonly GlowIcon leftGlowIcon;
private readonly GlowIcon rightGlowIcon;
private readonly BlurredIcon leftBlurredIcon;
private readonly BlurredIcon rightBlurredIcon;
public ArrowsOverlay()
{
RelativeSizeAxes = Axes.Both;
Children = new Drawable[]
{
leftGlowIcon = new GlowIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.CentreRight,
X = - glowing_offscreen_offset,
Icon = Graphics.FontAwesome.fa_chevron_right,
Size = new Vector2(glowing_size),
},
rightGlowIcon = new GlowIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft,
X = glowing_offscreen_offset,
Icon = Graphics.FontAwesome.fa_chevron_left,
Size = new Vector2(glowing_size),
},
leftBlurredIcon = new BlurredIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.CentreRight,
X = - blurred_offscreen_offset,
Icon = Graphics.FontAwesome.fa_chevron_right,
Size = new Vector2(blurred_size),
},
rightBlurredIcon = new BlurredIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft,
X = blurred_offscreen_offset,
Icon = Graphics.FontAwesome.fa_chevron_left,
Size = new Vector2(blurred_size),
},
};
}
public void Show(double fadeDuration)
{
leftGlowIcon.MoveToX(-glowing_final_offset, fadeDuration, Easing.OutQuint);
rightGlowIcon.MoveToX(glowing_final_offset, fadeDuration, Easing.OutQuint);
leftBlurredIcon.MoveToX(-blurred_final_offset, fadeDuration, Easing.OutQuint);
rightBlurredIcon.MoveToX(blurred_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);
leftBlurredIcon.MoveToX(-blurred_offscreen_offset, fadeDuration, Easing.OutQuint);
rightBlurredIcon.MoveToX(blurred_offscreen_offset, fadeDuration, Easing.OutQuint);
}
}
}

View File

@ -10,9 +10,9 @@ namespace osu.Game.Screens.Play.BreaksOverlay
{
public class BlurredIcon : BufferedContainer
{
private const int icon_size = 130;
private const int blur_sigma = 20;
private readonly GlowingIcon icon;
private readonly GlowIcon icon;
public FontAwesome Icon
{
@ -20,20 +20,26 @@ public FontAwesome Icon
get { return icon.Icon; }
}
public override Vector2 Size
{
set
{
icon.Size = value;
base.Size = value + new Vector2(blur_sigma * 2);
}
get { return icon.Size; }
}
public BlurredIcon()
{
Anchor = Anchor.CentreLeft;
RelativePositionAxes = Axes.X;
Size = new Vector2(icon_size * 1.7f);
Masking = true;
BlurSigma = new Vector2(20);
BlurSigma = new Vector2(blur_sigma);
Alpha = 0.6f;
CacheDrawnFrameBuffer = true;
Child = icon = new GlowingIcon
Child = icon = new GlowIcon
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Size = new Vector2(icon_size),
};
}
}

View File

@ -15,9 +15,6 @@ 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 int vertical_margin = 25;
private const float glowing_x_offset = 0.13f;
private const float glowing_x_final = 0.22f;
private const float blurred_x_offset = 0.2f;
public List<BreakPeriod> Breaks;
@ -26,12 +23,7 @@ public class BreakOverlay : Container
private readonly Container remainingTimeBox;
private readonly RemainingTimeCounter remainingTimeCounter;
private readonly InfoContainer info;
private readonly GlowingIcon leftGlowingIcon;
private readonly GlowingIcon rightGlowingIcon;
private readonly BlurredIcon leftBlurredIcon;
private readonly BlurredIcon rightBlurredIcon;
private readonly ArrowsOverlay arrowsOverlay;
public BreakOverlay(bool letterboxing)
{
@ -67,31 +59,10 @@ public BreakOverlay(bool letterboxing)
Origin = Anchor.TopCentre,
Margin = new MarginPadding { Top = vertical_margin },
},
leftGlowingIcon = new GlowingIcon
arrowsOverlay = new ArrowsOverlay
{
Origin = Anchor.CentreRight,
Icon = Graphics.FontAwesome.fa_chevron_left,
Size = new Vector2(60),
X = 1 + glowing_x_offset,
},
rightGlowingIcon = new GlowingIcon
{
Origin = Anchor.CentreLeft,
Icon = Graphics.FontAwesome.fa_chevron_right,
Size = new Vector2(60),
X = -glowing_x_offset,
},
leftBlurredIcon = new BlurredIcon
{
Origin = Anchor.CentreRight,
Icon = Graphics.FontAwesome.fa_chevron_left,
X = 1 + blurred_x_offset,
},
rightBlurredIcon = new BlurredIcon
{
Origin = Anchor.CentreLeft,
Icon = Graphics.FontAwesome.fa_chevron_right,
X = -blurred_x_offset,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
};
}
@ -136,12 +107,7 @@ private void onBreakIn(BreakPeriod b)
remainingTimeCounter.FadeIn(fade_duration);
info.FadeIn(fade_duration);
leftGlowingIcon.MoveToX(1 - glowing_x_final, fade_duration, Easing.OutQuint);
rightGlowingIcon.MoveToX(glowing_x_final, fade_duration, Easing.OutQuint);
leftBlurredIcon.MoveToX(1, fade_duration, Easing.OutQuint);
rightBlurredIcon.MoveToX(0, fade_duration, Easing.OutQuint);
arrowsOverlay.Show(fade_duration);
}
private void onBreakOut()
@ -151,12 +117,7 @@ private void onBreakOut()
remainingTimeCounter.FadeOut(fade_duration);
info.FadeOut(fade_duration);
leftGlowingIcon.MoveToX(1 + glowing_x_offset, fade_duration, Easing.OutQuint);
rightGlowingIcon.MoveToX(-glowing_x_offset, fade_duration, Easing.OutQuint);
leftBlurredIcon.MoveToX(1 + blurred_x_offset, fade_duration, Easing.OutQuint);
rightBlurredIcon.MoveToX(-blurred_x_offset, fade_duration, Easing.OutQuint);
arrowsOverlay.Hide(fade_duration);
}
}
}

View File

@ -1,42 +1,40 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using OpenTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
namespace osu.Game.Screens.Play.BreaksOverlay
{
public class GlowingIcon : Container
public class GlowIcon : Container
{
private readonly SpriteIcon icon;
private readonly SpriteIcon glow;
private readonly BufferedContainer glowContainer;
private const int blur_sigma = 5;
public FontAwesome Icon
{
set { icon.Icon = glow.Icon = value; }
get { return icon.Icon; }
}
private readonly SpriteIcon spriteIcon;
private readonly SpriteIcon glowIcon;
private readonly BufferedContainer glowContainer;
public override Vector2 Size
{
set
{
glow.Size = icon.Size = value;
glowContainer.Size = value * 1.5f;
}
get
{
return glow.Size;
spriteIcon.Size = glowIcon.Size = value;
glowContainer.Size = value + new Vector2(blur_sigma * 2);
}
get { return spriteIcon.Size; }
}
public GlowingIcon()
public FontAwesome Icon
{
set { spriteIcon.Icon = glowIcon.Icon = value; }
get { return spriteIcon.Icon; }
}
public GlowIcon()
{
Anchor = Anchor.CentreLeft;
RelativePositionAxes = Axes.X;
AutoSizeAxes = Axes.Both;
Children = new Drawable[]
@ -45,17 +43,17 @@ public GlowingIcon()
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Masking = true,
BlurSigma = new Vector2(10),
BlurSigma = new Vector2(blur_sigma),
CacheDrawnFrameBuffer = true,
Child = glow = new SpriteIcon
Child = glowIcon = new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Shadow = false,
},
},
icon = new SpriteIcon
spriteIcon = new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -67,7 +65,7 @@ public GlowingIcon()
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
glow.Colour = colours.Blue;
glowIcon.Colour = colours.BlueLight;
}
}
}

View File

@ -275,9 +275,10 @@
<Compile Include="Beatmaps\Formats\OsuLegacyDecoder.cs" />
<Compile Include="Beatmaps\IO\ArchiveReader.cs" />
<Compile Include="Beatmaps\IO\LegacyFilesystemReader.cs" />
<Compile Include="Screens\Play\BreaksOverlay\ArrowsOverlay.cs" />
<Compile Include="Screens\Play\BreaksOverlay\BlurredIcon.cs" />
<Compile Include="Screens\Play\BreaksOverlay\BreakOverlay.cs" />
<Compile Include="Screens\Play\BreaksOverlay\GlowingIcon.cs" />
<Compile Include="Screens\Play\BreaksOverlay\GlowIcon.cs" />
<Compile Include="Screens\Play\BreaksOverlay\InfoContainer.cs" />
<Compile Include="Screens\Play\BreaksOverlay\LetterboxOverlay.cs" />
<Compile Include="Screens\Play\BreaksOverlay\RemainingTimeCounter.cs" />