mirror of
https://github.com/ppy/osu.git
synced 2025-03-15 21:17:46 +08:00
Made requested changes
This commit is contained in:
parent
ecaa88a0d2
commit
91a5d0b3cf
@ -29,7 +29,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
AddButton("Add Retry", delegate
|
||||
{
|
||||
retryCount++;
|
||||
pauseOverlay.SetRetries(retryCount);
|
||||
pauseOverlay.Retries = retryCount;
|
||||
});
|
||||
|
||||
pauseOverlay.OnResume += () => Logger.Log(@"Resume");
|
||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Pause
|
||||
set
|
||||
{
|
||||
buttonColour = value;
|
||||
reapplyGlow();
|
||||
updateGlow();
|
||||
if (colourContainer == null) return;
|
||||
colourContainer.Colour = ButtonColour;
|
||||
}
|
||||
@ -118,9 +118,8 @@ namespace osu.Game.Overlays.Pause
|
||||
flash.Expire();
|
||||
}
|
||||
|
||||
private void reapplyGlow()
|
||||
private void updateGlow()
|
||||
{
|
||||
if (leftGlow == null || centerGlow == null || rightGlow == null) return;
|
||||
leftGlow.ColourInfo = ColourInfo.GradientHorizontal(new Color4(ButtonColour.R, ButtonColour.G, ButtonColour.B, 0f), ButtonColour);
|
||||
centerGlow.Colour = ButtonColour;
|
||||
rightGlow.ColourInfo = ColourInfo.GradientHorizontal(ButtonColour, new Color4(ButtonColour.R, ButtonColour.G, ButtonColour.B, 0f));
|
||||
@ -228,7 +227,7 @@ namespace osu.Game.Overlays.Pause
|
||||
}
|
||||
};
|
||||
|
||||
reapplyGlow();
|
||||
updateGlow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,31 +15,67 @@ namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
public class PauseOverlay : OverlayContainer
|
||||
{
|
||||
private const int transitionDuration = 200;
|
||||
private const int buttonHeight = 70;
|
||||
private const float backgroundAlpha = 0.75f;
|
||||
private const int transition_duration = 200;
|
||||
private const int button_height = 70;
|
||||
private const float background_alpha = 0.75f;
|
||||
|
||||
public Action OnResume;
|
||||
public Action OnRetry;
|
||||
public Action OnQuit;
|
||||
|
||||
public int Retries
|
||||
{
|
||||
set
|
||||
{
|
||||
if (retryCounterContainer != null)
|
||||
{
|
||||
// "You've retried 1,065 times in this session"
|
||||
// "You've retried 1 time in this session"
|
||||
|
||||
retryCounterContainer.Children = new Drawable[]
|
||||
{
|
||||
new SpriteText
|
||||
{
|
||||
Text = "You've retried ",
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.25f),
|
||||
TextSize = 18
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = String.Format("{0:n0}", value),
|
||||
Font = @"Exo2.0-Bold",
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.25f),
|
||||
TextSize = 18
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = $" time{((value == 1) ? "" : "s")} in this session",
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.25f),
|
||||
TextSize = 18
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private FlowContainer retryCounterContainer;
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||
public override bool HandleInput => State == Visibility.Visible;
|
||||
|
||||
protected override void PopIn() => FadeIn(transitionDuration, EasingTypes.In);
|
||||
protected override void PopOut() => FadeOut(transitionDuration, EasingTypes.In);
|
||||
protected override void PopIn() => FadeIn(transition_duration, EasingTypes.In);
|
||||
protected override void PopOut() => FadeOut(transition_duration, EasingTypes.In);
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
switch (args.Key)
|
||||
if (args.Key == Key.Escape)
|
||||
{
|
||||
case Key.Escape:
|
||||
if (State == Visibility.Hidden) return false;
|
||||
Hide();
|
||||
OnResume?.Invoke();
|
||||
return true;
|
||||
if (State == Visibility.Hidden) return false;
|
||||
resume();
|
||||
return true;
|
||||
}
|
||||
return base.OnKeyDown(state, args);
|
||||
}
|
||||
@ -53,7 +89,7 @@ namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
Alpha = backgroundAlpha,
|
||||
Alpha = background_alpha,
|
||||
},
|
||||
new FlowContainer
|
||||
{
|
||||
@ -88,7 +124,7 @@ namespace osu.Game.Overlays.Pause
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = @"you're not going to do what i think you're going to do, ain't ya?",
|
||||
Text = @"you're not going to do what i think you're going to do, are ya?",
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Shadow = true,
|
||||
@ -104,9 +140,8 @@ namespace osu.Game.Overlays.Pause
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Colour = new Color4(0, 0, 0, 150),
|
||||
Radius = 50,
|
||||
Offset = new Vector2(0, 0),
|
||||
Colour = Color4.Black.Opacity(0.6f),
|
||||
Radius = 50
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -115,19 +150,15 @@ namespace osu.Game.Overlays.Pause
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Height = buttonHeight,
|
||||
Action = delegate
|
||||
{
|
||||
Hide();
|
||||
OnResume?.Invoke();
|
||||
}
|
||||
Height = button_height,
|
||||
Action = resume
|
||||
},
|
||||
new RetryButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Height = buttonHeight,
|
||||
Height = button_height,
|
||||
Action = delegate
|
||||
{
|
||||
Hide();
|
||||
@ -139,7 +170,7 @@ namespace osu.Game.Overlays.Pause
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Height = buttonHeight,
|
||||
Height = button_height,
|
||||
Action = delegate
|
||||
{
|
||||
Hide();
|
||||
@ -164,47 +195,14 @@ namespace osu.Game.Overlays.Pause
|
||||
}
|
||||
};
|
||||
|
||||
SetRetries(0);
|
||||
Retries = 0;
|
||||
}
|
||||
|
||||
public void SetRetries(int count)
|
||||
private void resume()
|
||||
{
|
||||
if (retryCounterContainer != null)
|
||||
{
|
||||
// "You've retried 1,065 times in this session"
|
||||
// "You've retried 1 time in this session"
|
||||
|
||||
string leading = "You've retried ";
|
||||
string countString = String.Format("{0:n0}", count);
|
||||
string trailing = $" time{((count == 1) ? "" : "s")} in this session";
|
||||
|
||||
retryCounterContainer.Children = new Drawable[]
|
||||
{
|
||||
new SpriteText
|
||||
{
|
||||
Text = leading,
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.25f),
|
||||
TextSize = 18
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = countString,
|
||||
Font = @"Exo2.0-Bold",
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.25f),
|
||||
TextSize = 18
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = trailing,
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.25f),
|
||||
TextSize = 18
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Hide();
|
||||
OnResume?.Invoke();
|
||||
}
|
||||
|
||||
public PauseOverlay()
|
||||
{
|
||||
|
@ -163,7 +163,7 @@ namespace osu.Game.Screens.Play
|
||||
lastPauseActionTime = Time.Current;
|
||||
playerInputManager.PassThrough = true;
|
||||
scoreOverlay.KeyCounter.IsCounting = false;
|
||||
pauseOverlay.SetRetries(RestartCount);
|
||||
pauseOverlay.Retries = RestartCount;
|
||||
pauseOverlay.Show();
|
||||
sourceClock.Stop();
|
||||
isPaused = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user