mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 18:53:21 +08:00
Merge branch 'master' into musiccontroller-init-fix
This commit is contained in:
commit
7b52c4621d
@ -1 +1 @@
|
|||||||
Subproject commit 8baad1b9484b9f35724e2f965c18cfe710907d80
|
Subproject commit 0b9053ec3d39b486165992374752b280c5eeef06
|
@ -80,7 +80,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
private void triggerKeyDown(Column column)
|
private void triggerKeyDown(Column column)
|
||||||
{
|
{
|
||||||
column.TriggerKeyDown(new InputState(), new KeyDownEventArgs
|
column.TriggerOnKeyDown(new InputState(), new KeyDownEventArgs
|
||||||
{
|
{
|
||||||
Key = column.Key,
|
Key = column.Key,
|
||||||
Repeat = false
|
Repeat = false
|
||||||
@ -89,7 +89,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
private void triggerKeyUp(Column column)
|
private void triggerKeyUp(Column column)
|
||||||
{
|
{
|
||||||
column.TriggerKeyUp(new InputState(), new KeyUpEventArgs
|
column.TriggerOnKeyUp(new InputState(), new KeyUpEventArgs
|
||||||
{
|
{
|
||||||
Key = column.Key
|
Key = column.Key
|
||||||
});
|
});
|
||||||
|
@ -32,14 +32,14 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
Username = @"flyte",
|
Username = @"flyte",
|
||||||
Id = 3103765,
|
Id = 3103765,
|
||||||
Country = new Country { FlagName = @"JP" },
|
Country = new Country { FlagName = @"JP" },
|
||||||
CoverUrl = @"https://assets.ppy.sh/user-profile-covers/3103765/5b012e13611d5761caa7e24fecb3d3a16e1cf48fc2a3032cfd43dd444af83d82.jpeg"
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
|
||||||
}) { Width = 300 },
|
}) { Width = 300 },
|
||||||
peppy = new UserPanel(new User
|
peppy = new UserPanel(new User
|
||||||
{
|
{
|
||||||
Username = @"peppy",
|
Username = @"peppy",
|
||||||
Id = 2,
|
Id = 2,
|
||||||
Country = new Country { FlagName = @"AU" },
|
Country = new Country { FlagName = @"AU" },
|
||||||
CoverUrl = @"https://assets.ppy.sh/user-profile-covers/2/08cad88747c235a64fca5f1b770e100f120827ded1ffe3b66bfcd19c940afa65.jpeg"
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg"
|
||||||
}) { Width = 300 },
|
}) { Width = 300 },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -23,11 +24,19 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
focus = value;
|
focus = value;
|
||||||
if (!focus)
|
if (!focus && HasFocus)
|
||||||
TriggerFocusLost();
|
inputManager.ChangeFocus(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private InputManager inputManager;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(UserInputManager inputManager)
|
||||||
|
{
|
||||||
|
this.inputManager = inputManager;
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnFocus(InputState state)
|
protected override bool OnFocus(InputState state)
|
||||||
{
|
{
|
||||||
var result = base.OnFocus(state);
|
var result = base.OnFocus(state);
|
||||||
|
@ -74,7 +74,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
volumeMeterMaster.TriggerWheel(state);
|
volumeMeterMaster.TriggerOnWheel(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -255,6 +255,9 @@ namespace osu.Game
|
|||||||
settings.ToggleVisibility();
|
settings.ToggleVisibility();
|
||||||
return true;
|
return true;
|
||||||
case Key.D:
|
case Key.D:
|
||||||
|
if (state.Keyboard.ShiftPressed || state.Keyboard.AltPressed)
|
||||||
|
return false;
|
||||||
|
|
||||||
direct.ToggleVisibility();
|
direct.ToggleVisibility();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -135,17 +135,22 @@ namespace osu.Game.Overlays
|
|||||||
channelTabs.Current.ValueChanged += newChannel => CurrentChannel = newChannel;
|
channelTabs.Current.ValueChanged += newChannel => CurrentChannel = newChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double startDragChatHeight;
|
||||||
|
|
||||||
protected override bool OnDragStart(InputState state)
|
protected override bool OnDragStart(InputState state)
|
||||||
{
|
{
|
||||||
if (channelTabs.Hovering)
|
if (!channelTabs.Hovering)
|
||||||
return true;
|
return base.OnDragStart(state);
|
||||||
|
|
||||||
return base.OnDragStart(state);
|
startDragChatHeight = chatHeight.Value;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDrag(InputState state)
|
protected override bool OnDrag(InputState state)
|
||||||
{
|
{
|
||||||
chatHeight.Value = Height - state.Mouse.Delta.Y / Parent.DrawSize.Y;
|
Trace.Assert(state.Mouse.PositionMouseDown != null);
|
||||||
|
|
||||||
|
chatHeight.Value = startDragChatHeight - (state.Mouse.Position.Y - state.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y;
|
||||||
return base.OnDrag(state);
|
return base.OnDrag(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +170,7 @@ namespace osu.Game.Overlays
|
|||||||
protected override bool OnFocus(InputState state)
|
protected override bool OnFocus(InputState state)
|
||||||
{
|
{
|
||||||
//this is necessary as inputTextBox is masked away and therefore can't get focus :(
|
//this is necessary as inputTextBox is masked away and therefore can't get focus :(
|
||||||
inputTextBox.TriggerFocus();
|
InputManager.ChangeFocus(inputTextBox);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ namespace osu.Game.Overlays.Dialog
|
|||||||
private void pressButtonAtIndex(int index)
|
private void pressButtonAtIndex(int index)
|
||||||
{
|
{
|
||||||
if (index < Buttons.Count())
|
if (index < Buttons.Count())
|
||||||
Buttons.Skip(index).First().TriggerClick();
|
Buttons.Skip(index).First().TriggerOnClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
@ -80,7 +80,7 @@ namespace osu.Game.Overlays.Dialog
|
|||||||
|
|
||||||
if (args.Key == Key.Enter)
|
if (args.Key == Key.Enter)
|
||||||
{
|
{
|
||||||
Buttons.OfType<PopupDialogOkButton>().FirstOrDefault()?.TriggerClick();
|
Buttons.OfType<PopupDialogOkButton>().FirstOrDefault()?.TriggerOnClick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
protected override bool OnFocus(InputState state)
|
protected override bool OnFocus(InputState state)
|
||||||
{
|
{
|
||||||
filter.Search.TriggerFocus();
|
InputManager.ChangeFocus(filter.Search);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ namespace osu.Game.Overlays
|
|||||||
settingsSection.Bounding = true;
|
settingsSection.Bounding = true;
|
||||||
FadeIn(transition_time, EasingTypes.OutQuint);
|
FadeIn(transition_time, EasingTypes.OutQuint);
|
||||||
|
|
||||||
settingsSection.TriggerFocus();
|
InputManager.ChangeFocus(settingsSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
|
@ -17,6 +17,7 @@ using osu.Game.Graphics;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Music
|
namespace osu.Game.Overlays.Music
|
||||||
{
|
{
|
||||||
@ -35,10 +36,12 @@ namespace osu.Game.Overlays.Music
|
|||||||
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
public IEnumerable<BeatmapSetInfo> BeatmapSets;
|
public IEnumerable<BeatmapSetInfo> BeatmapSets;
|
||||||
|
private InputManager inputManager;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game, BeatmapDatabase beatmaps, OsuColour colours)
|
private void load(OsuGameBase game, BeatmapDatabase beatmaps, OsuColour colours, UserInputManager inputManager)
|
||||||
{
|
{
|
||||||
|
this.inputManager = inputManager;
|
||||||
this.beatmaps = beatmaps;
|
this.beatmaps = beatmaps;
|
||||||
trackManager = game.Audio.Track;
|
trackManager = game.Audio.Track;
|
||||||
|
|
||||||
@ -100,7 +103,7 @@ namespace osu.Game.Overlays.Music
|
|||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
{
|
{
|
||||||
filter.Search.HoldFocus = true;
|
filter.Search.HoldFocus = true;
|
||||||
Schedule(() => filter.Search.TriggerFocus());
|
Schedule(() => inputManager.ChangeFocus(filter.Search));
|
||||||
|
|
||||||
ResizeTo(new Vector2(1, playlist_height), transition_duration, EasingTypes.OutQuint);
|
ResizeTo(new Vector2(1, playlist_height), transition_duration, EasingTypes.OutQuint);
|
||||||
FadeIn(transition_duration, EasingTypes.OutQuint);
|
FadeIn(transition_duration, EasingTypes.OutQuint);
|
||||||
|
@ -51,9 +51,12 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
Spacing = new Vector2(0f, 5f);
|
Spacing = new Vector2(0f, 5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private InputManager inputManager;
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void load(OsuColour colours, APIAccess api)
|
private void load(OsuColour colours, APIAccess api, UserInputManager inputManager)
|
||||||
{
|
{
|
||||||
|
this.inputManager = inputManager;
|
||||||
this.colours = colours;
|
this.colours = colours;
|
||||||
api?.Register(this);
|
api?.Register(this);
|
||||||
}
|
}
|
||||||
@ -160,12 +163,12 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
form?.TriggerFocus();
|
if (form != null) inputManager.ChangeFocus(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnFocus(InputState state)
|
protected override bool OnFocus(InputState state)
|
||||||
{
|
{
|
||||||
form?.TriggerFocus();
|
if (form != null) inputManager.ChangeFocus(form);
|
||||||
return base.OnFocus(state);
|
return base.OnFocus(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,6 +177,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
private TextBox username;
|
private TextBox username;
|
||||||
private TextBox password;
|
private TextBox password;
|
||||||
private APIAccess api;
|
private APIAccess api;
|
||||||
|
private InputManager inputManager;
|
||||||
|
|
||||||
private void performLogin()
|
private void performLogin()
|
||||||
{
|
{
|
||||||
@ -182,8 +186,9 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void load(APIAccess api, OsuConfigManager config)
|
private void load(APIAccess api, OsuConfigManager config, UserInputManager inputManager)
|
||||||
{
|
{
|
||||||
|
this.inputManager = inputManager;
|
||||||
this.api = api;
|
this.api = api;
|
||||||
Direction = FillDirection.Vertical;
|
Direction = FillDirection.Vertical;
|
||||||
Spacing = new Vector2(0, 5);
|
Spacing = new Vector2(0, 5);
|
||||||
@ -232,14 +237,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
|
|
||||||
protected override bool OnFocus(InputState state)
|
protected override bool OnFocus(InputState state)
|
||||||
{
|
{
|
||||||
Schedule(() =>
|
Schedule(() => { inputManager.ChangeFocus(string.IsNullOrEmpty(username.Text) ? username : password); });
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(username.Text))
|
|
||||||
username.TriggerFocus();
|
|
||||||
else
|
|
||||||
password.TriggerFocus();
|
|
||||||
});
|
|
||||||
|
|
||||||
return base.OnFocus(state);
|
return base.OnFocus(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,12 +134,13 @@ namespace osu.Game.Overlays
|
|||||||
FadeTo(0, TRANSITION_LENGTH / 2);
|
FadeTo(0, TRANSITION_LENGTH / 2);
|
||||||
|
|
||||||
searchTextBox.HoldFocus = false;
|
searchTextBox.HoldFocus = false;
|
||||||
searchTextBox.TriggerFocusLost();
|
if (searchTextBox.HasFocus)
|
||||||
|
InputManager.ChangeFocus(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnFocus(InputState state)
|
protected override bool OnFocus(InputState state)
|
||||||
{
|
{
|
||||||
searchTextBox.TriggerFocus(state);
|
InputManager.ChangeFocus(searchTextBox);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
switch (args.Key)
|
switch (args.Key)
|
||||||
{
|
{
|
||||||
case Key.Space:
|
case Key.Space:
|
||||||
osuLogo.TriggerClick(state);
|
osuLogo.TriggerOnClick(state);
|
||||||
return true;
|
return true;
|
||||||
case Key.Escape:
|
case Key.Escape:
|
||||||
switch (State)
|
switch (State)
|
||||||
@ -144,7 +144,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
State = MenuState.Initial;
|
State = MenuState.Initial;
|
||||||
return true;
|
return true;
|
||||||
case MenuState.Play:
|
case MenuState.Play:
|
||||||
backButton.TriggerClick();
|
backButton.TriggerOnClick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,10 +178,10 @@ namespace osu.Game.Screens.Menu
|
|||||||
State = MenuState.TopLevel;
|
State = MenuState.TopLevel;
|
||||||
return;
|
return;
|
||||||
case MenuState.TopLevel:
|
case MenuState.TopLevel:
|
||||||
buttonsTopLevel.First().TriggerClick();
|
buttonsTopLevel.First().TriggerOnClick();
|
||||||
return;
|
return;
|
||||||
case MenuState.Play:
|
case MenuState.Play:
|
||||||
buttonsPlay.First().TriggerClick();
|
buttonsPlay.First().TriggerOnClick();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
if (!args.Repeat && args.Key == Key.Escape)
|
if (!args.Repeat && args.Key == Key.Escape)
|
||||||
{
|
{
|
||||||
Buttons.Children.Last().TriggerClick();
|
Buttons.Children.Last().TriggerOnClick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,13 +131,13 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public override bool HandleInput => true;
|
public override bool HandleInput => true;
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => target.Children.Any(c => c.TriggerKeyDown(state, args));
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => target.Children.Any(c => c.TriggerOnKeyDown(state, args));
|
||||||
|
|
||||||
protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) => target.Children.Any(c => c.TriggerKeyUp(state, args));
|
protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) => target.Children.Any(c => c.TriggerOnKeyUp(state, args));
|
||||||
|
|
||||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => target.Children.Any(c => c.TriggerMouseDown(state, args));
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => target.Children.Any(c => c.TriggerOnMouseDown(state, args));
|
||||||
|
|
||||||
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => target.Children.Any(c => c.TriggerMouseUp(state, args));
|
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => target.Children.Any(c => c.TriggerOnMouseUp(state, args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
if (!args.Repeat && args.Key == Key.Escape)
|
if (!args.Repeat && args.Key == Key.Escape)
|
||||||
{
|
{
|
||||||
Buttons.Children.First().TriggerClick();
|
Buttons.Children.First().TriggerOnClick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
protected override bool OnExiting(Screen next)
|
||||||
{
|
{
|
||||||
if (HasFailed || !ValidForResume || pauseContainer.AllowExit || HitRenderer.HasReplayLoaded)
|
if (HasFailed || !ValidForResume || pauseContainer?.AllowExit != false || HitRenderer?.HasReplayLoaded != false)
|
||||||
{
|
{
|
||||||
fadeOut();
|
fadeOut();
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
@ -310,7 +310,7 @@ namespace osu.Game.Screens.Play
|
|||||||
HitRenderer?.FadeOut(fade_out_duration);
|
HitRenderer?.FadeOut(fade_out_duration);
|
||||||
Content.FadeOut(fade_out_duration);
|
Content.FadeOut(fade_out_duration);
|
||||||
|
|
||||||
hudOverlay.ScaleTo(0.7f, fade_out_duration * 3, EasingTypes.In);
|
hudOverlay?.ScaleTo(0.7f, fade_out_duration * 3, EasingTypes.In);
|
||||||
|
|
||||||
Background?.FadeTo(1f, fade_out_duration);
|
Background?.FadeTo(1f, fade_out_duration);
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ namespace osu.Game.Screens.Play
|
|||||||
switch (args.Key)
|
switch (args.Key)
|
||||||
{
|
{
|
||||||
case Key.Space:
|
case Key.Space:
|
||||||
button.TriggerClick();
|
button.TriggerOnClick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,8 @@ namespace osu.Game.Screens.Select
|
|||||||
public void Deactivate()
|
public void Deactivate()
|
||||||
{
|
{
|
||||||
searchTextBox.HoldFocus = false;
|
searchTextBox.HoldFocus = false;
|
||||||
searchTextBox.TriggerFocusLost();
|
if (searchTextBox.HasFocus)
|
||||||
|
inputManager.ChangeFocus(searchTextBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Activate()
|
public void Activate()
|
||||||
@ -164,9 +165,13 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls:true)]
|
private InputManager inputManager;
|
||||||
private void load(OsuColour colours, OsuGame osu)
|
|
||||||
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
|
private void load(OsuColour colours, OsuGame osu, UserInputManager inputManager)
|
||||||
{
|
{
|
||||||
|
this.inputManager = inputManager;
|
||||||
|
|
||||||
sortTabs.AccentColour = colours.GreenLight;
|
sortTabs.AccentColour = colours.GreenLight;
|
||||||
|
|
||||||
if (osu != null)
|
if (osu != null)
|
||||||
|
Loading…
Reference in New Issue
Block a user