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

@ -13,7 +13,8 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Game.Database;
using OpenTK;
using osu.Framework.Allocation;
namespace osu.Game.Beatmaps.Drawable
{
class BeatmapGroup : Container, IStateful<BeatmapGroupState>
@ -99,10 +100,9 @@ namespace osu.Game.Beatmaps.Drawable
};
}
protected override void Load(BaseGame game)
[Initializer]
private void Load(BaseGame game)
{
base.Load(game);
BeatmapPanels = beatmapSet.Beatmaps.Select(b => new BeatmapPanel(b)
{
GainedSelection = panelGainedSelection,

View File

@ -11,6 +11,8 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using OpenTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Textures;
namespace osu.Game.Beatmaps.Objects.Catch.Drawable
{
@ -28,11 +30,10 @@ namespace osu.Game.Beatmaps.Objects.Catch.Drawable
Position = new Vector2(h.Position, -0.1f);
}
protected override void Load(BaseGame game)
[Initializer]
private void Load(TextureStore textures)
{
base.Load(game);
Texture = game.Textures.Get(@"Menu/logo");
Texture = textures.Get(@"Menu/logo");
Transforms.Add(new TransformPosition { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = new Vector2(h.Position, -0.1f), EndValue = new Vector2(h.Position, 0.9f) });
Transforms.Add(new TransformAlpha { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });

View File

@ -6,6 +6,8 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using OpenTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Textures;
namespace osu.Game.Beatmaps.Objects.Mania.Drawable
{
@ -20,10 +22,10 @@ namespace osu.Game.Beatmaps.Objects.Mania.Drawable
Scale = new Vector2(0.1f);
}
protected override void Load(BaseGame game)
[Initializer]
private void Load(TextureStore textures)
{
base.Load(game);
Texture = game.Textures.Get(@"Menu/logo");
Texture = textures.Get(@"Menu/logo");
Transforms.Add(new TransformPositionY() { StartTime = note.StartTime - 200, EndTime = note.StartTime, StartValue = -0.1f, EndValue = 0.9f });
Transforms.Add(new TransformAlpha() { StartTime = note.StartTime + note.Duration + 200, EndTime = note.StartTime + note.Duration + 400, StartValue = 1, EndValue = 0 });

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics.Transformations;
using osu.Framework.Input;
using osu.Framework.MathUtils;
using OpenTK;
using osu.Framework.Allocation;
namespace osu.Game.Beatmaps.Objects.Osu.Drawable
{
@ -63,10 +64,9 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
Size = circle.DrawSize;
}
protected override void Load(BaseGame game)
[Initializer]
private void Load(BaseGame game)
{
base.Load(game);
approachCircle.Texture = game.Textures.Get(@"Play/osu/approachcircle@2x");
}
@ -149,10 +149,10 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
};
}
protected override void Load(BaseGame game)
[Initializer]
private void Load(TextureStore textures)
{
base.Load(game);
number.Texture = game.Textures.Get(@"Play/osu/number@2x");
number.Texture = textures.Get(@"Play/osu/number@2x");
}
}
@ -177,10 +177,10 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
};
}
protected override void Load(BaseGame game)
[Initializer]
private void Load(TextureStore textures)
{
base.Load(game);
layer.Texture = game.Textures.Get(@"Play/osu/ring-glow@2x");
layer.Texture = textures.Get(@"Play/osu/ring-glow@2x");
}
}
@ -203,10 +203,10 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
};
}
protected override void Load(BaseGame game)
[Initializer]
private void Load(TextureStore textures)
{
base.Load(game);
ring.Texture = game.Textures.Get(@"Play/osu/ring@2x");
ring.Texture = textures.Get(@"Play/osu/ring@2x");
}
}
@ -289,10 +289,10 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
};
}
protected override void Load(BaseGame game)
[Initializer]
private void Load(TextureStore textures)
{
base.Load(game);
disc.Texture = game.Textures.Get(@"Play/osu/disc@2x");
disc.Texture = textures.Get(@"Play/osu/disc@2x");
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
@ -306,11 +306,10 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
{
private Texture tex;
protected override void Load(BaseGame game)
[Initializer]
private void Load(TextureStore textures)
{
base.Load(game);
tex = game.Textures.Get(@"Play/osu/triangle@2x");
tex = textures.Get(@"Play/osu/triangle@2x");
for (int i = 0; i < 10; i++)
{

View File

@ -6,6 +6,8 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using OpenTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Textures;
namespace osu.Game.Beatmaps.Objects.Taiko.Drawable
{
@ -23,11 +25,10 @@ namespace osu.Game.Beatmaps.Objects.Taiko.Drawable
Position = new Vector2(1.1f, 0.5f);
}
protected override void Load(BaseGame game)
[Initializer]
private void Load(TextureStore textures)
{
base.Load(game);
Texture = game.Textures.Get(@"Menu/logo");
Texture = textures.Get(@"Menu/logo");
Transforms.Add(new TransformPositionX { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = 1.1f, EndValue = 0.1f });
Transforms.Add(new TransformAlpha { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });