mirror of https://github.com/ppy/osu
Merge branch 'prevent-dependency-pollution' of github.com:Tom94/osu into better-transforms
This commit is contained in:
commit
750fc0db0e
|
@ -80,6 +80,11 @@ public OsuGame(string[] args = null)
|
||||||
|
|
||||||
public void ToggleDirect() => direct.ToggleVisibility();
|
public void ToggleDirect() => direct.ToggleVisibility();
|
||||||
|
|
||||||
|
private DependencyContainer dependencies;
|
||||||
|
|
||||||
|
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) =>
|
||||||
|
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(FrameworkConfigManager frameworkConfig)
|
private void load(FrameworkConfigManager frameworkConfig)
|
||||||
{
|
{
|
||||||
|
@ -97,7 +102,7 @@ private void load(FrameworkConfigManager frameworkConfig)
|
||||||
Task.Run(() => BeatmapDatabase.Import(paths.ToArray()));
|
Task.Run(() => BeatmapDatabase.Import(paths.ToArray()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Dependencies.Cache(this);
|
dependencies.Cache(this);
|
||||||
|
|
||||||
configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset);
|
configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset);
|
||||||
Ruleset.Value = RulesetDatabase.GetRuleset(configRuleset.Value);
|
Ruleset.Value = RulesetDatabase.GetRuleset(configRuleset.Value);
|
||||||
|
@ -206,13 +211,13 @@ protected override void LoadComplete()
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Dependencies.Cache(settings);
|
dependencies.Cache(settings);
|
||||||
Dependencies.Cache(social);
|
dependencies.Cache(social);
|
||||||
Dependencies.Cache(chat);
|
dependencies.Cache(chat);
|
||||||
Dependencies.Cache(userProfile);
|
dependencies.Cache(userProfile);
|
||||||
Dependencies.Cache(musicController);
|
dependencies.Cache(musicController);
|
||||||
Dependencies.Cache(notificationManager);
|
dependencies.Cache(notificationManager);
|
||||||
Dependencies.Cache(dialogOverlay);
|
dependencies.Cache(dialogOverlay);
|
||||||
|
|
||||||
// ensure both overlays aren't presented at the same time
|
// ensure both overlays aren't presented at the same time
|
||||||
chat.StateChanged += (container, state) => social.State = state == Visibility.Visible ? Visibility.Hidden : social.State;
|
chat.StateChanged += (container, state) => social.State = state == Visibility.Visible ? Visibility.Hidden : social.State;
|
||||||
|
|
|
@ -81,21 +81,26 @@ public OsuGameBase()
|
||||||
Name = @"osu!lazer";
|
Name = @"osu!lazer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DependencyContainer dependencies;
|
||||||
|
|
||||||
|
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) =>
|
||||||
|
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Dependencies.Cache(this);
|
dependencies.Cache(this);
|
||||||
Dependencies.Cache(LocalConfig);
|
dependencies.Cache(LocalConfig);
|
||||||
|
|
||||||
SQLiteConnection connection = Host.Storage.GetDatabase(@"client");
|
SQLiteConnection connection = Host.Storage.GetDatabase(@"client");
|
||||||
|
|
||||||
Dependencies.Cache(RulesetDatabase = new RulesetDatabase(Host.Storage, connection));
|
dependencies.Cache(RulesetDatabase = new RulesetDatabase(Host.Storage, connection));
|
||||||
Dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(Host.Storage, connection, RulesetDatabase, Host));
|
dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(Host.Storage, connection, RulesetDatabase, Host));
|
||||||
Dependencies.Cache(ScoreDatabase = new ScoreDatabase(Host.Storage, connection, Host, BeatmapDatabase));
|
dependencies.Cache(ScoreDatabase = new ScoreDatabase(Host.Storage, connection, Host, BeatmapDatabase));
|
||||||
Dependencies.Cache(new OsuColour());
|
dependencies.Cache(new OsuColour());
|
||||||
|
|
||||||
//this completely overrides the framework default. will need to change once we make a proper FontStore.
|
//this completely overrides the framework default. will need to change once we make a proper FontStore.
|
||||||
Dependencies.Cache(Fonts = new FontStore { ScaleAdjust = 100 }, true);
|
dependencies.Cache(Fonts = new FontStore { ScaleAdjust = 100 }, true);
|
||||||
|
|
||||||
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome"));
|
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome"));
|
||||||
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/osuFont"));
|
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/osuFont"));
|
||||||
|
@ -127,7 +132,7 @@ private void load()
|
||||||
|
|
||||||
OszArchiveReader.Register();
|
OszArchiveReader.Register();
|
||||||
|
|
||||||
Dependencies.Cache(API = new APIAccess
|
dependencies.Cache(API = new APIAccess
|
||||||
{
|
{
|
||||||
Username = LocalConfig.Get<string>(OsuSetting.Username),
|
Username = LocalConfig.Get<string>(OsuSetting.Username),
|
||||||
Token = LocalConfig.Get<string>(OsuSetting.Token)
|
Token = LocalConfig.Get<string>(OsuSetting.Token)
|
||||||
|
|
|
@ -47,10 +47,13 @@ public class Drawings : OsuScreen
|
||||||
|
|
||||||
public ITeamList TeamList;
|
public ITeamList TeamList;
|
||||||
|
|
||||||
protected override DependencyContainer CreateLocalDependencies(DependencyContainer parent) => new DependencyContainer(parent);
|
private DependencyContainer dependencies;
|
||||||
|
|
||||||
|
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) =>
|
||||||
|
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(TextureStore textures, Storage storage, DependencyContainer dependencies)
|
private void load(TextureStore textures, Storage storage)
|
||||||
{
|
{
|
||||||
this.storage = storage;
|
this.storage = storage;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue