mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Renamed Player.isPaused to IsPaused, did a small patch suggested for how the player can click through the pause menu onto the Playfield(only partially works, upstream changes need to be made for full functionality), made Retry default to Resume until retrying is implemented, minor cleanups
This commit is contained in:
parent
c75b234b1a
commit
28967cf77a
@ -21,7 +21,6 @@ namespace osu.Game.Overlays.Pause
|
||||
private float colourExpandTime = 500;
|
||||
private float shear = 0.2f;
|
||||
private float glowGradientEndAlpha = 0f;
|
||||
private double pressExpandTime = 100;
|
||||
|
||||
private Color4 buttonColour;
|
||||
private Color4 backgroundColour = OsuColour.Gray(34);
|
||||
@ -60,7 +59,7 @@ namespace osu.Game.Overlays.Pause
|
||||
|
||||
protected override bool OnMouseDown(Framework.Input.InputState state, MouseDownEventArgs args)
|
||||
{
|
||||
colourContainer.ResizeTo(new Vector2(1.1f, 1f), pressExpandTime, EasingTypes.In);
|
||||
colourContainer.ResizeTo(new Vector2(1.1f, 1f), 200, EasingTypes.In);
|
||||
sampleClick?.Play();
|
||||
Action?.Invoke();
|
||||
return true;
|
||||
@ -204,7 +203,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,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -23,13 +23,15 @@ namespace osu.Game.Overlays.Pause
|
||||
|
||||
private SpriteText retryCounter;
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ClickableContainer
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
||||
@ -147,15 +149,8 @@ namespace osu.Game.Overlays.Pause
|
||||
retryCounter.Text = $"You've retried {String.Format("{0:n0}", count)} time{(count == 1) ? "" : "s"} in this session";
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
FadeTo(1, fadeDuration, EasingTypes.In);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
FadeTo(0, fadeDuration, EasingTypes.In);
|
||||
}
|
||||
protected override void PopIn() => FadeIn(fadeDuration, EasingTypes.In);
|
||||
protected override void PopOut() => FadeOut(fadeDuration, EasingTypes.In);
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public PlayMode PreferredPlayMode;
|
||||
|
||||
public bool isPaused;
|
||||
public bool IsPaused;
|
||||
|
||||
private double pauseCooldown = 1000;
|
||||
private double lastActionTime = 0;
|
||||
@ -56,6 +56,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private ScoreOverlay scoreOverlay;
|
||||
private PauseOverlay pauseOverlay;
|
||||
private PlayerInputManager playerInputManager;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game, OsuConfigManager config)
|
||||
@ -123,7 +124,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new PlayerInputManager(game.Host)
|
||||
playerInputManager = new PlayerInputManager(game.Host)
|
||||
{
|
||||
Clock = new InterpolatingFramedClock(sourceClock),
|
||||
PassThrough = false,
|
||||
@ -142,35 +143,38 @@ namespace osu.Game.Screens.Play
|
||||
if (Time.Current >= (lastActionTime + pauseCooldown) || force)
|
||||
{
|
||||
lastActionTime = Time.Current;
|
||||
isPaused = true;
|
||||
playerInputManager.PassThrough = true;
|
||||
scoreOverlay.KeyCounter.IsCounting = false;
|
||||
pauseOverlay.Show();
|
||||
sourceClock.Stop();
|
||||
IsPaused = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isPaused = false;
|
||||
IsPaused = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Resume()
|
||||
{
|
||||
lastActionTime = Time.Current;
|
||||
isPaused = false;
|
||||
playerInputManager.PassThrough = false;
|
||||
scoreOverlay.KeyCounter.IsCounting = true;
|
||||
pauseOverlay.Hide();
|
||||
sourceClock.Start();
|
||||
IsPaused = false;
|
||||
}
|
||||
|
||||
public void TogglePaused()
|
||||
{
|
||||
isPaused = !isPaused;
|
||||
if (isPaused) Pause(); else Resume();
|
||||
IsPaused = !IsPaused;
|
||||
if (IsPaused) Pause(); else Resume();
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
// TODO: Implement retrying
|
||||
if (IsPaused) Resume();
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -237,12 +241,12 @@ namespace osu.Game.Screens.Play
|
||||
switch (args.Key)
|
||||
{
|
||||
case Key.Escape:
|
||||
if (!isPaused)
|
||||
if (!IsPaused)
|
||||
{
|
||||
Pause();
|
||||
return true;
|
||||
}
|
||||
else { return false; }
|
||||
return false;
|
||||
}
|
||||
return base.OnKeyDown(state, args);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user