1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 10:07:36 +08:00

Merge pull request #7837 from recapitalverb/remove-duplicated-load

Use Resolved attribute instead of BackgroundDependencyLoader wherever possible
This commit is contained in:
Dan Balasescu 2020-02-15 20:09:23 +09:00 committed by GitHub
commit e85c76b52d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 135 additions and 173 deletions

View File

@ -19,13 +19,15 @@ namespace osu.Game.Audio
{ {
private readonly BindableDouble muteBindable = new BindableDouble(); private readonly BindableDouble muteBindable = new BindableDouble();
private AudioManager audio; [Resolved]
private AudioManager audio { get; set; }
private PreviewTrackStore trackStore; private PreviewTrackStore trackStore;
protected TrackManagerPreviewTrack CurrentTrack; protected TrackManagerPreviewTrack CurrentTrack;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load()
{ {
// this is a temporary solution to get around muting ourselves. // this is a temporary solution to get around muting ourselves.
// todo: update this once we have a BackgroundTrackManager or similar. // todo: update this once we have a BackgroundTrackManager or similar.
@ -33,8 +35,6 @@ namespace osu.Game.Audio
audio.AddItem(trackStore); audio.AddItem(trackStore);
trackStore.AddAdjustment(AdjustableProperty.Volume, audio.VolumeTrack); trackStore.AddAdjustment(AdjustableProperty.Volume, audio.VolumeTrack);
this.audio = audio;
} }
/// <summary> /// <summary>
@ -90,6 +90,7 @@ namespace osu.Game.Audio
public class TrackManagerPreviewTrack : PreviewTrack public class TrackManagerPreviewTrack : PreviewTrack
{ {
[Resolved]
public IPreviewTrackOwner Owner { get; private set; } public IPreviewTrackOwner Owner { get; private set; }
private readonly BeatmapSetInfo beatmapSetInfo; private readonly BeatmapSetInfo beatmapSetInfo;
@ -101,12 +102,6 @@ namespace osu.Game.Audio
this.trackManager = trackManager; this.trackManager = trackManager;
} }
[BackgroundDependencyLoader]
private void load(IPreviewTrackOwner owner)
{
Owner = owner;
}
protected override Track GetTrack() => trackManager.Get($"https://b.ppy.sh/preview/{beatmapSetInfo?.OnlineBeatmapSetID}.mp3"); protected override Track GetTrack() => trackManager.Get($"https://b.ppy.sh/preview/{beatmapSetInfo?.OnlineBeatmapSetID}.mp3");
} }

View File

