mirror of
https://github.com/ppy/osu
synced 2024-12-16 20:05:41 +00:00
Merge branch 'master' into fix-model-import
This commit is contained in:
commit
77da100c0f
@ -39,6 +39,11 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
|
||||
private int downCount;
|
||||
|
||||
private const float pressed_scale = 1.2f;
|
||||
private const float released_scale = 1f;
|
||||
|
||||
private float targetScale => downCount > 0 ? pressed_scale : released_scale;
|
||||
|
||||
public bool OnPressed(OsuAction action)
|
||||
{
|
||||
switch (action)
|
||||
@ -46,7 +51,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
case OsuAction.LeftButton:
|
||||
case OsuAction.RightButton:
|
||||
downCount++;
|
||||
ActiveCursor.ScaleTo(1).ScaleTo(1.2f, 100, Easing.OutQuad);
|
||||
ActiveCursor.ScaleTo(released_scale).ScaleTo(targetScale, 100, Easing.OutQuad);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -60,7 +65,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
case OsuAction.LeftButton:
|
||||
case OsuAction.RightButton:
|
||||
if (--downCount == 0)
|
||||
ActiveCursor.ScaleTo(1, 200, Easing.OutQuad);
|
||||
ActiveCursor.ScaleTo(targetScale, 200, Easing.OutQuad);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -72,13 +77,13 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
protected override void PopIn()
|
||||
{
|
||||
fadeContainer.FadeTo(1, 300, Easing.OutQuint);
|
||||
ActiveCursor.ScaleTo(1, 400, Easing.OutQuint);
|
||||
ActiveCursor.ScaleTo(targetScale, 400, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
fadeContainer.FadeTo(0.05f, 450, Easing.OutQuint);
|
||||
ActiveCursor.ScaleTo(0.8f, 450, Easing.OutQuint);
|
||||
ActiveCursor.ScaleTo(targetScale * 0.8f, 450, Easing.OutQuint);
|
||||
}
|
||||
|
||||
public class OsuCursor : Container
|
||||
|
@ -18,7 +18,6 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
IsCounting = true,
|
||||
Children = new KeyCounter[]
|
||||
{
|
||||
new KeyCounterKeyboard(Key.Z),
|
||||
|
@ -89,6 +89,14 @@ namespace osu.Game.Rulesets.UI
|
||||
Ruleset = ruleset;
|
||||
playfield = new Lazy<Playfield>(CreatePlayfield);
|
||||
|
||||
IsPaused.ValueChanged += paused =>
|
||||
{
|
||||
if (HasReplayLoaded)
|
||||
return;
|
||||
|
||||
KeyBindingInputManager.UseParentInput = !paused;
|
||||
};
|
||||
|
||||
Cursor = CreateCursor();
|
||||
}
|
||||
|
||||
@ -120,6 +128,11 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
public Replay Replay { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the game is paused. Used to block user input.
|
||||
/// </summary>
|
||||
public readonly BindableBool IsPaused = new BindableBool();
|
||||
|
||||
/// <summary>
|
||||
/// Sets a replay to be used, overriding local input.
|
||||
/// </summary>
|
||||
|
@ -195,7 +195,6 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected virtual KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection
|
||||
{
|
||||
IsCounting = true,
|
||||
FadeTime = 50,
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Screens.Play
|
||||
private Container textLayer;
|
||||
private SpriteText countSpriteText;
|
||||
|
||||
public bool IsCounting { get; set; }
|
||||
public bool IsCounting { get; set; } = true;
|
||||
private int countPresses;
|
||||
public int CountPresses
|
||||
{
|
||||
|
@ -53,8 +53,7 @@ namespace osu.Game.Screens.Play
|
||||
configVisibility.BindValueChanged(_ => updateVisibility(), true);
|
||||
}
|
||||
|
||||
//further: change default values here and in KeyCounter if needed, instead of passing them in every constructor
|
||||
private bool isCounting;
|
||||
private bool isCounting = true;
|
||||
public bool IsCounting
|
||||
{
|
||||
get { return isCounting; }
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Timing;
|
||||
@ -18,7 +19,7 @@ namespace osu.Game.Screens.Play
|
||||
/// </summary>
|
||||
public class PauseContainer : Container
|
||||
{
|
||||
public bool IsPaused { get; private set; }
|
||||
public readonly BindableBool IsPaused = new BindableBool();
|
||||
|
||||
public Func<bool> CheckCanPause;
|
||||
|
||||
@ -39,9 +40,6 @@ namespace osu.Game.Screens.Play
|
||||
public Action OnRetry;
|
||||
public Action OnQuit;
|
||||
|
||||
public Action OnResume;
|
||||
public Action OnPause;
|
||||
|
||||
private readonly FramedClock framedClock;
|
||||
private readonly DecoupleableInterpolatingFramedClock decoupledClock;
|
||||
|
||||
@ -84,9 +82,8 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
// stop the seekable clock (stops the audio eventually)
|
||||
decoupledClock.Stop();
|
||||
IsPaused = true;
|
||||
IsPaused.Value = true;
|
||||
|
||||
OnPause?.Invoke();
|
||||
pauseOverlay.Show();
|
||||
|
||||
lastPauseActionTime = Time.Current;
|
||||
@ -96,7 +93,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
if (!IsPaused) return;
|
||||
|
||||
IsPaused = false;
|
||||
IsPaused.Value = false;
|
||||
IsResuming = false;
|
||||
lastPauseActionTime = Time.Current;
|
||||
|
||||
@ -105,7 +102,6 @@ namespace osu.Game.Screens.Play
|
||||
decoupledClock.Seek(decoupledClock.CurrentTime);
|
||||
decoupledClock.Start();
|
||||
|
||||
OnResume?.Invoke();
|
||||
pauseOverlay.Hide();
|
||||
}
|
||||
|
||||
|
@ -162,15 +162,10 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
pauseContainer = new PauseContainer(offsetClock, adjustableClock)
|
||||
{
|
||||
Retries = RestartCount,
|
||||
OnRetry = Restart,
|
||||
OnQuit = Exit,
|
||||
CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded,
|
||||
OnPause = () =>
|
||||
{
|
||||
pauseContainer.Retries = RestartCount;
|
||||
hudOverlay.KeyCounter.IsCounting = !pauseContainer.IsPaused;
|
||||
},
|
||||
OnResume = () => hudOverlay.KeyCounter.IsCounting = true,
|
||||
Children = new[]
|
||||
{
|
||||
storyboardContainer = new Container
|
||||
@ -227,6 +222,8 @@ namespace osu.Game.Screens.Play
|
||||
hudOverlay.HoldToQuit.Action = Exit;
|
||||
hudOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded);
|
||||
|
||||
RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused);
|
||||
|
||||
if (ShowStoryboard)
|
||||
initializeStoryboard(false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user