mirror of
https://github.com/ppy/osu
synced 2025-02-22 05:27:05 +00:00
Move keyboard progress flow handling to MatchSettingsOverlay
This commit is contained in:
parent
fd54487186
commit
22bd6c7556
@ -4,15 +4,17 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
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.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay.Match.Components
|
namespace osu.Game.Screens.OnlinePlay.Match.Components
|
||||||
{
|
{
|
||||||
public abstract class MatchSettingsOverlay : FocusedOverlayContainer
|
public abstract class MatchSettingsOverlay : FocusedOverlayContainer, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
protected const float TRANSITION_DURATION = 350;
|
protected const float TRANSITION_DURATION = 350;
|
||||||
protected const float FIELD_PADDING = 45;
|
protected const float FIELD_PADDING = 45;
|
||||||
@ -21,6 +23,8 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
|
|||||||
|
|
||||||
protected override bool BlockScrollInput => false;
|
protected override bool BlockScrollInput => false;
|
||||||
|
|
||||||
|
protected abstract OsuButton SubmitButton { get; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -29,6 +33,8 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
|
|||||||
Add(Settings = CreateSettings());
|
Add(Settings = CreateSettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract void SelectBeatmap();
|
||||||
|
|
||||||
protected abstract OnlinePlayComposite CreateSettings();
|
protected abstract OnlinePlayComposite CreateSettings();
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
@ -41,6 +47,30 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
|
|||||||
Settings.MoveToY(-1, TRANSITION_DURATION, Easing.InSine);
|
Settings.MoveToY(-1, TRANSITION_DURATION, Easing.InSine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool OnPressed(GlobalAction action)
|
||||||
|
{
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case GlobalAction.Select:
|
||||||
|
if (SubmitButton.Enabled.Value)
|
||||||
|
{
|
||||||
|
SubmitButton.TriggerClick();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SelectBeatmap();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnReleased(GlobalAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected class SettingsTextBox : OsuTextBox
|
protected class SettingsTextBox : OsuTextBox
|
||||||
{
|
{
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -5,15 +5,13 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input.Bindings;
|
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Input.Bindings;
|
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Screens.OnlinePlay.Match.Components;
|
using osu.Game.Screens.OnlinePlay.Match.Components;
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
||||||
{
|
{
|
||||||
public class BeatmapSelectionControl : RoomSubScreenComposite, IKeyBindingHandler<GlobalAction>
|
public class BeatmapSelectionControl : RoomSubScreenComposite
|
||||||
{
|
{
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private MultiplayerMatchSubScreen matchSubScreen { get; set; }
|
private MultiplayerMatchSubScreen matchSubScreen { get; set; }
|
||||||
@ -74,6 +72,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void BeginSelection() => selectButton.TriggerClick();
|
||||||
|
|
||||||
private void updateBeatmap()
|
private void updateBeatmap()
|
||||||
{
|
{
|
||||||
if (SelectedItem.Value == null)
|
if (SelectedItem.Value == null)
|
||||||
@ -81,25 +81,5 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
else
|
else
|
||||||
beatmapPanelContainer.Child = new DrawableRoomPlaylistItem(SelectedItem.Value, false, false);
|
beatmapPanelContainer.Child = new DrawableRoomPlaylistItem(SelectedItem.Value, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnPressed(GlobalAction action)
|
|
||||||
{
|
|
||||||
// only handle keyboard input if there is no current selection.
|
|
||||||
if (SelectedItem.Value != null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
switch (action)
|
|
||||||
{
|
|
||||||
case GlobalAction.Select:
|
|
||||||
selectButton.TriggerClick();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnReleased(GlobalAction action)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,13 +12,11 @@ using osu.Framework.Extensions.ExceptionExtensions;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input.Bindings;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Input.Bindings;
|
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
@ -30,8 +28,14 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
{
|
{
|
||||||
public class MultiplayerMatchSettingsOverlay : MatchSettingsOverlay
|
public class MultiplayerMatchSettingsOverlay : MatchSettingsOverlay
|
||||||
{
|
{
|
||||||
|
private MatchSettings settings;
|
||||||
|
|
||||||
|
protected override OsuButton SubmitButton => settings.ApplyButton;
|
||||||
|
|
||||||
|
protected override void SelectBeatmap() => settings.SelectBeatmap();
|
||||||
|
|
||||||
protected override OnlinePlayComposite CreateSettings()
|
protected override OnlinePlayComposite CreateSettings()
|
||||||
=> new MatchSettings
|
=> settings = new MatchSettings
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
RelativePositionAxes = Axes.Y,
|
RelativePositionAxes = Axes.Y,
|
||||||
@ -56,6 +60,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
private LoadingLayer loadingLayer;
|
private LoadingLayer loadingLayer;
|
||||||
private BeatmapSelectionControl initialBeatmapControl;
|
private BeatmapSelectionControl initialBeatmapControl;
|
||||||
|
|
||||||
|
public void SelectBeatmap() => initialBeatmapControl.BeginSelection();
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IRoomManager manager { get; set; }
|
private IRoomManager manager { get; set; }
|
||||||
|
|
||||||
@ -355,7 +361,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreateOrUpdateButton : TriangleButton, IKeyBindingHandler<GlobalAction>
|
public class CreateOrUpdateButton : TriangleButton
|
||||||
{
|
{
|
||||||
[Resolved(typeof(Room), nameof(Room.RoomID))]
|
[Resolved(typeof(Room), nameof(Room.RoomID))]
|
||||||
private Bindable<long?> roomId { get; set; }
|
private Bindable<long?> roomId { get; set; }
|
||||||
@ -373,25 +379,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
Triangles.ColourLight = colours.YellowLight;
|
Triangles.ColourLight = colours.YellowLight;
|
||||||
Triangles.ColourDark = colours.YellowDark;
|
Triangles.ColourDark = colours.YellowDark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnPressed(GlobalAction action)
|
|
||||||
{
|
|
||||||
if (!Enabled.Value)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
switch (action)
|
|
||||||
{
|
|
||||||
case GlobalAction.Select:
|
|
||||||
TriggerClick();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnReleased(GlobalAction action)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,14 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
{
|
{
|
||||||
public Action EditPlaylist;
|
public Action EditPlaylist;
|
||||||
|
|
||||||
|
private MatchSettings settings;
|
||||||
|
|
||||||
|
protected override OsuButton SubmitButton => settings.ApplyButton;
|
||||||
|
|
||||||
|
protected override void SelectBeatmap() => EditPlaylist();
|
||||||
|
|
||||||
protected override OnlinePlayComposite CreateSettings()
|
protected override OnlinePlayComposite CreateSettings()
|
||||||
=> new MatchSettings
|
=> settings = new MatchSettings
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
RelativePositionAxes = Axes.Y,
|
RelativePositionAxes = Axes.Y,
|
||||||
|
Loading…
Reference in New Issue
Block a user