mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 13:13:22 +08:00
Apply NRT and hotkey support to save replay button at results screen
This commit is contained in:
parent
69526f25bb
commit
1e0e29847f
@ -1,30 +1,31 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Online;
|
using osu.Game.Online;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Ranking
|
namespace osu.Game.Screens.Ranking
|
||||||
{
|
{
|
||||||
public partial class ReplayDownloadButton : CompositeDrawable
|
public partial class ReplayDownloadButton : CompositeDrawable, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
public readonly Bindable<ScoreInfo> Score = new Bindable<ScoreInfo>();
|
public readonly Bindable<ScoreInfo> Score = new Bindable<ScoreInfo>();
|
||||||
|
|
||||||
protected readonly Bindable<DownloadState> State = new Bindable<DownloadState>();
|
protected readonly Bindable<DownloadState> State = new Bindable<DownloadState>();
|
||||||
|
|
||||||
private DownloadButton button;
|
private DownloadButton button = null!;
|
||||||
private ShakeContainer shakeContainer;
|
private ShakeContainer shakeContainer = null!;
|
||||||
|
|
||||||
private ScoreDownloadTracker downloadTracker;
|
private ScoreDownloadTracker? downloadTracker;
|
||||||
|
|
||||||
private ReplayAvailability replayAvailability
|
private ReplayAvailability replayAvailability
|
||||||
{
|
{
|
||||||
@ -46,8 +47,8 @@ namespace osu.Game.Screens.Ranking
|
|||||||
Size = new Vector2(50, 30);
|
Size = new Vector2(50, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGame game, ScoreModelDownloader scores)
|
private void load(OsuGame? game, ScoreModelDownloader scores)
|
||||||
{
|
{
|
||||||
InternalChild = shakeContainer = new ShakeContainer
|
InternalChild = shakeContainer = new ShakeContainer
|
||||||
{
|
{
|
||||||
@ -99,6 +100,22 @@ namespace osu.Game.Screens.Ranking
|
|||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||||
|
{
|
||||||
|
switch (e.Action)
|
||||||
|
{
|
||||||
|
case GlobalAction.SaveReplay:
|
||||||
|
button.TriggerClick();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
private void updateState()
|
private void updateState()
|
||||||
{
|
{
|
||||||
switch (replayAvailability)
|
switch (replayAvailability)
|
||||||
|
Loading…
Reference in New Issue
Block a user