mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 21:12:55 +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 colourExpandTime = 500;
|
||||||
private float shear = 0.2f;
|
private float shear = 0.2f;
|
||||||
private float glowGradientEndAlpha = 0f;
|
private float glowGradientEndAlpha = 0f;
|
||||||
private double pressExpandTime = 100;
|
|
||||||
|
|
||||||
private Color4 buttonColour;
|
private Color4 buttonColour;
|
||||||
private Color4 backgroundColour = OsuColour.Gray(34);
|
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)
|
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();
|
sampleClick?.Play();
|
||||||
Action?.Invoke();
|
Action?.Invoke();
|
||||||
return true;
|
return true;
|
||||||
@ -204,7 +203,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,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -23,13 +23,15 @@ namespace osu.Game.Overlays.Pause
|
|||||||
|
|
||||||
private SpriteText retryCounter;
|
private SpriteText retryCounter;
|
||||||
|
|
||||||
|
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||||
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new ClickableContainer
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
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";
|
retryCounter.Text = $"You've retried {String.Format("{0:n0}", count)} time{(count == 1) ? "" : "s"} in this session";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn() => FadeIn(fadeDuration, EasingTypes.In);
|
||||||
{
|
protected override void PopOut() => FadeOut(fadeDuration, EasingTypes.In);
|
||||||
FadeTo(1, fadeDuration, EasingTypes.In);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void PopOut()
|
|
||||||
{
|
|
||||||
FadeTo(0, fadeDuration, EasingTypes.In);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public PlayMode PreferredPlayMode;
|
public PlayMode PreferredPlayMode;
|
||||||
|
|
||||||
public bool isPaused;
|
public bool IsPaused;
|
||||||
|
|
||||||
private double pauseCooldown = 1000;
|
private double pauseCooldown = 1000;
|
||||||
private double lastActionTime = 0;
|
private double lastActionTime = 0;
|
||||||
@ -56,6 +56,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private ScoreOverlay scoreOverlay;
|
private ScoreOverlay scoreOverlay;
|
||||||
private PauseOverlay pauseOverlay;
|
private PauseOverlay pauseOverlay;
|
||||||
|
private PlayerInputManager playerInputManager;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game, OsuConfigManager config)
|
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game, OsuConfigManager config)
|
||||||
@ -123,7 +124,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new PlayerInputManager(game.Host)
|
playerInputManager = new PlayerInputManager(game.Host)
|
||||||
{
|
{
|
||||||
Clock = new InterpolatingFramedClock(sourceClock),
|
Clock = new InterpolatingFramedClock(sourceClock),
|
||||||
PassThrough = false,
|
PassThrough = false,
|
||||||
@ -142,35 +143,38 @@ namespace osu.Game.Screens.Play
|
|||||||
if (Time.Current >= (lastActionTime + pauseCooldown) || force)
|
if (Time.Current >= (lastActionTime + pauseCooldown) || force)
|
||||||
{
|
{
|
||||||
lastActionTime = Time.Current;
|
lastActionTime = Time.Current;
|
||||||
isPaused = true;
|
playerInputManager.PassThrough = true;
|
||||||
scoreOverlay.KeyCounter.IsCounting = false;
|
scoreOverlay.KeyCounter.IsCounting = false;
|
||||||
pauseOverlay.Show();
|
pauseOverlay.Show();
|
||||||
sourceClock.Stop();
|
sourceClock.Stop();
|
||||||
|
IsPaused = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isPaused = false;
|
IsPaused = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Resume()
|
public void Resume()
|
||||||
{
|
{
|
||||||
lastActionTime = Time.Current;
|
lastActionTime = Time.Current;
|
||||||
isPaused = false;
|
playerInputManager.PassThrough = false;
|
||||||
scoreOverlay.KeyCounter.IsCounting = true;
|
scoreOverlay.KeyCounter.IsCounting = true;
|
||||||
pauseOverlay.Hide();
|
pauseOverlay.Hide();
|
||||||
sourceClock.Start();
|
sourceClock.Start();
|
||||||
|
IsPaused = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TogglePaused()
|
public void TogglePaused()
|
||||||
{
|
{
|
||||||
isPaused = !isPaused;
|
IsPaused = !IsPaused;
|
||||||
if (isPaused) Pause(); else Resume();
|
if (IsPaused) Pause(); else Resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Restart()
|
public void Restart()
|
||||||
{
|
{
|
||||||
// TODO: Implement retrying
|
// TODO: Implement retrying
|
||||||
|
if (IsPaused) Resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -237,12 +241,12 @@ namespace osu.Game.Screens.Play
|
|||||||
switch (args.Key)
|
switch (args.Key)
|
||||||
{
|
{
|
||||||
case Key.Escape:
|
case Key.Escape:
|
||||||
if (!isPaused)
|
if (!IsPaused)
|
||||||
{
|
{
|
||||||
Pause();
|
Pause();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else { return false; }
|
return false;
|
||||||
}
|
}
|
||||||
return base.OnKeyDown(state, args);
|
return base.OnKeyDown(state, args);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user