@ -150,12 +150,12 @@ namespace osu.Game.Beatmaps.Drawables
}; };
} }
private OsuColour colours; [Resolved]
private OsuColour colours { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load()
{ {
this.colours = colours;
background.Colour = colours.Gray3; background.Colour = colours.Gray3;
} }

View File

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

View File

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

View File

@ -18,7 +18,9 @@ namespace osu.Game.Graphics.UserInterface
public string Link { get; set; } public string Link { get; set; }
private Color4 hoverColour; private Color4 hoverColour;
private GameHost host;
[Resolved]
private GameHost host { get; set; }
public ExternalLinkButton(string link = null) public ExternalLinkButton(string link = null)
{ {
@ -32,10 +34,9 @@ namespace osu.Game.Graphics.UserInterface
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours, GameHost host) private void load(OsuColour colours)
{ {
hoverColour = colours.Yellow; hoverColour = colours.Yellow;
this.host = host;
} }
protected override bool OnHover(HoverEvent e) 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] [BackgroundDependencyLoader]
private void load(GameHost host) private void load()
{ {
this.host = host;
BackgroundUnfocused = new Color4(10, 10, 10, 255); BackgroundUnfocused = new Color4(10, 10, 10, 255);
BackgroundFocused = 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 readonly CapsWarning warning;
private GameHost host; [Resolved]
private GameHost host { get; set; }
public OsuPasswordTextBox() 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) protected override bool OnKeyDown(KeyDownEvent e)
{ {
if (e.Key == Key.CapsLock) if (e.Key == Key.CapsLock)

View File

@ -22,6 +22,7 @@ namespace osu.Game.Online.API
public class APIAccess : Component, IAPIProvider public class APIAccess : Component, IAPIProvider
{ {
private readonly OsuConfigManager config; private readonly OsuConfigManager config;
private readonly OAuth authentication; private readonly OAuth authentication;
public string Endpoint => @"https://osu.ppy.sh"; public string Endpoint => @"https://osu.ppy.sh";

View File

@ -48,7 +48,8 @@ namespace osu.Game.Online.Chat
/// </summary> /// </summary>
public IBindableList<Channel> AvailableChannels => availableChannels; public IBindableList<Channel> AvailableChannels => availableChannels;
private IAPIProvider api; [Resolved]
private IAPIProvider api { get; set; }
public readonly BindableBool HighPollRate = new BindableBool(); public readonly BindableBool HighPollRate = new BindableBool();
@ -466,12 +467,6 @@ namespace osu.Game.Online.Chat
api.Queue(req); api.Queue(req);
} }
[BackgroundDependencyLoader]
private void load(IAPIProvider api)
{
this.api = api;
}
} }
/// <summary> /// <summary>

View File

@ -13,15 +13,17 @@ namespace osu.Game.Online.Chat
{ {
public class ExternalLinkOpener : Component public class ExternalLinkOpener : Component
{ {
private GameHost host; [Resolved]
private DialogOverlay dialogOverlay; private GameHost host { get; set; }
[Resolved(CanBeNull = true)]
private DialogOverlay dialogOverlay { get; set; }
private Bindable<bool> externalLinkWarning; private Bindable<bool> externalLinkWarning;
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(GameHost host, DialogOverlay dialogOverlay, OsuConfigManager config) private void load(OsuConfigManager config)
{ {
this.host = host;
this.dialogOverlay = dialogOverlay;
externalLinkWarning = config.GetBindable<bool>(OsuSetting.ExternalLinkWarning); externalLinkWarning = config.GetBindable<bool>(OsuSetting.ExternalLinkWarning);
} }

View File

@ -19,7 +19,8 @@ namespace osu.Game.Online
{ {
protected readonly Bindable<TModel> Model = new Bindable<TModel>(); protected readonly Bindable<TModel> Model = new Bindable<TModel>();
private TModelManager manager; [Resolved(CanBeNull = true)]
private TModelManager manager { get; set; }
/// <summary> /// <summary>
/// Holds the current download state of the <typeparamref name="TModel"/>, whether is has already been downloaded, is in progress, or is not downloaded. /// Holds the current download state of the <typeparamref name="TModel"/>, whether is has already been downloaded, is in progress, or is not downloaded.
@ -34,10 +35,8 @@ namespace osu.Game.Online
} }
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(TModelManager manager) private void load()
{ {
this.manager = manager;
Model.BindValueChanged(modelInfo => Model.BindValueChanged(modelInfo =>
{ {
if (modelInfo.NewValue == null) if (modelInfo.NewValue == null)

View File

@ -217,14 +217,14 @@ namespace osu.Game.Online.Leaderboards
Scores = null; Scores = null;
} }
private IAPIProvider api; [Resolved(CanBeNull = true)]
private IAPIProvider api { get; set; }
private ScheduledDelegate pendingUpdateScores; private ScheduledDelegate pendingUpdateScores;
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader]
private void load(IAPIProvider api) private void load()
{ {
this.api = api;
api?.Register(this); api?.Register(this);
} }

View File

@ -150,10 +150,8 @@ namespace osu.Game
dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(FrameworkConfigManager frameworkConfig) private void load()
{ {
this.frameworkConfig = frameworkConfig;
if (!Host.IsPrimaryInstance && !DebugUtils.IsDebugBuild) if (!Host.IsPrimaryInstance && !DebugUtils.IsDebugBuild)
{ {
Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error); Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error);
@ -881,7 +879,8 @@ namespace osu.Game
private Container topMostOverlayContent; private Container topMostOverlayContent;
private FrameworkConfigManager frameworkConfig; [Resolved]
private FrameworkConfigManager frameworkConfig { get; set; }
private ScalingContainer screenContainer; private ScalingContainer screenContainer;

View File

@ -33,20 +33,21 @@ namespace osu.Game.Overlays.AccountCreation
private OsuTextBox emailTextBox; private OsuTextBox emailTextBox;
private OsuPasswordTextBox passwordTextBox; private OsuPasswordTextBox passwordTextBox;
private IAPIProvider api; [Resolved]
private IAPIProvider api { get; set; }
private ShakeContainer registerShake; private ShakeContainer registerShake;
private IEnumerable<Drawable> characterCheckText; private IEnumerable<Drawable> characterCheckText;
private OsuTextBox[] textboxes; private OsuTextBox[] textboxes;
private ProcessingOverlay processingOverlay; private ProcessingOverlay processingOverlay;
private GameHost host;
[Resolved]
private GameHost host { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours, IAPIProvider api, GameHost host) private void load(OsuColour colours)
{ {
this.api = api;
this.host = host;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new FillFlowContainer new FillFlowContainer

View File

@ -22,7 +22,9 @@ namespace osu.Game.Overlays.AccountCreation
{ {
private OsuTextFlowContainer multiAccountExplanationText; private OsuTextFlowContainer multiAccountExplanationText;
private LinkFlowContainer furtherAssistance; private LinkFlowContainer furtherAssistance;
private IAPIProvider api;
[Resolved(CanBeNull = true)]
private IAPIProvider api { get; set; }
private const string help_centre_url = "/help/wiki/Help_Centre#login"; private const string help_centre_url = "/help/wiki/Help_Centre#login";
@ -39,10 +41,8 @@ namespace osu.Game.Overlays.AccountCreation
} }
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(OsuColour colours, IAPIProvider api, OsuGame game, TextureStore textures) private void load(OsuColour colours, OsuGame game, TextureStore textures)
{ {
this.api = api;
if (string.IsNullOrEmpty(api.ProvidedUsername)) if (string.IsNullOrEmpty(api.ProvidedUsername))
return; return;

View File

@ -25,7 +25,8 @@ namespace osu.Game.Overlays
public const float RIGHT_WIDTH = 275; public const float RIGHT_WIDTH = 275;
protected readonly Header Header; protected readonly Header Header;
private RulesetStore rulesets; [Resolved]
private RulesetStore rulesets { get; set; }
private readonly Bindable<BeatmapSetInfo> beatmapSet = new Bindable<BeatmapSetInfo>(); private readonly Bindable<BeatmapSetInfo> beatmapSet = new Bindable<BeatmapSetInfo>();
@ -90,10 +91,8 @@ namespace osu.Game.Overlays
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(RulesetStore rulesets) private void load()
{ {
this.rulesets = rulesets;
background.Colour = ColourProvider.Background6; background.Colour = ColourProvider.Background6;
} }

View File

@ -30,7 +30,8 @@ namespace osu.Game.Overlays
private const float textbox_height = 60; private const float textbox_height = 60;
private const float channel_selection_min_height = 0.3f; private const float channel_selection_min_height = 0.3f;
private ChannelManager channelManager; [Resolved]
private ChannelManager channelManager { get; set; }
private Container<DrawableChannel> currentChannelContainer; private Container<DrawableChannel> currentChannelContainer;
@ -72,7 +73,7 @@ namespace osu.Game.Overlays
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config, OsuColour colours, ChannelManager channelManager) private void load(OsuConfigManager config, OsuColour colours)
{ {
const float padding = 5; const float padding = 5;
@ -209,8 +210,6 @@ namespace osu.Game.Overlays
chatBackground.Colour = colours.ChatBlue; chatBackground.Colour = colours.ChatBlue;
this.channelManager = channelManager;
loading.Show(); loading.Show();
// This is a relatively expensive (and blocking) operation. // This is a relatively expensive (and blocking) operation.

View File

@ -85,13 +85,12 @@ namespace osu.Game.Overlays.Direct
Playing.ValueChanged += playingStateChanged; Playing.ValueChanged += playingStateChanged;
} }
private PreviewTrackManager previewTrackManager; [Resolved]
private PreviewTrackManager previewTrackManager { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colour, PreviewTrackManager previewTrackManager) private void load(OsuColour colour)
{ {
this.previewTrackManager = previewTrackManager;
hoverColour = colour.Yellow; hoverColour = colour.Yellow;
} }

View File

@ -27,7 +27,8 @@ namespace osu.Game.Overlays
{ {
private const float panel_padding = 10f; private const float panel_padding = 10f;
private RulesetStore rulesets; [Resolved]
private RulesetStore rulesets { get; set; }
private readonly FillFlowContainer resultCountsContainer; private readonly FillFlowContainer resultCountsContainer;
private readonly OsuSpriteText resultCountsText; private readonly OsuSpriteText resultCountsText;
@ -155,11 +156,8 @@ namespace osu.Game.Overlays
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours, RulesetStore rulesets, PreviewTrackManager previewTrackManager) private void load(OsuColour colours)
{ {
this.rulesets = rulesets;
this.previewTrackManager = previewTrackManager;
resultCountsContainer.Colour = colours.Yellow; resultCountsContainer.Colour = colours.Yellow;
} }
@ -228,7 +226,9 @@ namespace osu.Game.Overlays
private readonly Bindable<string> currentQuery = new Bindable<string>(string.Empty); private readonly Bindable<string> currentQuery = new Bindable<string>(string.Empty);
private ScheduledDelegate queryChangedDebounce; private ScheduledDelegate queryChangedDebounce;
private PreviewTrackManager previewTrackManager;
[Resolved]
private PreviewTrackManager previewTrackManager { get; set; }
private void queueUpdateSearch(bool queryTextChanged = false) private void queueUpdateSearch(bool queryTextChanged = false)
{ {

View File

@ -66,13 +66,12 @@ namespace osu.Game.Overlays.KeyBinding
CornerRadius = padding; CornerRadius = padding;
} }
private KeyBindingStore store; [Resolved]
private KeyBindingStore store { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours, KeyBindingStore store) private void load(OsuColour colours)
{ {
this.store = store;
EdgeEffect = new EdgeEffectParameters EdgeEffect = new EdgeEffectParameters
{ {
Radius = 2, Radius = 2,

View File

@ -26,16 +26,17 @@ namespace osu.Game.Overlays.Music
private readonly BindableList<BeatmapSetInfo> beatmapSets = new BindableList<BeatmapSetInfo>(); private readonly BindableList<BeatmapSetInfo> beatmapSets = new BindableList<BeatmapSetInfo>();
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>(); private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
private BeatmapManager beatmaps;
[Resolved]
private BeatmapManager beatmaps { get; set; }
private FilterControl filter; private FilterControl filter;
private Playlist list; private Playlist list;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours, Bindable<WorkingBeatmap> beatmap, BeatmapManager beatmaps) private void load(OsuColour colours, Bindable<WorkingBeatmap> beatmap)
{ {
this.beatmap.BindTo(beatmap); this.beatmap.BindTo(beatmap);
this.beatmaps = beatmaps;
Children = new Drawable[] Children = new Drawable[]
{ {

View File

@ -14,14 +14,10 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
{ {
protected override string Header => "Devices"; protected override string Header => "Devices";
private AudioManager audio; [Resolved]
private SettingsDropdown<string> dropdown; private AudioManager audio { get; set; }
[BackgroundDependencyLoader] private SettingsDropdown<string> dropdown;
private void load(AudioManager audio)
{
this.audio = audio;
}
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)
{ {

View File

@ -29,7 +29,9 @@ namespace osu.Game.Overlays.Settings.Sections.General
{ {
private bool bounding = true; private bool bounding = true;
private LoginForm form; private LoginForm form;
private OsuColour colours;
[Resolved]
private OsuColour colours { get; set; }
private UserPanel panel; private UserPanel panel;
private UserDropdown dropdown; private UserDropdown dropdown;
@ -60,10 +62,8 @@ namespace osu.Game.Overlays.Settings.Sections.General
} }
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuColour colours, IAPIProvider api) private void load(IAPIProvider api)
{ {
this.colours = colours;
api?.Register(this); api?.Register(this);
} }
@ -201,7 +201,9 @@ namespace osu.Game.Overlays.Settings.Sections.General
private TextBox username; private TextBox username;
private TextBox password; private TextBox password;
private ShakeContainer shakeSignIn; private ShakeContainer shakeSignIn;
private IAPIProvider api;
[Resolved(CanBeNull = true)]
private IAPIProvider api { get; set; }
public Action RequestHide; public Action RequestHide;
@ -214,9 +216,8 @@ namespace osu.Game.Overlays.Settings.Sections.General
} }
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(IAPIProvider api, OsuConfigManager config, AccountCreationOverlay accountCreation) private void load(OsuConfigManager config, AccountCreationOverlay accountCreation)
{ {
this.api = api;
Direction = FillDirection.Vertical; Direction = FillDirection.Vertical;
Spacing = new Vector2(0, 5); Spacing = new Vector2(0, 5);
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;

View File

@ -29,7 +29,9 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
private Bindable<Size> sizeFullscreen; private Bindable<Size> sizeFullscreen;
private readonly IBindableList<WindowMode> windowModes = new BindableList<WindowMode>(); private readonly IBindableList<WindowMode> windowModes = new BindableList<WindowMode>();
private OsuGameBase game; [Resolved]
private OsuGameBase game { get; set; }
private SettingsDropdown<Size> resolutionDropdown; private SettingsDropdown<Size> resolutionDropdown;
private SettingsDropdown<WindowMode> windowModeDropdown; private SettingsDropdown<WindowMode> windowModeDropdown;
@ -41,10 +43,8 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
private const int transition_duration = 400; private const int transition_duration = 400;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, OsuGameBase game, GameHost host) private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, GameHost host)
{ {
this.game = game;
scalingMode = osuConfig.GetBindable<ScalingMode>(OsuSetting.Scaling); scalingMode = osuConfig.GetBindable<ScalingMode>(OsuSetting.Scaling);
sizeFullscreen = config.GetBindable<Size>(FrameworkSetting.SizeFullscreen); sizeFullscreen = config.GetBindable<Size>(FrameworkSetting.SizeFullscreen);
scalingSizeX = osuConfig.GetBindable<float>(OsuSetting.ScalingSizeX); scalingSizeX = osuConfig.GetBindable<float>(OsuSetting.ScalingSizeX);

View File

@ -24,13 +24,12 @@ namespace osu.Game.Overlays.Settings.Sections
private readonly Bindable<SkinInfo> dropdownBindable = new Bindable<SkinInfo> { Default = SkinInfo.Default }; private readonly Bindable<SkinInfo> dropdownBindable = new Bindable<SkinInfo> { Default = SkinInfo.Default };
private readonly Bindable<int> configBindable = new Bindable<int>(); private readonly Bindable<int> configBindable = new Bindable<int>();
private SkinManager skins; [Resolved]
private SkinManager skins { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config, SkinManager skins) private void load(OsuConfigManager config)
{ {
this.skins = skins;
FlowContent.Spacing = new Vector2(0, 5); FlowContent.Spacing = new Vector2(0, 5);
Children = new Drawable[] Children = new Drawable[]
{ {

View File

@ -23,7 +23,8 @@ namespace osu.Game.Rulesets.Judgements
{ {
private const float judgement_size = 128; private const float judgement_size = 128;
private OsuColour colours; [Resolved]
private OsuColour colours { get; set; }
protected readonly JudgementResult Result; protected readonly JudgementResult Result;
@ -56,10 +57,8 @@ namespace osu.Game.Rulesets.Judgements
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load()
{ {
this.colours = colours;
InternalChild = JudgementBody = new Container InternalChild = JudgementBody = new Container
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,

View File

@ -25,15 +25,14 @@ namespace osu.Game.Screens.Edit.Components
{ {
private IconButton playButton; private IconButton playButton;
private IAdjustableClock adjustableClock; [Resolved]
private IAdjustableClock adjustableClock { get; set; }
private readonly BindableNumber<double> tempo = new BindableDouble(1); private readonly BindableNumber<double> tempo = new BindableDouble(1);
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(IAdjustableClock adjustableClock) private void load()
{ {
this.adjustableClock = adjustableClock;
Children = new Drawable[] Children = new Drawable[]
{ {
playButton = new IconButton playButton = new IconButton

View File

@ -14,7 +14,8 @@ namespace osu.Game.Screens.Edit.Components
{ {
private readonly OsuSpriteText trackTimer; private readonly OsuSpriteText trackTimer;
private IAdjustableClock adjustableClock; [Resolved]
private IAdjustableClock adjustableClock { get; set; }
public TimeInfoContainer() public TimeInfoContainer()
{ {
@ -30,12 +31,6 @@ namespace osu.Game.Screens.Edit.Components
}; };
} }
[BackgroundDependencyLoader]
private void load(IAdjustableClock adjustableClock)
{
this.adjustableClock = adjustableClock;
}
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();

View File

@ -24,7 +24,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
public readonly Bindable<bool> WaveformVisible = new Bindable<bool>(); public readonly Bindable<bool> WaveformVisible = new Bindable<bool>();
public readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>(); public readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
private IAdjustableClock adjustableClock; [Resolved]
private IAdjustableClock adjustableClock { get; set; }
public Timeline() public Timeline()
{ {
@ -36,10 +37,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private WaveformGraph waveform; private WaveformGraph waveform;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(IBindable<WorkingBeatmap> beatmap, IAdjustableClock adjustableClock, OsuColour colours) private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours)
{ {
this.adjustableClock = adjustableClock;
Add(waveform = new WaveformGraph Add(waveform = new WaveformGraph
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,

View File

@ -44,7 +44,7 @@ namespace osu.Game.Screens.Menu
private SampleChannel welcome; private SampleChannel welcome;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load()
{ {
if (MenuVoice.Value && !MenuMusic.Value) if (MenuVoice.Value && !MenuMusic.Value)
welcome = audio.Samples.Get(@"welcome"); welcome = audio.Samples.Get(@"welcome");
@ -102,13 +102,12 @@ namespace osu.Game.Screens.Menu
this.background = background; this.background = background;
} }
private OsuGameBase game; [Resolved]
private OsuGameBase game { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(TextureStore textures, OsuGameBase game) private void load(TextureStore textures)
{ {
this.game = game;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
triangles = new GlitchingTriangles triangles = new GlitchingTriangles

View File

@ -23,7 +23,9 @@ namespace osu.Game.Screens.Multi.Ranking.Pages
{ {
public class RoomLeaderboardPage : ResultsPage public class RoomLeaderboardPage : ResultsPage
{ {
private OsuColour colours; [Resolved]
private OsuColour colours { get; set; }
private TextFlowContainer rankText; private TextFlowContainer rankText;
[Resolved(typeof(Room), nameof(Room.Name))] [Resolved(typeof(Room), nameof(Room.Name))]
@ -35,10 +37,8 @@ namespace osu.Game.Screens.Multi.Ranking.Pages
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load()
{ {
this.colours = colours;
MatchLeaderboard leaderboard; MatchLeaderboard leaderboard;
Children = new Drawable[] Children = new Drawable[]

View File

@ -65,7 +65,8 @@ namespace osu.Game.Screens.Play
private Ruleset ruleset; private Ruleset ruleset;
private IAPIProvider api; [Resolved]
private IAPIProvider api { get; set; }
private SampleChannel sampleRestart; private SampleChannel sampleRestart;
@ -118,10 +119,8 @@ namespace osu.Game.Screens.Play
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); => dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio, IAPIProvider api, OsuConfigManager config) private void load(AudioManager audio, OsuConfigManager config)
{ {
this.api = api;
Mods.Value = base.Mods.Value.Select(m => m.CreateCopy()).ToArray(); Mods.Value = base.Mods.Value.Select(m => m.CreateCopy()).ToArray();
if (Beatmap.Value is DummyWorkingBeatmap) if (Beatmap.Value is DummyWorkingBeatmap)

View File

@ -37,7 +37,8 @@ namespace osu.Game.Screens.Select
private readonly FailRetryGraph failRetryGraph; private readonly FailRetryGraph failRetryGraph;
private readonly DimmedLoadingLayer loading; private readonly DimmedLoadingLayer loading;
private IAPIProvider api; [Resolved]
private IAPIProvider api { get; set; }
private ScheduledDelegate pendingBeatmapSwitch; private ScheduledDelegate pendingBeatmapSwitch;
@ -160,12 +161,6 @@ namespace osu.Game.Screens.Select
}; };
} }
[BackgroundDependencyLoader]
private void load(IAPIProvider api)
{
this.api = api;
}
protected override void UpdateAfterChildren() protected override void UpdateAfterChildren()
{ {
base.UpdateAfterChildren(); base.UpdateAfterChildren();

View File

@ -37,7 +37,8 @@ namespace osu.Game.Screens.Select.Carousel
private Triangles triangles; private Triangles triangles;
private StarCounter starCounter; private StarCounter starCounter;
private BeatmapSetOverlay beatmapOverlay; [Resolved(CanBeNull = true)]
private BeatmapSetOverlay beatmapOverlay { get; set; }
public DrawableCarouselBeatmap(CarouselBeatmap panel) public DrawableCarouselBeatmap(CarouselBeatmap panel)
: base(panel) : base(panel)
@ -47,10 +48,8 @@ namespace osu.Game.Screens.Select.Carousel
} }
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(SongSelect songSelect, BeatmapManager manager, BeatmapSetOverlay beatmapOverlay) private void load(SongSelect songSelect, BeatmapManager manager)
{ {
this.beatmapOverlay = beatmapOverlay;
if (songSelect != null) if (songSelect != null)
{ {
startRequested = b => songSelect.FinaliseSelection(b); startRequested = b => songSelect.FinaliseSelection(b);

View File

@ -30,7 +30,9 @@ namespace osu.Game.Screens.Select.Carousel
private Action<BeatmapSetInfo> restoreHiddenRequested; private Action<BeatmapSetInfo> restoreHiddenRequested;
private Action<int> viewDetails; private Action<int> viewDetails;
private DialogOverlay dialogOverlay; [Resolved(CanBeNull = true)]
private DialogOverlay dialogOverlay { get; set; }
private readonly BeatmapSetInfo beatmapSet; private readonly BeatmapSetInfo beatmapSet;
public DrawableCarouselBeatmapSet(CarouselBeatmapSet set) public DrawableCarouselBeatmapSet(CarouselBeatmapSet set)
@ -40,10 +42,9 @@ namespace osu.Game.Screens.Select.Carousel
} }
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(BeatmapManager manager, BeatmapSetOverlay beatmapOverlay, DialogOverlay overlay) private void load(BeatmapManager manager, BeatmapSetOverlay beatmapOverlay)
{ {
restoreHiddenRequested = s => s.Beatmaps.ForEach(manager.Restore); restoreHiddenRequested = s => s.Beatmaps.ForEach(manager.Restore);
dialogOverlay = overlay;
if (beatmapOverlay != null) if (beatmapOverlay != null)
viewDetails = beatmapOverlay.FetchAndShowBeatmapSet; viewDetails = beatmapOverlay.FetchAndShowBeatmapSet;

View File

@ -21,7 +21,8 @@ namespace osu.Game.Skinning
private SampleChannel[] channels; private SampleChannel[] channels;
private ISampleStore samples; [Resolved]
private ISampleStore samples { get; set; }
public SkinnableSound(IEnumerable<ISampleInfo> hitSamples) public SkinnableSound(IEnumerable<ISampleInfo> hitSamples)
{ {
@ -33,12 +34,6 @@ namespace osu.Game.Skinning
this.hitSamples = new[] { hitSamples }; this.hitSamples = new[] { hitSamples };
} }
[BackgroundDependencyLoader]
private void load(ISampleStore samples)
{
this.samples = samples;
}
private bool looping; private bool looping;
public bool Looping public bool Looping

View File

@ -20,12 +20,13 @@ namespace osu.Game.Updater
public class SimpleUpdateManager : UpdateManager public class SimpleUpdateManager : UpdateManager
{ {
private string version; private string version;
private GameHost host;
[Resolved]
private GameHost host { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuGameBase game, GameHost host) private void load(OsuGameBase game)
{ {
this.host = host;
version = game.Version; version = game.Version;
if (game.IsDeployedBuild) if (game.IsDeployedBuild)