mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Convert everything to DI pattern
This commit is contained in:
@ -10,6 +10,8 @@ using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Graphics.Background
|
||||
{
|
||||
@ -26,13 +28,12 @@ namespace osu.Game.Graphics.Background
|
||||
Depth = float.MinValue;
|
||||
}
|
||||
|
||||
protected override void Load(BaseGame game)
|
||||
[Initializer]
|
||||
private void Load(TextureStore textures)
|
||||
{
|
||||
base.Load(game);
|
||||
|
||||
Add(BackgroundSprite = new Sprite
|
||||
{
|
||||
Texture = game.Textures.Get(textureName),
|
||||
Texture = textures.Get(textureName),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Colour = Color4.DarkGray
|
||||
|
@ -3,6 +3,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using OpenTK;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
@ -15,21 +16,21 @@ namespace osu.Game.Graphics.Containers
|
||||
public ParallaxContainer()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
AddInternal(content = new Container()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
});
|
||||
}
|
||||
|
||||
private Container content;
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
protected override void Load(BaseGame game)
|
||||
[Initializer]
|
||||
private void Load()
|
||||
{
|
||||
base.Load(game);
|
||||
AddInternal(content = new Container()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
});
|
||||
}
|
||||
|
||||
protected override bool OnMouseMove(InputState state)
|
||||
|
@ -2,10 +2,12 @@
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Framework.Input;
|
||||
|
||||
@ -37,15 +39,14 @@ namespace osu.Game.Graphics.Cursor
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
protected override void Load(BaseGame game)
|
||||
[Initializer]
|
||||
private void Load(TextureStore textures)
|
||||
{
|
||||
base.Load(game);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Sprite
|
||||
{
|
||||
Texture = game.Textures.Get(@"Cursor/cursor")
|
||||
Texture = textures.Get(@"Cursor/cursor")
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user