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

Merge remote-tracking branch 'origin/is-alive' into key-config-settings

This commit is contained in:
Dean Herbert 2017-08-16 15:48:21 +09:00
commit 89987229de
12 changed files with 29 additions and 45 deletions

@ -1 +1 @@
Subproject commit e5b0f1c9d0c98ee89563042071e516d5304a6d06 Subproject commit fc13a4c2f1eff443ffe7d5ff3ca5caa17b98ffbf

View File

@ -68,7 +68,7 @@ namespace osu.Desktop.Tests.Visual
while (progressingNotifications.Count(n => n.State == ProgressNotificationState.Active) < 3) while (progressingNotifications.Count(n => n.State == ProgressNotificationState.Active) < 3)
{ {
var p = progressingNotifications.FirstOrDefault(n => n.IsLoaded && n.State == ProgressNotificationState.Queued); var p = progressingNotifications.FirstOrDefault(n => n.IsAlive && n.State == ProgressNotificationState.Queued);
if (p == null) if (p == null)
break; break;

View File

@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
return; return;
accentColour = value; accentColour = value;
if (LoadState == LoadState.Loaded) if (LoadState == LoadState.Ready)
Schedule(reloadTexture); Schedule(reloadTexture);
} }
} }

View File

@ -34,9 +34,8 @@ namespace osu.Game.Graphics.Containers
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(UserInputManager input, OsuConfigManager config) private void load(OsuConfigManager config)
{ {
this.input = input;
parallaxEnabled = config.GetBindable<bool>(OsuSetting.MenuParallax); parallaxEnabled = config.GetBindable<bool>(OsuSetting.MenuParallax);
parallaxEnabled.ValueChanged += delegate parallaxEnabled.ValueChanged += delegate
{ {
@ -48,6 +47,12 @@ namespace osu.Game.Graphics.Containers
}; };
} }
protected override void LoadComplete()
{
base.LoadComplete();
input = GetContainingInputManager();
}
private bool firstUpdate = true; private bool firstUpdate = true;
protected override void Update() protected override void Update()

View File

@ -3,7 +3,6 @@
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;
@ -28,18 +27,10 @@ namespace osu.Game.Graphics.UserInterface
{ {
focus = value; focus = value;
if (!focus && HasFocus) if (!focus && HasFocus)
inputManager.ChangeFocus(null); GetContainingInputManager().ChangeFocus(null);
} }
} }
private InputManager inputManager;
[BackgroundDependencyLoader]
private void load(UserInputManager inputManager)
{
this.inputManager = inputManager;
}
protected override void OnFocus(InputState state) protected override void OnFocus(InputState state)
{ {
base.OnFocus(state); base.OnFocus(state);

View File

@ -6,7 +6,6 @@ using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Input;
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;
@ -31,12 +30,10 @@ 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, BeatmapManager beatmaps, OsuColour colours, UserInputManager inputManager) private void load(OsuGameBase game, BeatmapManager beatmaps, OsuColour colours)
{ {
this.inputManager = inputManager;
this.beatmaps = beatmaps; this.beatmaps = beatmaps;
Children = new Drawable[] Children = new Drawable[]
@ -102,7 +99,7 @@ namespace osu.Game.Overlays.Music
protected override void PopIn() protected override void PopIn()
{ {
filter.Search.HoldFocus = true; filter.Search.HoldFocus = true;
Schedule(() => inputManager.ChangeFocus(filter.Search)); Schedule(() => GetContainingInputManager().ChangeFocus(filter.Search));
this.ResizeTo(new Vector2(1, playlist_height), transition_duration, Easing.OutQuint); this.ResizeTo(new Vector2(1, playlist_height), transition_duration, Easing.OutQuint);
this.FadeIn(transition_duration, Easing.OutQuint); this.FadeIn(transition_duration, Easing.OutQuint);

View File

@ -57,12 +57,9 @@ 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, UserInputManager inputManager) private void load(OsuColour colours, APIAccess api)
{ {
this.inputManager = inputManager;
this.colours = colours; this.colours = colours;
api?.Register(this); api?.Register(this);
@ -174,7 +171,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
break; break;
} }
if (form != null) inputManager.ChangeFocus(form); if (form != null) GetContainingInputManager().ChangeFocus(form);
} }
public override bool AcceptsFocus => true; public override bool AcceptsFocus => true;
@ -183,7 +180,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
protected override void OnFocus(InputState state) protected override void OnFocus(InputState state)
{ {
if (form != null) inputManager.ChangeFocus(form); if (form != null) GetContainingInputManager().ChangeFocus(form);
base.OnFocus(state); base.OnFocus(state);
} }
@ -192,7 +189,6 @@ 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()
{ {
@ -201,9 +197,8 @@ namespace osu.Game.Overlays.Settings.Sections.General
} }
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(APIAccess api, OsuConfigManager config, UserInputManager inputManager) private void load(APIAccess api, OsuConfigManager config)
{ {
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);
@ -256,7 +251,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
protected override void OnFocus(InputState state) protected override void OnFocus(InputState state)
{ {
Schedule(() => { inputManager.ChangeFocus(string.IsNullOrEmpty(username.Text) ? username : password); }); Schedule(() => { GetContainingInputManager().ChangeFocus(string.IsNullOrEmpty(username.Text) ? username : password); });
} }
} }

View File

@ -37,7 +37,7 @@ namespace osu.Game.Screens
} }
// Make sure the in-progress loading is complete before pushing the screen. // Make sure the in-progress loading is complete before pushing the screen.
while (screen.LoadState < LoadState.Loaded) while (screen.LoadState < LoadState.Ready)
Thread.Sleep(1); Thread.Sleep(1);
base.Push(screen); base.Push(screen);

