1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 06:03:08 +08:00

Merge master into beatmap-serialization

This commit is contained in:
smoogipoo 2017-12-21 22:13:53 +09:00
parent 866d1c6e0f
commit 790aa8be2a
4 changed files with 64 additions and 51 deletions

@ -1 +1 @@
Subproject commit e41fa9e90ae8261afa2962ee9fddb5b68491212c Subproject commit f4fde31f8c09305d2130064da2f7bae995be8286

View File

@ -5,11 +5,12 @@ using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
namespace osu.Game.Input.Bindings namespace osu.Game.Input.Bindings
{ {
public class GlobalKeyBindingInputManager : DatabasedKeyBindingInputManager<GlobalAction> public class GlobalKeyBindingInputManager : DatabasedKeyBindingInputManager<GlobalAction>, IHandleGlobalInput
{ {
private readonly Drawable handler; private readonly Drawable handler;

View File

@ -26,6 +26,8 @@ namespace osu.Game.Screens.Play
protected override bool BlockPassThroughKeyboard => true; protected override bool BlockPassThroughKeyboard => true;
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
public Action OnRetry; public Action OnRetry;
public Action OnQuit; public Action OnQuit;
@ -122,44 +124,21 @@ namespace osu.Game.Screens.Play
}, },
}; };
Retries = 0; updateRetryCount();
} }
private int retries;
public int Retries public int Retries
{ {
set set
{ {
if (retryCounterContainer != null) if (value == retries)
{ return;
// "You've retried 1,065 times in this session"
// "You've retried 1 time in this session"
retryCounterContainer.Children = new Drawable[] retries = value;
{ if (retryCounterContainer != null)
new OsuSpriteText updateRetryCount();
{
Text = "You've retried ",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18
},
new OsuSpriteText
{
Text = $"{value:n0}",
Font = @"Exo2.0-Bold",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18
},
new OsuSpriteText
{
Text = $" time{(value == 1 ? "" : "s")} in this session",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18
}
};
}
} }
} }
@ -197,6 +176,7 @@ namespace osu.Game.Screens.Play
} }
private int _selectionIndex = -1; private int _selectionIndex = -1;
private int selectionIndex private int selectionIndex
{ {
get { return _selectionIndex; } get { return _selectionIndex; }
@ -219,26 +199,26 @@ namespace osu.Game.Screens.Play
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{ {
if (args.Repeat) if (!args.Repeat)
return false;
switch (args.Key)
{ {
case Key.Up: switch (args.Key)
if (selectionIndex == -1 || selectionIndex == 0) {
selectionIndex = InternalButtons.Count - 1; case Key.Up:
else if (selectionIndex == -1 || selectionIndex == 0)
selectionIndex--; selectionIndex = InternalButtons.Count - 1;
return true; else
case Key.Down: selectionIndex--;
if (selectionIndex == -1 || selectionIndex == InternalButtons.Count - 1) return true;
selectionIndex = 0; case Key.Down:
else if (selectionIndex == -1 || selectionIndex == InternalButtons.Count - 1)
selectionIndex++; selectionIndex = 0;
return true; else
selectionIndex++;
return true;
}
} }
return false; return base.OnKeyDown(state, args);
} }
private void buttonSelectionChanged(DialogButton button, bool isSelected) private void buttonSelectionChanged(DialogButton button, bool isSelected)
@ -249,6 +229,38 @@ namespace osu.Game.Screens.Play
selectionIndex = InternalButtons.IndexOf(button); selectionIndex = InternalButtons.IndexOf(button);
} }
private void updateRetryCount()
{
// "You've retried 1,065 times in this session"
// "You've retried 1 time in this session"
retryCounterContainer.Children = new Drawable[]
{
new OsuSpriteText
{
Text = "You've retried ",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18
},
new OsuSpriteText
{
Text = $"{retries:n0}",
Font = @"Exo2.0-Bold",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18
},
new OsuSpriteText
{
Text = $" time{(retries == 1 ? "" : "s")} in this session",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18
}
};
}
private class Button : DialogButton private class Button : DialogButton
{ {
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)

View File

@ -161,8 +161,8 @@ namespace osu.Game.Screens.Play
OnRetry = Restart, OnRetry = Restart,
OnQuit = Exit, OnQuit = Exit,
CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded, CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded,
Retries = RestartCount,
OnPause = () => { OnPause = () => {
pauseContainer.Retries = RestartCount;
hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused; hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused;
}, },
OnResume = () => { OnResume = () => {