Renamed/removed various private constants

This commit is contained in:
DrabWeb
2017-01-30 08:45:10 -04:00
parent dbb9078e30
commit af8294f02c
3 changed files with 49 additions and 46 deletions

View File

@ -13,10 +13,10 @@ namespace osu.Game.Overlays.Pause
{ {
public class PauseButton : ClickableContainer public class PauseButton : ClickableContainer
{ {
private const float colourWidth = 0.8f; private const float hoverWidth = 0.9f;
private const float colourExpandedWidth = 0.9f; private const float hoverDuration = 500;
private const float colourExpandTime = 500; private const float glowFadeDuration = 250;
private Vector2 colourShear = new Vector2(0.2f, 0); private const float clickDuration = 200;
private Color4 backgroundColour = OsuColour.Gray(34); private Color4 backgroundColour = OsuColour.Gray(34);
@ -57,20 +57,20 @@ namespace osu.Game.Overlays.Pause
private Box leftGlow, centerGlow, rightGlow; private Box leftGlow, centerGlow, rightGlow;
private SpriteText spriteText; private SpriteText spriteText;
private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking
public override bool Contains(Vector2 screenSpacePos) => backgroundContainer.Contains(screenSpacePos); public override bool Contains(Vector2 screenSpacePos) => backgroundContainer.Contains(screenSpacePos);
protected override bool OnMouseDown(Framework.Input.InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(Framework.Input.InputState state, MouseDownEventArgs args)
{ {
didClick = true; didClick = true;
colourContainer.ResizeTo(new Vector2(1.5f, 1f), 200, EasingTypes.In); colourContainer.ResizeTo(new Vector2(1.5f, 1f), clickDuration, EasingTypes.In);
SampleClick?.Play(); SampleClick?.Play();
Action?.Invoke(); Action?.Invoke();
Delay(200); Delay(clickDuration);
Schedule(delegate { Schedule(delegate {
colourContainer.ResizeTo(new Vector2(colourWidth, 1f), 0, EasingTypes.None); colourContainer.ResizeTo(new Vector2(0.8f, 1f), 0, EasingTypes.None);
spriteText.Spacing = Vector2.Zero; spriteText.Spacing = Vector2.Zero;
glowContainer.Alpha = 0; glowContainer.Alpha = 0;
}); });
@ -82,9 +82,9 @@ namespace osu.Game.Overlays.Pause
protected override bool OnHover(Framework.Input.InputState state) protected override bool OnHover(Framework.Input.InputState state)
{ {
colourContainer.ResizeTo(new Vector2(colourExpandedWidth, 1f), colourExpandTime, EasingTypes.OutElastic); colourContainer.ResizeTo(new Vector2(hoverWidth, 1f), hoverDuration, EasingTypes.OutElastic);
spriteText.TransformSpacingTo(new Vector2(3f, 0f), colourExpandTime, EasingTypes.OutElastic); spriteText.TransformSpacingTo(new Vector2(3f, 0f), hoverDuration, EasingTypes.OutElastic);
glowContainer.FadeTo(1f, colourExpandTime / 2, EasingTypes.Out); glowContainer.FadeOut(glowFadeDuration, EasingTypes.Out);
SampleHover?.Play(); SampleHover?.Play();
return true; return true;
} }
@ -93,9 +93,9 @@ namespace osu.Game.Overlays.Pause
{ {
if (!didClick) if (!didClick)
{ {
colourContainer.ResizeTo(new Vector2(colourWidth, 1f), colourExpandTime, EasingTypes.OutElastic); colourContainer.ResizeTo(new Vector2(0.8f, 1f), hoverDuration, EasingTypes.OutElastic);
spriteText.TransformSpacingTo(Vector2.Zero, colourExpandTime, EasingTypes.OutElastic); spriteText.TransformSpacingTo(Vector2.Zero, hoverDuration, EasingTypes.OutElastic);
glowContainer.FadeTo(0f, colourExpandTime / 2, EasingTypes.Out); glowContainer.FadeOut(glowFadeDuration, EasingTypes.Out);
} }
didClick = false; didClick = false;
@ -172,7 +172,7 @@ namespace osu.Game.Overlays.Pause
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Width = colourWidth, Width = 0.8f,
Masking = true, Masking = true,
EdgeEffect = new EdgeEffect EdgeEffect = new EdgeEffect
{ {
@ -181,7 +181,7 @@ namespace osu.Game.Overlays.Pause
Radius = 5 Radius = 5
}, },
Colour = ButtonColour, Colour = ButtonColour,
Shear = colourShear, Shear = new Vector2(0.2f, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box
@ -195,7 +195,7 @@ namespace osu.Game.Overlays.Pause
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
TriangleScale = 4, TriangleScale = 4,
Alpha = 0.05f, Alpha = 0.05f,
Shear = -colourShear Shear = new Vector2(-0.2f, 0)
} }
} }
} }
@ -210,7 +210,7 @@ namespace osu.Game.Overlays.Pause
Font = "Exo2.0-Bold", Font = "Exo2.0-Bold",
Shadow = true, Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.1f), ShadowColour = new Color4(0, 0, 0, 0.1f),
Colour = Color4.White, Colour = Color4.White
} }
}); });