View File

@ -108,7 +108,7 @@ namespace osu.Game.Screens.Play
} }
} }
public override bool HandleInput => receptor?.IsAlive != true; public override bool HandleInput => receptor == null;
private Receptor receptor; private Receptor receptor;

View File

@ -227,9 +227,9 @@ namespace osu.Game.Screens.Play
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Children = new[] Children = new[]
{ {
new SpriteIcon { Icon = FontAwesome.fa_chevron_right }, new SpriteIcon { Size = new Vector2(15), Shadow = true, Icon = FontAwesome.fa_chevron_right },
new SpriteIcon { Icon = FontAwesome.fa_chevron_right }, new SpriteIcon { Size = new Vector2(15), Shadow = true, Icon = FontAwesome.fa_chevron_right },
new SpriteIcon { Icon = FontAwesome.fa_chevron_right }, new SpriteIcon { Size = new Vector2(15), Shadow = true, Icon = FontAwesome.fa_chevron_right },
} }
}, },
new OsuSpriteText new OsuSpriteText

View File

@ -153,7 +153,7 @@ namespace osu.Game.Screens.Select
{ {
searchTextBox.HoldFocus = false; searchTextBox.HoldFocus = false;
if (searchTextBox.HasFocus) if (searchTextBox.HasFocus)
inputManager.ChangeFocus(searchTextBox); GetContainingInputManager().ChangeFocus(searchTextBox);
} }
public void Activate() public void Activate()
@ -163,13 +163,9 @@ namespace osu.Game.Screens.Select
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>(); private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
private InputManager inputManager;
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuColour colours, OsuGame osu, UserInputManager inputManager) private void load(OsuColour colours, OsuGame osu)
{ {
this.inputManager = inputManager;
sortTabs.AccentColour = colours.GreenLight; sortTabs.AccentColour = colours.GreenLight;
if (osu != null) if (osu != null)

View File

@ -156,11 +156,11 @@ namespace osu.Game.Screens.Select
} }
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours, UserInputManager input) private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours)
{ {
if (Footer != null) if (Footer != null)
{ {
Footer.AddButton(@"random", colours.Green, () => triggerRandom(input), Key.F2); Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2);
Footer.AddButton(@"options", colours.Blue, BeatmapOptions.ToggleVisibility, Key.F3); Footer.AddButton(@"options", colours.Blue, BeatmapOptions.ToggleVisibility, Key.F3);
BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, promptDelete, Key.Number4, float.MaxValue); BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, promptDelete, Key.Number4, float.MaxValue);
@ -267,9 +267,9 @@ namespace osu.Game.Screens.Select
} }
} }
private void triggerRandom(UserInputManager input) private void triggerRandom()
{ {
if (input.CurrentState.Keyboard.ShiftPressed) if (GetContainingInputManager().CurrentState.Keyboard.ShiftPressed)
carousel.SelectPreviousRandom(); carousel.SelectPreviousRandom();
else else
carousel.SelectNextRandom(); carousel.SelectNextRandom();