From c753cb46c50d48107fb58ebdd93f8ae4c54e542f Mon Sep 17 00:00:00 2001 From: recapitalverb <41869184+recapitalverb@users.noreply.github.com> Date: Fri, 14 Feb 2020 20:14:00 +0700 Subject: [PATCH] Use [Resolved] wherever possible --- osu.Game/Audio/PreviewTrackManager.cs | 15 +++++---------- osu.Game/Graphics/ScreenshotManager.cs | 12 +++++++----- osu.Game/Graphics/UserInterface/DownloadButton.cs | 7 +++---- .../Graphics/UserInterface/ExternalLinkButton.cs | 7 ++++--- osu.Game/Graphics/UserInterface/FocusedTextBox.cs | 7 +++---- .../Graphics/UserInterface/OsuPasswordTextBox.cs | 9 ++------- osu.Game/Online/Chat/ChannelManager.cs | 9 ++------- osu.Game/Online/Chat/ExternalLinkOpener.cs | 12 +++++++----- osu.Game/Online/DownloadTrackingComposite.cs | 7 +++---- osu.Game/Online/Leaderboards/Leaderboard.cs | 8 ++++---- osu.Game/OsuGame.cs | 7 +++---- osu.Game/Overlays/AccountCreation/ScreenEntry.cs | 13 +++++++------ .../Overlays/AccountCreation/ScreenWarning.cs | 8 ++++---- osu.Game/Overlays/BeatmapSetOverlay.cs | 7 +++---- osu.Game/Overlays/ChatOverlay.cs | 7 +++---- osu.Game/Overlays/Direct/PlayButton.cs | 7 +++---- osu.Game/Overlays/DirectOverlay.cs | 12 ++++++------ osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 7 +++---- osu.Game/Overlays/Music/PlaylistOverlay.cs | 7 ++++--- .../Sections/Audio/AudioDevicesSettings.cs | 9 ++------- .../Settings/Sections/General/LoginSettings.cs | 15 ++++++++------- .../Settings/Sections/Graphics/LayoutSettings.cs | 8 ++++---- .../Overlays/Settings/Sections/SkinSection.cs | 7 +++---- osu.Game/Rulesets/Judgements/DrawableJudgement.cs | 7 +++---- .../Screens/Edit/Components/PlaybackControl.cs | 7 +++---- .../Screens/Edit/Components/TimeInfoContainer.cs | 9 ++------- .../Edit/Compose/Components/Timeline/Timeline.cs | 7 +++---- osu.Game/Screens/Menu/IntroTriangles.cs | 7 +++---- .../Multi/Ranking/Pages/RoomLeaderboardPage.cs | 8 ++++---- osu.Game/Screens/Play/Player.cs | 7 +++---- osu.Game/Screens/Select/BeatmapDetails.cs | 9 ++------- .../Select/Carousel/DrawableCarouselBeatmap.cs | 7 +++---- .../Select/Carousel/DrawableCarouselBeatmapSet.cs | 6 +++--- osu.Game/Skinning/SkinnableSound.cs | 9 ++------- osu.Game/Updater/SimpleUpdateManager.cs | 7 ++++--- 35 files changed, 128 insertions(+), 169 deletions(-) diff --git a/osu.Game/Audio/PreviewTrackManager.cs b/osu.Game/Audio/PreviewTrackManager.cs index 6f0b62543d..862be41c1a 100644 --- a/osu.Game/Audio/PreviewTrackManager.cs +++ b/osu.Game/Audio/PreviewTrackManager.cs @@ -19,13 +19,15 @@ namespace osu.Game.Audio { private readonly BindableDouble muteBindable = new BindableDouble(); - private AudioManager audio; + [Resolved] + private AudioManager audio { get; set; } + private PreviewTrackStore trackStore; protected TrackManagerPreviewTrack CurrentTrack; [BackgroundDependencyLoader] - private void load(AudioManager audio) + private void load() { // this is a temporary solution to get around muting ourselves. // todo: update this once we have a BackgroundTrackManager or similar. @@ -33,8 +35,6 @@ namespace osu.Game.Audio audio.AddItem(trackStore); trackStore.AddAdjustment(AdjustableProperty.Volume, audio.VolumeTrack); - - this.audio = audio; } /// @@ -90,6 +90,7 @@ namespace osu.Game.Audio public class TrackManagerPreviewTrack : PreviewTrack { + [Resolved] public IPreviewTrackOwner Owner { get; private set; } private readonly BeatmapSetInfo beatmapSetInfo; @@ -101,12 +102,6 @@ namespace osu.Game.Audio 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"); } diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index e21545688b..9804aefce8 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -35,18 +35,20 @@ namespace osu.Game.Graphics private Bindable screenshotFormat; private Bindable 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(OsuSetting.ScreenshotFormat); captureMenuCursor = config.GetBindable(OsuSetting.ScreenshotCaptureMenuCursor); diff --git a/osu.Game/Graphics/UserInterface/DownloadButton.cs b/osu.Game/Graphics/UserInterface/DownloadButton.cs index 41b90d3802..86a5cb9aa6 100644 --- a/osu.Game/Graphics/UserInterface/DownloadButton.cs +++ b/osu.Game/Graphics/UserInterface/DownloadButton.cs @@ -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); } diff --git a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs index 7225dbc66f..5a1eb53fe1 100644 --- a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs +++ b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs @@ -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) diff --git a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs index e59353a480..8977f014b6 100644 --- a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs +++ b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs @@ -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); } diff --git a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs index e4a4b1c50e..e7699e5255 100644 --- a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs @@ -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) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 4b5ec1cad0..2c37216fd6 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -48,7 +48,8 @@ namespace osu.Game.Online.Chat /// public IBindableList AvailableChannels => availableChannels; - private IAPIProvider api; + [Resolved] + private IAPIProvider api { get; set; } public readonly BindableBool HighPollRate = new BindableBool(); @@ -466,12 +467,6 @@ namespace osu.Game.Online.Chat api.Queue(req); } - - [BackgroundDependencyLoader] - private void load(IAPIProvider api) - { - this.api = api; - } } /// diff --git a/osu.Game/Online/Chat/ExternalLinkOpener.cs b/osu.Game/Online/Chat/ExternalLinkOpener.cs index 495f1ac0b0..da90ea6845 100644 --- a/osu.Game/Online/Chat/ExternalLinkOpener.cs +++ b/osu.Game/Online/Chat/ExternalLinkOpener.cs @@ -13,15 +13,17 @@ namespace osu.Game.Online.Chat { public class ExternalLinkOpener : Component { - private GameHost host; - private DialogOverlay dialogOverlay; + [Resolved] + private GameHost host { get; set; } + + [Resolved] + private DialogOverlay dialogOverlay { get; set; } + private Bindable externalLinkWarning; [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(OsuSetting.ExternalLinkWarning); } diff --git a/osu.Game/Online/DownloadTrackingComposite.cs b/osu.Game/Online/DownloadTrackingComposite.cs index 9a0e112727..9eb5f36729 100644 --- a/osu.Game/Online/DownloadTrackingComposite.cs +++ b/osu.Game/Online/DownloadTrackingComposite.cs @@ -19,7 +19,8 @@ namespace osu.Game.Online { protected readonly Bindable Model = new Bindable(); - private TModelManager manager; + [Resolved] + private TModelManager manager { get; set; } /// /// Holds the current download state of the , whether is has already been downloaded, is in progress, or is not downloaded. @@ -34,10 +35,8 @@ namespace osu.Game.Online } [BackgroundDependencyLoader(true)] - private void load(TModelManager manager) + private void load() { - this.manager = manager; - Model.BindValueChanged(modelInfo => { if (modelInfo.NewValue == null) diff --git a/osu.Game/Online/Leaderboards/Leaderboard.cs b/osu.Game/Online/Leaderboards/Leaderboard.cs index 87c747675a..71859d3aeb 100644 --- a/osu.Game/Online/Leaderboards/Leaderboard.cs +++ b/osu.Game/Online/Leaderboards/Leaderboard.cs @@ -217,14 +217,14 @@ namespace osu.Game.Online.Leaderboards Scores = null; } - private IAPIProvider api; + [Resolved(CanBeNull = true)] + private IAPIProvider api { get; set; } private ScheduledDelegate pendingUpdateScores; - [BackgroundDependencyLoader(true)] - private void load(IAPIProvider api) + [BackgroundDependencyLoader] + private void load() { - this.api = api; api?.Register(this); } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index e7fffd49b4..100730d40d 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -150,10 +150,8 @@ namespace osu.Game dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); [BackgroundDependencyLoader] - private void load(FrameworkConfigManager frameworkConfig) + private void load() { - this.frameworkConfig = frameworkConfig; - if (!Host.IsPrimaryInstance && !DebugUtils.IsDebugBuild) { Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error); @@ -881,7 +879,8 @@ namespace osu.Game private Container topMostOverlayContent; - private FrameworkConfigManager frameworkConfig; + [Resolved] + private FrameworkConfigManager frameworkConfig { get; set; } private ScalingContainer screenContainer; diff --git a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs index 7067e02cd2..be3a84ca00 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs @@ -33,20 +33,21 @@ namespace osu.Game.Overlays.AccountCreation private OsuTextBox emailTextBox; private OsuPasswordTextBox passwordTextBox; - private IAPIProvider api; + [Resolved] + private IAPIProvider api { get; set; } + private ShakeContainer registerShake; private IEnumerable characterCheckText; private OsuTextBox[] textboxes; private ProcessingOverlay processingOverlay; - private GameHost host; + + [Resolved] + private GameHost host { get; set; } [BackgroundDependencyLoader] - private void load(OsuColour colours, IAPIProvider api, GameHost host) + private void load(OsuColour colours) { - this.api = api; - this.host = host; - InternalChildren = new Drawable[] { new FillFlowContainer diff --git a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs index f91d2e3323..3c3c27ab6f 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs @@ -22,7 +22,9 @@ namespace osu.Game.Overlays.AccountCreation { private OsuTextFlowContainer multiAccountExplanationText; private LinkFlowContainer furtherAssistance; - private IAPIProvider api; + + [Resolved] + private IAPIProvider api { get; set; } private const string help_centre_url = "/help/wiki/Help_Centre#login"; @@ -39,10 +41,8 @@ namespace osu.Game.Overlays.AccountCreation } [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)) return; diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index 7624351e41..d29997f7e5 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -25,7 +25,8 @@ namespace osu.Game.Overlays public const float RIGHT_WIDTH = 275; protected readonly Header Header; - private RulesetStore rulesets; + [Resolved] + private RulesetStore rulesets { get; set; } private readonly Bindable beatmapSet = new Bindable(); @@ -90,10 +91,8 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(RulesetStore rulesets) + private void load() { - this.rulesets = rulesets; - background.Colour = ColourProvider.Background6; } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index f2aef0995f..bdc241a437 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -30,7 +30,8 @@ namespace osu.Game.Overlays private const float textbox_height = 60; private const float channel_selection_min_height = 0.3f; - private ChannelManager channelManager; + [Resolved] + private ChannelManager channelManager { get; set; } private Container currentChannelContainer; @@ -72,7 +73,7 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(OsuConfigManager config, OsuColour colours, ChannelManager channelManager) + private void load(OsuConfigManager config, OsuColour colours) { const float padding = 5; @@ -209,8 +210,6 @@ namespace osu.Game.Overlays chatBackground.Colour = colours.ChatBlue; - this.channelManager = channelManager; - loading.Show(); // This is a relatively expensive (and blocking) operation. diff --git a/osu.Game/Overlays/Direct/PlayButton.cs b/osu.Game/Overlays/Direct/PlayButton.cs index 2a77e7ca26..10abe15177 100644 --- a/osu.Game/Overlays/Direct/PlayButton.cs +++ b/osu.Game/Overlays/Direct/PlayButton.cs @@ -85,13 +85,12 @@ namespace osu.Game.Overlays.Direct Playing.ValueChanged += playingStateChanged; } - private PreviewTrackManager previewTrackManager; + [Resolved] + private PreviewTrackManager previewTrackManager { get; set; } [BackgroundDependencyLoader] - private void load(OsuColour colour, PreviewTrackManager previewTrackManager) + private void load(OsuColour colour) { - this.previewTrackManager = previewTrackManager; - hoverColour = colour.Yellow; } diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index e4cef319fe..6cc48f09bd 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -27,7 +27,8 @@ namespace osu.Game.Overlays { private const float panel_padding = 10f; - private RulesetStore rulesets; + [Resolved] + private RulesetStore rulesets { get; set; } private readonly FillFlowContainer resultCountsContainer; private readonly OsuSpriteText resultCountsText; @@ -155,11 +156,8 @@ namespace osu.Game.Overlays } [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; } @@ -228,7 +226,9 @@ namespace osu.Game.Overlays private readonly Bindable currentQuery = new Bindable(string.Empty); private ScheduledDelegate queryChangedDebounce; - private PreviewTrackManager previewTrackManager; + + [Resolved] + private PreviewTrackManager previewTrackManager { get; set; } private void queueUpdateSearch(bool queryTextChanged = false) { diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index d2fcc2652a..58ca2143f9 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -66,13 +66,12 @@ namespace osu.Game.Overlays.KeyBinding CornerRadius = padding; } - private KeyBindingStore store; + [Resolved] + private KeyBindingStore store { get; set; } [BackgroundDependencyLoader] - private void load(OsuColour colours, KeyBindingStore store) + private void load(OsuColour colours) { - this.store = store; - EdgeEffect = new EdgeEffectParameters { Radius = 2, diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 7c391e27f9..8f753fd3aa 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -26,16 +26,17 @@ namespace osu.Game.Overlays.Music private readonly BindableList beatmapSets = new BindableList(); private readonly Bindable beatmap = new Bindable(); - private BeatmapManager beatmaps; + + [Resolved] + private BeatmapManager beatmaps { get; set; } private FilterControl filter; private Playlist list; [BackgroundDependencyLoader] - private void load(OsuColour colours, Bindable beatmap, BeatmapManager beatmaps) + private void load(OsuColour colours, Bindable beatmap) { this.beatmap.BindTo(beatmap); - this.beatmaps = beatmaps; Children = new Drawable[] { diff --git a/osu.Game/Overlays/Settings/Sections/Audio/AudioDevicesSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/AudioDevicesSettings.cs index 0612f028bc..3cc233ef73 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/AudioDevicesSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/AudioDevicesSettings.cs @@ -14,15 +14,10 @@ namespace osu.Game.Overlays.Settings.Sections.Audio { protected override string Header => "Devices"; - private AudioManager audio; + [Resolved] + private AudioManager audio { get; set; } private SettingsDropdown dropdown; - [BackgroundDependencyLoader] - private void load(AudioManager audio) - { - this.audio = audio; - } - protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index e485aa5ea9..b41c7d5afb 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -29,7 +29,9 @@ namespace osu.Game.Overlays.Settings.Sections.General { private bool bounding = true; private LoginForm form; - private OsuColour colours; + + [Resolved] + private OsuColour colours { get; set; } private UserPanel panel; private UserDropdown dropdown; @@ -60,10 +62,8 @@ namespace osu.Game.Overlays.Settings.Sections.General } [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuColour colours, IAPIProvider api) + private void load(IAPIProvider api) { - this.colours = colours; - api?.Register(this); } @@ -201,7 +201,9 @@ namespace osu.Game.Overlays.Settings.Sections.General private TextBox username; private TextBox password; private ShakeContainer shakeSignIn; - private IAPIProvider api; + + [Resolved] + private IAPIProvider api { get; set; } public Action RequestHide; @@ -214,9 +216,8 @@ namespace osu.Game.Overlays.Settings.Sections.General } [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; Spacing = new Vector2(0, 5); AutoSizeAxes = Axes.Y; diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index efbb08b7df..b73c8f7622 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -29,7 +29,9 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private Bindable sizeFullscreen; private readonly IBindableList windowModes = new BindableList(); - private OsuGameBase game; + [Resolved] + private OsuGameBase game { get; set; } + private SettingsDropdown resolutionDropdown; private SettingsDropdown windowModeDropdown; @@ -41,10 +43,8 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private const int transition_duration = 400; [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(OsuSetting.Scaling); sizeFullscreen = config.GetBindable(FrameworkSetting.SizeFullscreen); scalingSizeX = osuConfig.GetBindable(OsuSetting.ScalingSizeX); diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index d3029d8ab9..b229014c84 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -24,13 +24,12 @@ namespace osu.Game.Overlays.Settings.Sections private readonly Bindable dropdownBindable = new Bindable { Default = SkinInfo.Default }; private readonly Bindable configBindable = new Bindable(); - private SkinManager skins; + [Resolved] + private SkinManager skins { get; set; } [BackgroundDependencyLoader] - private void load(OsuConfigManager config, SkinManager skins) + private void load(OsuConfigManager config) { - this.skins = skins; - FlowContent.Spacing = new Vector2(0, 5); Children = new Drawable[] { diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index 8289ca175d..960585b968 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -23,7 +23,8 @@ namespace osu.Game.Rulesets.Judgements { private const float judgement_size = 128; - private OsuColour colours; + [Resolved] + private OsuColour colours { get; set; } protected readonly JudgementResult Result; @@ -56,10 +57,8 @@ namespace osu.Game.Rulesets.Judgements } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load() { - this.colours = colours; - InternalChild = JudgementBody = new Container { Anchor = Anchor.Centre, diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index 66df68418a..897c6ec531 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -25,15 +25,14 @@ namespace osu.Game.Screens.Edit.Components { private IconButton playButton; - private IAdjustableClock adjustableClock; + [Resolved] + private IAdjustableClock adjustableClock { get; set; } private readonly BindableNumber tempo = new BindableDouble(1); [BackgroundDependencyLoader] - private void load(IAdjustableClock adjustableClock) + private void load() { - this.adjustableClock = adjustableClock; - Children = new Drawable[] { playButton = new IconButton diff --git a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs index 0391074b11..4bf21d240a 100644 --- a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs +++ b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs @@ -14,7 +14,8 @@ namespace osu.Game.Screens.Edit.Components { private readonly OsuSpriteText trackTimer; - private IAdjustableClock adjustableClock; + [Resolved] + private IAdjustableClock adjustableClock { get; set; } 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() { base.Update(); diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index 0475e68e42..ddca5e42c2 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -24,7 +24,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline public readonly Bindable WaveformVisible = new Bindable(); public readonly IBindable Beatmap = new Bindable(); - private IAdjustableClock adjustableClock; + [Resolved] + private IAdjustableClock adjustableClock { get; set; } public Timeline() { @@ -36,10 +37,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline private WaveformGraph waveform; [BackgroundDependencyLoader] - private void load(IBindable beatmap, IAdjustableClock adjustableClock, OsuColour colours) + private void load(IBindable beatmap, OsuColour colours) { - this.adjustableClock = adjustableClock; - Add(waveform = new WaveformGraph { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index 4deaa68467..29f32406e8 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -102,13 +102,12 @@ namespace osu.Game.Screens.Menu this.background = background; } - private OsuGameBase game; + [Resolved] + private OsuGameBase game { get; set; } [BackgroundDependencyLoader] - private void load(TextureStore textures, OsuGameBase game) + private void load(TextureStore textures) { - this.game = game; - InternalChildren = new Drawable[] { triangles = new GlitchingTriangles diff --git a/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs b/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs index ff5471cf4a..f8fb192b5c 100644 --- a/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs +++ b/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs @@ -23,7 +23,9 @@ namespace osu.Game.Screens.Multi.Ranking.Pages { public class RoomLeaderboardPage : ResultsPage { - private OsuColour colours; + [Resolved] + private OsuColour colours { get; set; } + private TextFlowContainer rankText; [Resolved(typeof(Room), nameof(Room.Name))] @@ -35,10 +37,8 @@ namespace osu.Game.Screens.Multi.Ranking.Pages } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load() { - this.colours = colours; - MatchLeaderboard leaderboard; Children = new Drawable[] diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 9bfdcd79fe..bd43b23a9f 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -65,7 +65,8 @@ namespace osu.Game.Screens.Play private Ruleset ruleset; - private IAPIProvider api; + [Resolved] + private IAPIProvider api { get; set; } private SampleChannel sampleRestart; @@ -118,10 +119,8 @@ namespace osu.Game.Screens.Play => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); [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(); if (Beatmap.Value is DummyWorkingBeatmap) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 577d999388..85b892336a 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -37,7 +37,8 @@ namespace osu.Game.Screens.Select private readonly FailRetryGraph failRetryGraph; private readonly DimmedLoadingLayer loading; - private IAPIProvider api; + [Resolved] + private IAPIProvider api { get; set; } 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() { base.UpdateAfterChildren(); diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index fba7a328c1..31aca11b86 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -37,7 +37,8 @@ namespace osu.Game.Screens.Select.Carousel private Triangles triangles; private StarCounter starCounter; - private BeatmapSetOverlay beatmapOverlay; + [Resolved] + private BeatmapSetOverlay beatmapOverlay { get; set; } public DrawableCarouselBeatmap(CarouselBeatmap panel) : base(panel) @@ -47,10 +48,8 @@ namespace osu.Game.Screens.Select.Carousel } [BackgroundDependencyLoader(true)] - private void load(SongSelect songSelect, BeatmapManager manager, BeatmapSetOverlay beatmapOverlay) + private void load(SongSelect songSelect, BeatmapManager manager) { - this.beatmapOverlay = beatmapOverlay; - if (songSelect != null) { startRequested = b => songSelect.FinaliseSelection(b); diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 699e01bca7..db59d8a4de 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -30,7 +30,8 @@ namespace osu.Game.Screens.Select.Carousel private Action restoreHiddenRequested; private Action viewDetails; - private DialogOverlay dialogOverlay; + [Resolved] + private DialogOverlay dialogOverlay { get; set; } private readonly BeatmapSetInfo beatmapSet; public DrawableCarouselBeatmapSet(CarouselBeatmapSet set) @@ -40,10 +41,9 @@ namespace osu.Game.Screens.Select.Carousel } [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); - dialogOverlay = overlay; if (beatmapOverlay != null) viewDetails = beatmapOverlay.FetchAndShowBeatmapSet; diff --git a/osu.Game/Skinning/SkinnableSound.cs b/osu.Game/Skinning/SkinnableSound.cs index fc6afd0b27..a78c04ecd4 100644 --- a/osu.Game/Skinning/SkinnableSound.cs +++ b/osu.Game/Skinning/SkinnableSound.cs @@ -21,7 +21,8 @@ namespace osu.Game.Skinning private SampleChannel[] channels; - private ISampleStore samples; + [Resolved] + private ISampleStore samples { get; set; } public SkinnableSound(IEnumerable hitSamples) { @@ -33,12 +34,6 @@ namespace osu.Game.Skinning this.hitSamples = new[] { hitSamples }; } - [BackgroundDependencyLoader] - private void load(ISampleStore samples) - { - this.samples = samples; - } - private bool looping; public bool Looping diff --git a/osu.Game/Updater/SimpleUpdateManager.cs b/osu.Game/Updater/SimpleUpdateManager.cs index 5412b11b33..e490ac14e9 100644 --- a/osu.Game/Updater/SimpleUpdateManager.cs +++ b/osu.Game/Updater/SimpleUpdateManager.cs @@ -20,12 +20,13 @@ namespace osu.Game.Updater public class SimpleUpdateManager : UpdateManager { private string version; - private GameHost host; + + [Resolved] + private GameHost host { get; set; } [BackgroundDependencyLoader] - private void load(OsuGameBase game, GameHost host) + private void load(OsuGameBase game) { - this.host = host; version = game.Version; if (game.IsDeployedBuild)