1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-08 17:03:58 +08:00

Convert everything to DI pattern

This commit is contained in:
Drew DeVault
2016-11-08 18:13:20 -05:00
Unverified
parent dc03f36793
commit ee24cd310c
44 changed files with 233 additions and 224 deletions
@@ -4,9 +4,11 @@
using OpenTK;
using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
namespace osu.Game.Graphics.UserInterface
{
@@ -59,20 +61,20 @@ namespace osu.Game.Graphics.UserInterface
Name = name;
}
protected override void Load(BaseGame game)
[Initializer]
private void Load(TextureStore textures)
{
base.Load(game);
Children = new Drawable[]
{
buttonSprite = new Sprite
{
Texture = game.Textures.Get(@"KeyCounter/key-up"),
Texture = textures.Get(@"KeyCounter/key-up"),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
glowSprite = new Sprite
{
Texture = game.Textures.Get(@"KeyCounter/key-glow"),
Texture = textures.Get(@"KeyCounter/key-glow"),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Alpha = 0
@@ -12,6 +12,7 @@ using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework.Allocation;
namespace osu.Game.Graphics.UserInterface
{
@@ -119,15 +120,14 @@ namespace osu.Game.Graphics.UserInterface
AutoSizeAxes = Axes.Both;
}
protected override void Load(BaseGame game)
[Initializer]
private void Load()
{
base.Load(game);
DisplayedCount = Count;
DisplayedCountSpriteText.Text = FormatCount(count);
DisplayedCountSpriteText.Anchor = this.Anchor;
DisplayedCountSpriteText.Origin = this.Origin;
DisplayedCountSpriteText.Anchor = Anchor;
DisplayedCountSpriteText.Origin = Origin;
}
protected override void LoadComplete()
@@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework.Allocation;
namespace osu.Game.Graphics.UserInterface
{
@@ -109,10 +110,9 @@ namespace osu.Game.Graphics.UserInterface
};
}
protected override void Load(BaseGame game)
[Initializer]
private void Load()
{
base.Load(game);
starContainer.Width = MaxStars * StarSize + Math.Max(MaxStars - 1, 0) * StarSpacing;
starContainer.Height = StarSize;
@@ -6,6 +6,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Threading;
using OpenTK;
using osu.Framework.Allocation;
namespace osu.Game.Graphics.UserInterface.Volume
{
@@ -32,7 +33,8 @@ namespace osu.Game.Graphics.UserInterface.Volume
Origin = Anchor.BottomRight;
}
protected override void Load(BaseGame game)
[Initializer]
private void Load()
{
VolumeGlobal.ValueChanged += volumeChanged;
VolumeSample.ValueChanged += volumeChanged;
@@ -55,8 +57,6 @@ namespace osu.Game.Graphics.UserInterface.Volume
}
}
};
base.Load(game);
}
protected override void Dispose(bool isDisposing)