mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 06:52:56 +08:00
Renamed/removed various private constants
This commit is contained in:
parent
dbb9078e30
commit
af8294f02c
@ -13,10 +13,10 @@ namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
public class PauseButton : ClickableContainer
|
||||
{
|
||||
private const float colourWidth = 0.8f;
|
||||
private const float colourExpandedWidth = 0.9f;
|
||||
private const float colourExpandTime = 500;
|
||||
private Vector2 colourShear = new Vector2(0.2f, 0);
|
||||
private const float hoverWidth = 0.9f;
|
||||
private const float hoverDuration = 500;
|
||||
private const float glowFadeDuration = 250;
|
||||
private const float clickDuration = 200;
|
||||
|
||||
private Color4 backgroundColour = OsuColour.Gray(34);
|
||||
|
||||
@ -57,20 +57,20 @@ namespace osu.Game.Overlays.Pause
|
||||
private Box leftGlow, centerGlow, rightGlow;
|
||||
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);
|
||||
|
||||
protected override bool OnMouseDown(Framework.Input.InputState state, MouseDownEventArgs args)
|
||||
{
|
||||
didClick = true;
|
||||
colourContainer.ResizeTo(new Vector2(1.5f, 1f), 200, EasingTypes.In);
|
||||
colourContainer.ResizeTo(new Vector2(1.5f, 1f), clickDuration, EasingTypes.In);
|
||||
SampleClick?.Play();
|
||||
Action?.Invoke();
|
||||
|
||||
Delay(200);
|
||||
Delay(clickDuration);
|
||||
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;
|
||||
glowContainer.Alpha = 0;
|
||||
});
|
||||
@ -82,9 +82,9 @@ namespace osu.Game.Overlays.Pause
|
||||
|
||||
protected override bool OnHover(Framework.Input.InputState state)
|
||||
{
|
||||
colourContainer.ResizeTo(new Vector2(colourExpandedWidth, 1f), colourExpandTime, EasingTypes.OutElastic);
|
||||
spriteText.TransformSpacingTo(new Vector2(3f, 0f), colourExpandTime, EasingTypes.OutElastic);
|
||||
glowContainer.FadeTo(1f, colourExpandTime / 2, EasingTypes.Out);
|
||||
colourContainer.ResizeTo(new Vector2(hoverWidth, 1f), hoverDuration, EasingTypes.OutElastic);
|
||||
spriteText.TransformSpacingTo(new Vector2(3f, 0f), hoverDuration, EasingTypes.OutElastic);
|
||||
glowContainer.FadeOut(glowFadeDuration, EasingTypes.Out);
|
||||
SampleHover?.Play();
|
||||
return true;
|
||||
}
|
||||
@ -93,9 +93,9 @@ namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
if (!didClick)
|
||||
{
|
||||
colourContainer.ResizeTo(new Vector2(colourWidth, 1f), colourExpandTime, EasingTypes.OutElastic);
|
||||
spriteText.TransformSpacingTo(Vector2.Zero, colourExpandTime, EasingTypes.OutElastic);
|
||||
glowContainer.FadeTo(0f, colourExpandTime / 2, EasingTypes.Out);
|
||||
colourContainer.ResizeTo(new Vector2(0.8f, 1f), hoverDuration, EasingTypes.OutElastic);
|
||||
spriteText.TransformSpacingTo(Vector2.Zero, hoverDuration, EasingTypes.OutElastic);
|
||||
glowContainer.FadeOut(glowFadeDuration, EasingTypes.Out);
|
||||
}
|
||||
|
||||
didClick = false;
|
||||
@ -172,7 +172,7 @@ namespace osu.Game.Overlays.Pause
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Width = colourWidth,
|
||||
Width = 0.8f,
|
||||
Masking = true,
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
@ -181,7 +181,7 @@ namespace osu.Game.Overlays.Pause
|
||||
Radius = 5
|
||||
},
|
||||
Colour = ButtonColour,
|
||||
Shear = colourShear,
|
||||
Shear = new Vector2(0.2f, 0),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
@ -195,7 +195,7 @@ namespace osu.Game.Overlays.Pause
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
TriangleScale = 4,
|
||||
Alpha = 0.05f,
|
||||
Shear = -colourShear
|
||||
Shear = new Vector2(-0.2f, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -210,7 +210,7 @@ namespace osu.Game.Overlays.Pause
|
||||
Font = "Exo2.0-Bold",
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.1f),
|
||||
Colour = Color4.White,
|
||||
Colour = Color4.White
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -15,8 +15,9 @@ namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
public class PauseOverlay : OverlayContainer
|
||||
{
|
||||
private const int fadeDuration = 200;
|
||||
private const int transitionDuration = 200;
|
||||
private const int buttonHeight = 70;
|
||||
private const float backgroundAlpha = 0.75f;
|
||||
|
||||
public Action OnResume;
|
||||
public Action OnRetry;
|
||||
@ -27,8 +28,8 @@ namespace osu.Game.Overlays.Pause
|
||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||
public override bool HandleInput => State == Visibility.Visible;
|
||||
|
||||
protected override void PopIn() => FadeIn(fadeDuration, EasingTypes.In);
|
||||
protected override void PopOut() => FadeOut(fadeDuration, EasingTypes.In);
|
||||
protected override void PopIn() => FadeIn(transitionDuration, EasingTypes.In);
|
||||
protected override void PopOut() => FadeOut(transitionDuration, EasingTypes.In);
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
@ -37,7 +38,7 @@ namespace osu.Game.Overlays.Pause
|
||||
case Key.Escape:
|
||||
if (State == Visibility.Hidden) return false;
|
||||
Hide();
|
||||
Task.Delay(fadeDuration * 2).ContinueWith(task => OnResume?.Invoke());
|
||||
Task.Delay(transitionDuration * 2).ContinueWith(task => OnResume?.Invoke());
|
||||
return true;
|
||||
}
|
||||
return base.OnKeyDown(state, args);
|
||||
@ -52,7 +53,7 @@ namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.75f,
|
||||
Alpha = backgroundAlpha,
|
||||
},
|
||||
new FlowContainer
|
||||
{
|
||||
@ -83,7 +84,7 @@ namespace osu.Game.Overlays.Pause
|
||||
TextSize = 30,
|
||||
Colour = colours.Yellow,
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.25f),
|
||||
ShadowColour = new Color4(0, 0, 0, 0.25f)
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
@ -91,8 +92,8 @@ namespace osu.Game.Overlays.Pause
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.25f),
|
||||
},
|
||||
ShadowColour = new Color4(0, 0, 0, 0.25f)
|
||||
}
|
||||
}
|
||||
},
|
||||
new FlowContainer
|
||||
@ -115,11 +116,11 @@ namespace osu.Game.Overlays.Pause
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Height = buttonHeight,
|
||||
Action = (delegate
|
||||
Action = delegate
|
||||
{
|
||||
Hide();
|
||||
Task.Delay(fadeDuration * 2).ContinueWith(task => OnResume?.Invoke());
|
||||
}),
|
||||
Task.Delay(transitionDuration * 2).ContinueWith(task => OnResume?.Invoke());
|
||||
}
|
||||
},
|
||||
new RetryButton
|
||||
{
|
||||
@ -127,11 +128,11 @@ namespace osu.Game.Overlays.Pause
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Height = buttonHeight,
|
||||
Action = (delegate
|
||||
Action = delegate
|
||||
{
|
||||
Hide();
|
||||
OnRetry?.Invoke();
|
||||
}),
|
||||
}
|
||||
},
|
||||
new QuitButton
|
||||
{
|
||||
@ -139,28 +140,28 @@ namespace osu.Game.Overlays.Pause
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Height = buttonHeight,
|
||||
Action = (delegate
|
||||
Action = delegate
|
||||
{
|
||||
Hide();
|
||||
OnQuit?.Invoke();
|
||||
}),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
retryCounterContainer = new FlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
},
|
||||
Anchor = Anchor.TopCentre
|
||||
}
|
||||
}
|
||||
},
|
||||
new PauseProgressBar
|
||||
{
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Width = 1f,
|
||||
},
|
||||
Width = 1f
|
||||
}
|
||||
};
|
||||
|
||||
SetRetries(0);
|
||||
|
@ -10,6 +10,9 @@ namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
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 WorkingBeatmap current;
|
||||
|
||||
@ -53,14 +56,13 @@ namespace osu.Game.Overlays.Pause
|
||||
Anchor = Anchor.BottomRight,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 5,
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new Color4(0, 0, 0, 255),
|
||||
Alpha = 0.5f,
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.5f
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -91,18 +93,18 @@ namespace osu.Game.Overlays.Pause
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Glow,
|
||||
Colour = new Color4(130, 204, 255, 150),
|
||||
Radius = 5,
|
||||
Colour = glowColour,
|
||||
Radius = 5
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new Color4(221, 255, 255, 255),
|
||||
Colour = fillColour
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
new Container
|
||||
@ -116,7 +118,7 @@ namespace osu.Game.Overlays.Pause
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.White,
|
||||
Colour = Color4.White
|
||||
},
|
||||
new Container
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user