mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +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.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Online;
|
||||
using osu.Game.Scoring;
|
||||
using osuTK;
|
||||
|
||||
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>();
|
||||
|
||||
protected readonly Bindable<DownloadState> State = new Bindable<DownloadState>();
|
||||
|
||||
private DownloadButton button;
|
||||
private ShakeContainer shakeContainer;
|
||||
private DownloadButton button = null!;
|
||||
private ShakeContainer shakeContainer = null!;
|
||||
|
||||
private ScoreDownloadTracker downloadTracker;
|
||||
private ScoreDownloadTracker? downloadTracker;
|
||||
|
||||
private ReplayAvailability replayAvailability
|
||||
{
|
||||
@ -46,8 +47,8 @@ namespace osu.Game.Screens.Ranking
|
||||
Size = new Vector2(50, 30);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuGame game, ScoreModelDownloader scores)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGame? game, ScoreModelDownloader scores)
|
||||
{
|
||||
InternalChild = shakeContainer = new ShakeContainer
|
||||
{
|
||||
@ -99,6 +100,22 @@ namespace osu.Game.Screens.Ranking
|
||||
}, 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()
|
||||
{
|
||||
switch (replayAvailability)
|
||||
|
Loading…
Reference in New Issue
Block a user