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:
commit
253a37c8a7
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user