1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 18:32:56 +08:00

Merge pull request #4436 from peppy/fix-non-async-load

Fix some non-async load scenarios
This commit is contained in:
Dan Balasescu 2019-03-08 15:49:02 +09:00 committed by GitHub
commit 253a37c8a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 16 deletions

View File

@ -24,10 +24,13 @@ namespace osu.Game.Tests.Visual
public TestCaseToolbar()
{
var toolbar = new Toolbar { State = Visibility.Visible };
ToolbarNotificationButton notificationButton = null;
Add(toolbar);
var notificationButton = toolbar.Children.OfType<FillFlowContainer>().Last().Children.OfType<ToolbarNotificationButton>().First();
AddStep("create toolbar", () =>
{
Add(toolbar);
notificationButton = toolbar.Children.OfType<FillFlowContainer>().Last().Children.OfType<ToolbarNotificationButton>().First();
});
void setNotifications(int count) => AddStep($"set notification count to {count}", () => notificationButton.NotificationCount.Value = count);

View File

@ -70,13 +70,15 @@ namespace osu.Game.Online.API
internal new void Schedule(Action action) => base.Schedule(action);
/// <summary>
/// Register a component to receive API events.
/// Fires <see cref="IOnlineComponent.APIStateChanged"/> once immediately to ensure a correct state.
/// </summary>
/// <param name="component"></param>
public void Register(IOnlineComponent component)
{
Scheduler.Add(delegate
{
components.Add(component);
component.APIStateChanged(this, state);
});
Scheduler.Add(delegate { components.Add(component); });
component.APIStateChanged(this, state);
}
public void Unregister(IOnlineComponent component)

View File

@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Toolbar
public Action OnHome;
private readonly ToolbarUserArea userArea;
private ToolbarUserArea userArea;
protected override bool BlockPositionalInput => false;
@ -34,6 +34,13 @@ namespace osu.Game.Overlays.Toolbar
private readonly Bindable<OverlayActivation> overlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
public Toolbar()
{
RelativeSizeAxes = Axes.X;
Size = new Vector2(1, HEIGHT);
}
[BackgroundDependencyLoader(true)]
private void load(OsuGame osuGame)
{
Children = new Drawable[]
{
@ -76,13 +83,6 @@ namespace osu.Game.Overlays.Toolbar
}
};
RelativeSizeAxes = Axes.X;
Size = new Vector2(1, HEIGHT);
}
[BackgroundDependencyLoader(true)]
private void load(OsuGame osuGame)
{
StateChanged += visibility =>
{
if (overlayActivationMode.Value == OverlayActivation.Disabled)