Use [Resolved] wherever possible

This commit is contained in:
recapitalverb
2020-02-14 20:14:00 +07:00
parent 6d87d22a84
commit c753cb46c5
35 changed files with 128 additions and 169 deletions

View File

@ -35,18 +35,20 @@ namespace osu.Game.Graphics
private Bindable<ScreenshotFormat> screenshotFormat;
private Bindable<bool> captureMenuCursor;
private GameHost host;
[Resolved]
private GameHost host { get; set; }
private Storage storage;
private NotificationOverlay notificationOverlay;
[Resolved]
private NotificationOverlay notificationOverlay { get; set; }
private SampleChannel shutter;
[BackgroundDependencyLoader]
private void load(GameHost host, OsuConfigManager config, Storage storage, NotificationOverlay notificationOverlay, AudioManager audio)
private void load(OsuConfigManager config, Storage storage, AudioManager audio)
{
this.host = host;
this.storage = storage.GetStorageForDirectory(@"screenshots");
this.notificationOverlay = notificationOverlay;
screenshotFormat = config.GetBindable<ScreenshotFormat>(OsuSetting.ScreenshotFormat);
captureMenuCursor = config.GetBindable<bool>(OsuSetting.ScreenshotCaptureMenuCursor);

View File

@ -19,7 +19,8 @@ namespace osu.Game.Graphics.UserInterface
private readonly SpriteIcon checkmark;
private readonly Box background;
private OsuColour colours;
[Resolved]
private OsuColour colours { get; set; }
public DownloadButton()
{
@ -49,10 +50,8 @@ namespace osu.Game.Graphics.UserInterface
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load()
{
this.colours = colours;
State.BindValueChanged(updateState, true);
}

View File

@ -18,7 +18,9 @@ namespace osu.Game.Graphics.UserInterface
public string Link { get; set; }
private Color4 hoverColour;
private GameHost host;
[Resolved]
private GameHost host { get; set; }
public ExternalLinkButton(string link = null)
{
@ -32,10 +34,9 @@ namespace osu.Game.Graphics.UserInterface
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, GameHost host)
private void load(OsuColour colours)
{
hoverColour = colours.Yellow;
this.host = host;
}
protected override bool OnHover(HoverEvent e)

View File

@ -36,13 +36,12 @@ namespace osu.Game.Graphics.UserInterface
}
}
private GameHost host;
[Resolved]
private GameHost host { get; set; }
[BackgroundDependencyLoader]
private void load(GameHost host)
private void load()
{
this.host = host;
BackgroundUnfocused = new Color4(10, 10, 10, 255);
BackgroundFocused = new Color4(10, 10, 10, 255);
}

View File

@ -24,7 +24,8 @@ namespace osu.Game.Graphics.UserInterface
private readonly CapsWarning warning;
private GameHost host;
[Resolved]
private GameHost host { get; set; }
public OsuPasswordTextBox()
{
@ -38,12 +39,6 @@ namespace osu.Game.Graphics.UserInterface
});
}
[BackgroundDependencyLoader]
private void load(GameHost host)
{
this.host = host;
}
protected override bool OnKeyDown(KeyDownEvent e)
{
if (e.Key == Key.CapsLock)