Convert everything to DI pattern

This commit is contained in:
Drew DeVault
2016-11-08 18:13:20 -05:00
parent dc03f36793
commit ee24cd310c
44 changed files with 233 additions and 224 deletions

View File

@ -16,6 +16,7 @@ using osu.Game.Online.API.Requests;
using osu.Game.Online.Chat;
using osu.Game.Online.Chat.Display;
using OpenTK;
using osu.Framework.Allocation;
namespace osu.Desktop.VisualTests.Tests
{
@ -34,11 +35,10 @@ namespace osu.Desktop.VisualTests.Tests
private ChannelDisplay channelDisplay;
protected override void Load(BaseGame game)
[Initializer]
private void Load(APIAccess api)
{
base.Load(game);
api = ((OsuGameBase)game).API;
this.api = api;
}
public override void Reset()

View File

@ -9,6 +9,7 @@ using osu.Game.Beatmaps.Objects;
using osu.Game.Beatmaps.Objects.Osu;
using osu.Game.Beatmaps.Objects.Osu.Drawable;
using OpenTK;
using osu.Framework.Allocation;
namespace osu.Desktop.VisualTests.Tests
{
@ -20,10 +21,9 @@ namespace osu.Desktop.VisualTests.Tests
protected override IFrameBasedClock Clock => ourClock;
protected override void Load(BaseGame game)
[Initializer]
private void Load()
{
base.Load(game);
var swClock = new StopwatchClock(true) { Rate = 1 };
ourClock = new FramedClock(swClock);
}

View File

@ -12,6 +12,7 @@ using osu.Game.Beatmaps.Objects.Osu;
using osu.Game.GameModes.Play;
using OpenTK;
using osu.Framework;
using osu.Framework.Allocation;
namespace osu.Desktop.VisualTests.Tests
{
@ -25,12 +26,10 @@ namespace osu.Desktop.VisualTests.Tests
protected override IFrameBasedClock Clock => localClock;
private BaseGame game;
protected override void Load(BaseGame game)
[Initializer]
private void Load()
{
base.Load(game);
this.game = game;
// TODO: Do we even need this here?
}
public override void Reset()
@ -64,9 +63,10 @@ namespace osu.Desktop.VisualTests.Tests
decoder.Process(b);
var player = game.Dependencies.Get<Player>();
player.Beatmap = new WorkingBeatmap(b);
Add(player);
Add(new Player
{
Beatmap = new WorkingBeatmap(b)
});
}
protected override void Update()