View File

@ -15,8 +15,9 @@ namespace osu.Game.Overlays.Pause
{ {
public class PauseOverlay : OverlayContainer public class PauseOverlay : OverlayContainer
{ {
private const int fadeDuration = 200; private const int transitionDuration = 200;
private const int buttonHeight = 70; private const int buttonHeight = 70;
private const float backgroundAlpha = 0.75f;
public Action OnResume; public Action OnResume;
public Action OnRetry; public Action OnRetry;
@ -27,8 +28,8 @@ namespace osu.Game.Overlays.Pause
public override bool Contains(Vector2 screenSpacePos) => true; public override bool Contains(Vector2 screenSpacePos) => true;
public override bool HandleInput => State == Visibility.Visible; public override bool HandleInput => State == Visibility.Visible;
protected override void PopIn() => FadeIn(fadeDuration, EasingTypes.In); protected override void PopIn() => FadeIn(transitionDuration, EasingTypes.In);
protected override void PopOut() => FadeOut(fadeDuration, EasingTypes.In); protected override void PopOut() => FadeOut(transitionDuration, EasingTypes.In);
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{ {
@ -37,7 +38,7 @@ namespace osu.Game.Overlays.Pause
case Key.Escape: case Key.Escape:
if (State == Visibility.Hidden) return false; if (State == Visibility.Hidden) return false;
Hide(); Hide();
Task.Delay(fadeDuration * 2).ContinueWith(task => OnResume?.Invoke()); Task.Delay(transitionDuration * 2).ContinueWith(task => OnResume?.Invoke());
return true; return true;
} }
return base.OnKeyDown(state, args); return base.OnKeyDown(state, args);
@ -52,7 +53,7 @@ namespace osu.Game.Overlays.Pause
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.Black, Colour = Color4.Black,
Alpha = 0.75f, Alpha = backgroundAlpha,
}, },
new FlowContainer new FlowContainer
{ {
@ -83,7 +84,7 @@ namespace osu.Game.Overlays.Pause
TextSize = 30, TextSize = 30,
Colour = colours.Yellow, Colour = colours.Yellow,
Shadow = true, Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f), ShadowColour = new Color4(0, 0, 0, 0.25f)
}, },
new SpriteText new SpriteText
{ {
@ -91,8 +92,8 @@ namespace osu.Game.Overlays.Pause
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Shadow = true, Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f), ShadowColour = new Color4(0, 0, 0, 0.25f)
}, }
} }
}, },
new FlowContainer new FlowContainer
@ -115,11 +116,11 @@ namespace osu.Game.Overlays.Pause
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Height = buttonHeight, Height = buttonHeight,
Action = (delegate Action = delegate
{ {
Hide(); Hide();
Task.Delay(fadeDuration * 2).ContinueWith(task => OnResume?.Invoke()); Task.Delay(transitionDuration * 2).ContinueWith(task => OnResume?.Invoke());
}), }
}, },
new RetryButton new RetryButton
{ {
@ -127,11 +128,11 @@ namespace osu.Game.Overlays.Pause
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Height = buttonHeight, Height = buttonHeight,
Action = (delegate Action = delegate
{ {
Hide(); Hide();
OnRetry?.Invoke(); OnRetry?.Invoke();
}), }
}, },
new QuitButton new QuitButton
{ {
@ -139,28 +140,28 @@ namespace osu.Game.Overlays.Pause
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Height = buttonHeight, Height = buttonHeight,
Action = (delegate Action = delegate
{ {
Hide(); Hide();
OnQuit?.Invoke(); OnQuit?.Invoke();
}), }
}, }
} }
}, },
retryCounterContainer = new FlowContainer retryCounterContainer = new FlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre
}, }
} }
}, },
new PauseProgressBar new PauseProgressBar
{ {
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Width = 1f, Width = 1f
}, }
}; };
SetRetries(0); SetRetries(0);

View File

@ -10,6 +10,9 @@ namespace osu.Game.Overlays.Pause
{ {
public class PauseProgressBar : Container public class PauseProgressBar : Container
{ {
private Color4 fillColour = new Color4(221, 255, 255, 255);
private Color4 glowColour = new Color4(221, 255, 255, 150);
private Container fill; private Container fill;
private WorkingBeatmap current; private WorkingBeatmap current;
@ -53,14 +56,13 @@ namespace osu.Game.Overlays.Pause
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = 5, Height = 5,
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = new Color4(0, 0, 0, 255), Colour = Color4.Black,
Alpha = 0.5f, Alpha = 0.5f
} }
} }
}, },
@ -91,18 +93,18 @@ namespace osu.Game.Overlays.Pause
EdgeEffect = new EdgeEffect EdgeEffect = new EdgeEffect
{ {
Type = EdgeEffectType.Glow, Type = EdgeEffectType.Glow,
Colour = new Color4(130, 204, 255, 150), Colour = glowColour,
Radius = 5, Radius = 5
}, },
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = new Color4(221, 255, 255, 255), Colour = fillColour
}
} }
} }
},
} }
}, },
new Container new Container
@ -116,7 +118,7 @@ namespace osu.Game.Overlays.Pause
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.White, Colour = Color4.White
}, },
new Container new Container
{ {