mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 22:12:53 +08:00
Convert everything to DI pattern
This commit is contained in:
parent
dc03f36793
commit
ee24cd310c
@ -16,6 +16,7 @@ using osu.Game.Online.API.Requests;
|
|||||||
using osu.Game.Online.Chat;
|
using osu.Game.Online.Chat;
|
||||||
using osu.Game.Online.Chat.Display;
|
using osu.Game.Online.Chat.Display;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
{
|
{
|
||||||
@ -34,11 +35,10 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
private ChannelDisplay channelDisplay;
|
private ChannelDisplay channelDisplay;
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load(APIAccess api)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
this.api = api;
|
||||||
|
|
||||||
api = ((OsuGameBase)game).API;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
|
@ -9,6 +9,7 @@ using osu.Game.Beatmaps.Objects;
|
|||||||
using osu.Game.Beatmaps.Objects.Osu;
|
using osu.Game.Beatmaps.Objects.Osu;
|
||||||
using osu.Game.Beatmaps.Objects.Osu.Drawable;
|
using osu.Game.Beatmaps.Objects.Osu.Drawable;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
{
|
{
|
||||||
@ -20,10 +21,9 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
protected override IFrameBasedClock Clock => ourClock;
|
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 };
|
var swClock = new StopwatchClock(true) { Rate = 1 };
|
||||||
ourClock = new FramedClock(swClock);
|
ourClock = new FramedClock(swClock);
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ using osu.Game.Beatmaps.Objects.Osu;
|
|||||||
using osu.Game.GameModes.Play;
|
using osu.Game.GameModes.Play;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
{
|
{
|
||||||
@ -25,12 +26,10 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
protected override IFrameBasedClock Clock => localClock;
|
protected override IFrameBasedClock Clock => localClock;
|
||||||
|
|
||||||
private BaseGame game;
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
protected override void Load(BaseGame game)
|
|
||||||
{
|
{
|
||||||
base.Load(game);
|
// TODO: Do we even need this here?
|
||||||
this.game = game;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
@ -64,9 +63,10 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
decoder.Process(b);
|
decoder.Process(b);
|
||||||
|
|
||||||
var player = game.Dependencies.Get<Player>();
|
Add(new Player
|
||||||
player.Beatmap = new WorkingBeatmap(b);
|
{
|
||||||
Add(player);
|
Beatmap = new WorkingBeatmap(b)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
@ -13,14 +13,15 @@ using System.Collections.Generic;
|
|||||||
using osu.Game.GameModes.Play;
|
using osu.Game.GameModes.Play;
|
||||||
using SQLiteNetExtensions.Extensions;
|
using SQLiteNetExtensions.Extensions;
|
||||||
using osu.Desktop.Platform;
|
using osu.Desktop.Platform;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests
|
namespace osu.Desktop.VisualTests
|
||||||
{
|
{
|
||||||
class VisualTestGame : OsuGameBase
|
class VisualTestGame : OsuGameBase
|
||||||
{
|
{
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
Add(new TestBrowser());
|
Add(new TestBrowser());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,8 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Drawable
|
namespace osu.Game.Beatmaps.Drawable
|
||||||
{
|
{
|
||||||
class BeatmapGroup : Container, IStateful<BeatmapGroupState>
|
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)
|
BeatmapPanels = beatmapSet.Beatmaps.Select(b => new BeatmapPanel(b)
|
||||||
{
|
{
|
||||||
GainedSelection = panelGainedSelection,
|
GainedSelection = panelGainedSelection,
|
||||||
|
@ -11,6 +11,8 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Transformations;
|
using osu.Framework.Graphics.Transformations;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Objects.Catch.Drawable
|
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);
|
Position = new Vector2(h.Position, -0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load(TextureStore textures)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
Texture = textures.Get(@"Menu/logo");
|
||||||
|
|
||||||
Texture = game.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 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 });
|
Transforms.Add(new TransformAlpha { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
|
||||||
|
@ -6,6 +6,8 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Transformations;
|
using osu.Framework.Graphics.Transformations;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Objects.Mania.Drawable
|
namespace osu.Game.Beatmaps.Objects.Mania.Drawable
|
||||||
{
|
{
|
||||||
@ -20,10 +22,10 @@ namespace osu.Game.Beatmaps.Objects.Mania.Drawable
|
|||||||
Scale = new Vector2(0.1f);
|
Scale = new Vector2(0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load(TextureStore textures)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
Texture = textures.Get(@"Menu/logo");
|
||||||
Texture = game.Textures.Get(@"Menu/logo");
|
|
||||||
|
|
||||||
Transforms.Add(new TransformPositionY() { StartTime = note.StartTime - 200, EndTime = note.StartTime, StartValue = -0.1f, EndValue = 0.9f });
|
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 });
|
Transforms.Add(new TransformAlpha() { StartTime = note.StartTime + note.Duration + 200, EndTime = note.StartTime + note.Duration + 400, StartValue = 1, EndValue = 0 });
|
||||||
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Transformations;
|
|||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
||||||
{
|
{
|
||||||
@ -63,10 +64,9 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
|||||||
Size = circle.DrawSize;
|
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");
|
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 = textures.Get(@"Play/osu/number@2x");
|
||||||
number.Texture = game.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 = textures.Get(@"Play/osu/ring-glow@2x");
|
||||||
layer.Texture = game.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 = textures.Get(@"Play/osu/ring@2x");
|
||||||
ring.Texture = game.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 = textures.Get(@"Play/osu/disc@2x");
|
||||||
disc.Texture = game.Textures.Get(@"Play/osu/disc@2x");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||||
@ -306,11 +306,10 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
|||||||
{
|
{
|
||||||
private Texture tex;
|
private Texture tex;
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load(TextureStore textures)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
tex = textures.Get(@"Play/osu/triangle@2x");
|
||||||
|
|
||||||
tex = game.Textures.Get(@"Play/osu/triangle@2x");
|
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,8 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Transformations;
|
using osu.Framework.Graphics.Transformations;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Objects.Taiko.Drawable
|
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);
|
Position = new Vector2(1.1f, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load(TextureStore textures)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
Texture = textures.Get(@"Menu/logo");
|
||||||
|
|
||||||
Texture = game.Textures.Get(@"Menu/logo");
|
|
||||||
|
|
||||||
Transforms.Add(new TransformPositionX { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = 1.1f, EndValue = 0.1f });
|
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 });
|
Transforms.Add(new TransformAlpha { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
|
||||||
|
@ -13,6 +13,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.GameModes
|
namespace osu.Game.GameModes
|
||||||
{
|
{
|
||||||
@ -34,9 +35,9 @@ namespace osu.Game.GameModes
|
|||||||
|
|
||||||
BaseGame game;
|
BaseGame game;
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
this.game = game;
|
this.game = game;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Graphics.Background;
|
using osu.Game.Graphics.Background;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Backgrounds
|
namespace osu.Game.GameModes.Backgrounds
|
||||||
@ -15,9 +16,9 @@ namespace osu.Game.GameModes.Backgrounds
|
|||||||
this.textureName = textureName;
|
this.textureName = textureName;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
Add(new Background(textureName));
|
Add(new Background(textureName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,16 +2,16 @@
|
|||||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Graphics.Background;
|
using osu.Game.Graphics.Background;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Backgrounds
|
namespace osu.Game.GameModes.Backgrounds
|
||||||
{
|
{
|
||||||
public class BackgroundModeDefault : BackgroundMode
|
public class BackgroundModeDefault : BackgroundMode
|
||||||
{
|
{
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
|
|
||||||
Add(new Background());
|
Add(new Background());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ using osu.Game.GameModes.Backgrounds;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.GameModes
|
namespace osu.Game.GameModes
|
||||||
{
|
{
|
||||||
@ -77,10 +78,9 @@ namespace osu.Game.GameModes
|
|||||||
Content.FadeIn(transition_time, EasingTypes.OutExpo);
|
Content.FadeIn(transition_time, EasingTypes.OutExpo);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
box = new Box
|
box = new Box
|
||||||
|
@ -10,6 +10,7 @@ using osu.Framework.Graphics.Transformations;
|
|||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Menu
|
namespace osu.Game.GameModes.Menu
|
||||||
{
|
{
|
||||||
@ -48,9 +49,9 @@ namespace osu.Game.GameModes.Menu
|
|||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
Alpha = 0;
|
Alpha = 0;
|
||||||
|
|
||||||
Vector2 boxSize = new Vector2(ButtonSystem.button_width + Math.Abs(extraWidth), ButtonSystem.button_area_height);
|
Vector2 boxSize = new Vector2(ButtonSystem.button_width + Math.Abs(extraWidth), ButtonSystem.button_area_height);
|
||||||
|
@ -14,6 +14,7 @@ using OpenTK;
|
|||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Menu
|
namespace osu.Game.GameModes.Menu
|
||||||
{
|
{
|
||||||
@ -53,10 +54,9 @@ namespace osu.Game.GameModes.Menu
|
|||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
buttonArea = new Container
|
buttonArea = new Container
|
||||||
|
@ -10,6 +10,8 @@ using osu.Framework.Graphics.Transformations;
|
|||||||
using osu.Game.GameModes.Backgrounds;
|
using osu.Game.GameModes.Backgrounds;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Menu
|
namespace osu.Game.GameModes.Menu
|
||||||
{
|
{
|
||||||
@ -43,13 +45,12 @@ namespace osu.Game.GameModes.Menu
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load(AudioManager audio)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
welcome = audio.Sample.Get(@"welcome");
|
||||||
|
|
||||||
welcome = game.Audio.Sample.Get(@"welcome");
|
bgm = audio.Track.Get(@"circles");
|
||||||
|
|
||||||
bgm = game.Audio.Track.Get(@"circles");
|
|
||||||
bgm.Looping = true;
|
bgm.Looping = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@ using OpenTK;
|
|||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Menu
|
namespace osu.Game.GameModes.Menu
|
||||||
{
|
{
|
||||||
@ -55,14 +57,11 @@ namespace osu.Game.GameModes.Menu
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load(BaseGame game, OptionsOverlay options)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
|
|
||||||
background.Preload(game);
|
background.Preload(game);
|
||||||
|
buttons.OnSettings = options.ToggleVisibility;
|
||||||
OsuGame osu = (OsuGame)game;
|
|
||||||
buttons.OnSettings = osu.Options.ToggleVisibility;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
@ -9,6 +9,8 @@ using osu.Framework.Graphics.Transformations;
|
|||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Menu
|
namespace osu.Game.GameModes.Menu
|
||||||
{
|
{
|
||||||
@ -101,11 +103,11 @@ namespace osu.Game.GameModes.Menu
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load(TextureStore textures)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
logo.Texture = textures.Get(@"Menu/logo");
|
||||||
logo.Texture = game.Textures.Get(@"Menu/logo");
|
ripple.Texture = textures.Get(@"Menu/logo");
|
||||||
ripple.Texture = game.Textures.Get(@"Menu/logo");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play.Catch
|
namespace osu.Game.GameModes.Play.Catch
|
||||||
{
|
{
|
||||||
@ -20,10 +21,9 @@ namespace osu.Game.GameModes.Play.Catch
|
|||||||
Origin = Anchor.BottomCentre;
|
Origin = Anchor.BottomCentre;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
|
|
||||||
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ using System.Diagnostics;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
@ -120,13 +121,12 @@ namespace osu.Game.GameModes.Play
|
|||||||
TextSize = 80;
|
TextSize = 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
|
|
||||||
DisplayedCountSpriteText.Text = FormatCount(Count);
|
DisplayedCountSpriteText.Text = FormatCount(Count);
|
||||||
DisplayedCountSpriteText.Anchor = this.Anchor;
|
DisplayedCountSpriteText.Anchor = Anchor;
|
||||||
DisplayedCountSpriteText.Origin = this.Origin;
|
DisplayedCountSpriteText.Origin = Origin;
|
||||||
|
|
||||||
StopRolling();
|
StopRolling();
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ using osu.Game.Beatmaps.Objects;
|
|||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
@ -42,10 +43,9 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
protected virtual List<T> Convert(List<HitObject> objects) => Converter.Convert(objects);
|
protected virtual List<T> Convert(List<HitObject> objects) => Converter.Convert(objects);
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play.Mania
|
namespace osu.Game.GameModes.Play.Mania
|
||||||
{
|
{
|
||||||
@ -23,11 +24,10 @@ namespace osu.Game.GameModes.Play.Mania
|
|||||||
Origin = Anchor.BottomCentre;
|
Origin = Anchor.BottomCentre;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
base.Load(game);
|
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
||||||
|
|
||||||
Add(new Box() { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
|
||||||
|
|
||||||
for (int i = 0; i < columns; i++)
|
for (int i = 0; i < columns; i++)
|
||||||
Add(new Box()
|
Add(new Box()
|
||||||
|
@ -8,6 +8,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play.Osu
|
namespace osu.Game.GameModes.Play.Osu
|
||||||
{
|
{
|
||||||
@ -33,12 +34,11 @@ namespace osu.Game.GameModes.Play.Osu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
base.Load(game);
|
PopOutSpriteText.Origin = Origin;
|
||||||
|
PopOutSpriteText.Anchor = Anchor;
|
||||||
PopOutSpriteText.Origin = this.Origin;
|
|
||||||
PopOutSpriteText.Anchor = this.Anchor;
|
|
||||||
|
|
||||||
Add(PopOutSpriteText);
|
Add(PopOutSpriteText);
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,8 @@ using osu.Game.Beatmaps.Drawable;
|
|||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Framework.GameModes;
|
using osu.Framework.GameModes;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
@ -126,11 +128,11 @@ namespace osu.Game.GameModes.Play
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
// TODO: Load(..., [PermitNull] OsuGame osuGame) or some such
|
||||||
|
var osuGame = game as OsuGame;
|
||||||
OsuGame osuGame = game as OsuGame;
|
|
||||||
if (osuGame != null)
|
if (osuGame != null)
|
||||||
{
|
{
|
||||||
playMode = osuGame.PlayMode;
|
playMode = osuGame.PlayMode;
|
||||||
@ -140,11 +142,11 @@ namespace osu.Game.GameModes.Play
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (database == null)
|
if (database == null)
|
||||||
database = game.Dependencies.Get<BeatmapDatabase>();
|
database = beatmaps;
|
||||||
|
|
||||||
database.BeatmapSetAdded += s => Schedule(() => addBeatmapSet(s));
|
database.BeatmapSetAdded += s => Schedule(() => addBeatmapSet(s));
|
||||||
|
|
||||||
trackManager = game.Audio.Track;
|
trackManager = audio.Track;
|
||||||
|
|
||||||
Task.Factory.StartNew(addBeatmapSets);
|
Task.Factory.StartNew(addBeatmapSets);
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,8 @@ using osu.Game.Database;
|
|||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
@ -30,17 +32,10 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
private InterpolatingFramedClock playerClock;
|
private InterpolatingFramedClock playerClock;
|
||||||
private IAdjustableClock sourceClock;
|
private IAdjustableClock sourceClock;
|
||||||
private BeatmapDatabase beatmaps;
|
|
||||||
|
|
||||||
public Player(BeatmapDatabase beatmaps)
|
|
||||||
{
|
|
||||||
this.beatmaps = beatmaps;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load(AudioManager audio, BeatmapDatabase beatmaps)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Beatmap == null)
|
if (Beatmap == null)
|
||||||
@ -57,7 +52,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
if (track != null)
|
if (track != null)
|
||||||
{
|
{
|
||||||
game.Audio.Track.SetExclusive(track);
|
audio.Track.SetExclusive(track);
|
||||||
sourceClock = track;
|
sourceClock = track;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play.Taiko
|
namespace osu.Game.GameModes.Play.Taiko
|
||||||
{
|
{
|
||||||
@ -20,15 +22,14 @@ namespace osu.Game.GameModes.Play.Taiko
|
|||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load(TextureStore textures)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
|
|
||||||
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
||||||
|
|
||||||
Add(new Sprite
|
Add(new Sprite
|
||||||
{
|
{
|
||||||
Texture = game.Textures.Get(@"Menu/logo"),
|
Texture = textures.Get(@"Menu/logo"),
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Scale = new Vector2(0.2f),
|
Scale = new Vector2(0.2f),
|
||||||
RelativePositionAxes = Axes.Both,
|
RelativePositionAxes = Axes.Both,
|
||||||
|
@ -10,6 +10,8 @@ using OpenTK.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Background
|
namespace osu.Game.Graphics.Background
|
||||||
{
|
{
|
||||||
@ -26,13 +28,12 @@ namespace osu.Game.Graphics.Background
|
|||||||
Depth = float.MinValue;
|
Depth = float.MinValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load(TextureStore textures)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
|
|
||||||
Add(BackgroundSprite = new Sprite
|
Add(BackgroundSprite = new Sprite
|
||||||
{
|
{
|
||||||
Texture = game.Textures.Get(textureName),
|
Texture = textures.Get(textureName),
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Colour = Color4.DarkGray
|
Colour = Color4.DarkGray
|
||||||
|
@ -3,6 +3,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Containers
|
namespace osu.Game.Graphics.Containers
|
||||||
{
|
{
|
||||||
@ -15,21 +16,21 @@ namespace osu.Game.Graphics.Containers
|
|||||||
public ParallaxContainer()
|
public ParallaxContainer()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
AddInternal(content = new Container()
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Container content;
|
private Container content;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => 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)
|
protected override bool OnMouseMove(InputState state)
|
||||||
|
@ -2,10 +2,12 @@
|
|||||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Graphics.Transformations;
|
using osu.Framework.Graphics.Transformations;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
|
||||||
@ -37,15 +39,14 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load(TextureStore textures)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Sprite
|
new Sprite
|
||||||
{
|
{
|
||||||
Texture = game.Textures.Get(@"Cursor/cursor")
|
Texture = textures.Get(@"Cursor/cursor")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -59,20 +61,20 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Name = name;
|
Name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load(TextureStore textures)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
buttonSprite = new Sprite
|
buttonSprite = new Sprite
|
||||||
{
|
{
|
||||||
Texture = game.Textures.Get(@"KeyCounter/key-up"),
|
Texture = textures.Get(@"KeyCounter/key-up"),
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
},
|
},
|
||||||
glowSprite = new Sprite
|
glowSprite = new Sprite
|
||||||
{
|
{
|
||||||
Texture = game.Textures.Get(@"KeyCounter/key-glow"),
|
Texture = textures.Get(@"KeyCounter/key-glow"),
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Alpha = 0
|
Alpha = 0
|
||||||
|
@ -12,6 +12,7 @@ using System.Diagnostics;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -119,15 +120,14 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
|
|
||||||
DisplayedCount = Count;
|
DisplayedCount = Count;
|
||||||
|
|
||||||
DisplayedCountSpriteText.Text = FormatCount(count);
|
DisplayedCountSpriteText.Text = FormatCount(count);
|
||||||
DisplayedCountSpriteText.Anchor = this.Anchor;
|
DisplayedCountSpriteText.Anchor = Anchor;
|
||||||
DisplayedCountSpriteText.Origin = this.Origin;
|
DisplayedCountSpriteText.Origin = Origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
@ -12,6 +12,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
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.Width = MaxStars * StarSize + Math.Max(MaxStars - 1, 0) * StarSpacing;
|
||||||
starContainer.Height = StarSize;
|
starContainer.Height = StarSize;
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface.Volume
|
namespace osu.Game.Graphics.UserInterface.Volume
|
||||||
{
|
{
|
||||||
@ -32,7 +33,8 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
|||||||
Origin = Anchor.BottomRight;
|
Origin = Anchor.BottomRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
VolumeGlobal.ValueChanged += volumeChanged;
|
VolumeGlobal.ValueChanged += volumeChanged;
|
||||||
VolumeSample.ValueChanged += volumeChanged;
|
VolumeSample.ValueChanged += volumeChanged;
|
||||||
@ -55,8 +57,6 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
base.Load(game);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Transformations;
|
|||||||
using osu.Game.Online.Chat.Display.osu.Online.Social;
|
using osu.Game.Online.Chat.Display.osu.Online.Social;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Online.Chat.Display
|
namespace osu.Game.Online.Chat.Display
|
||||||
{
|
{
|
||||||
@ -59,9 +60,9 @@ namespace osu.Game.Online.Chat.Display
|
|||||||
channel.NewMessagesArrived -= newMessages;
|
channel.NewMessagesArrived -= newMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
newMessages(channel.Messages);
|
newMessages(channel.Messages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ using OpenTK;
|
|||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Online.Chat.Display
|
namespace osu.Game.Online.Chat.Display
|
||||||
{
|
{
|
||||||
@ -27,10 +28,9 @@ namespace osu.Game.Online.Chat.Display
|
|||||||
const float padding = 200;
|
const float padding = 200;
|
||||||
const float text_size = 20;
|
const float text_size = 20;
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ using OpenTK.Input;
|
|||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Game.Graphics.UserInterface.Volume;
|
using osu.Game.Graphics.UserInterface.Volume;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game
|
namespace osu.Game
|
||||||
{
|
{
|
||||||
@ -51,7 +52,8 @@ namespace osu.Game
|
|||||||
host.Size = new Vector2(Config.Get<int>(OsuConfig.Width), Config.Get<int>(OsuConfig.Height));
|
host.Size = new Vector2(Config.Get<int>(OsuConfig.Width), Config.Get<int>(OsuConfig.Height));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
if (!Host.IsPrimaryInstance)
|
if (!Host.IsPrimaryInstance)
|
||||||
{
|
{
|
||||||
@ -59,8 +61,6 @@ namespace osu.Game
|
|||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
base.Load(game);
|
|
||||||
|
|
||||||
if (args?.Length > 0)
|
if (args?.Length > 0)
|
||||||
Schedule(delegate { Dependencies.Get<BeatmapDatabase>().Import(args); });
|
Schedule(delegate { Dependencies.Get<BeatmapDatabase>().Import(args); });
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ namespace osu.Game
|
|||||||
(intro = new Intro
|
(intro = new Intro
|
||||||
{
|
{
|
||||||
Beatmap = Beatmap
|
Beatmap = Beatmap
|
||||||
}).Preload(game, d =>
|
}).Preload(this, d =>
|
||||||
{
|
{
|
||||||
mainContent.Add(d);
|
mainContent.Add(d);
|
||||||
|
|
||||||
@ -107,8 +107,8 @@ namespace osu.Game
|
|||||||
intro.DisplayAsRoot();
|
intro.DisplayAsRoot();
|
||||||
});
|
});
|
||||||
|
|
||||||
(Chat = new ChatConsole(API)).Preload(game, Add);
|
(Chat = new ChatConsole(API)).Preload(this, Add);
|
||||||
(MusicController = new MusicController()).Preload(game, Add);
|
(MusicController = new MusicController()).Preload(this, Add);
|
||||||
|
|
||||||
(Toolbar = new Toolbar
|
(Toolbar = new Toolbar
|
||||||
{
|
{
|
||||||
@ -116,7 +116,7 @@ namespace osu.Game
|
|||||||
OnSettings = Options.ToggleVisibility,
|
OnSettings = Options.ToggleVisibility,
|
||||||
OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; },
|
OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; },
|
||||||
OnMusicController = MusicController.ToggleVisibility
|
OnMusicController = MusicController.ToggleVisibility
|
||||||
}).Preload(game, t =>
|
}).Preload(this, t =>
|
||||||
{
|
{
|
||||||
PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); };
|
PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); };
|
||||||
PlayMode.TriggerChange();
|
PlayMode.TriggerChange();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.GameModes;
|
using osu.Framework.GameModes;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -52,10 +53,9 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
|
|
||||||
Dependencies.Cache(this);
|
Dependencies.Cache(this);
|
||||||
Dependencies.Cache<OsuConfigManager>();
|
Dependencies.Cache<OsuConfigManager>();
|
||||||
Dependencies.Cache(new BeatmapDatabase(Host.Storage, Host));
|
Dependencies.Cache(new BeatmapDatabase(Host.Storage, Host));
|
||||||
@ -63,7 +63,7 @@ namespace osu.Game
|
|||||||
OszArchiveReader.Register();
|
OszArchiveReader.Register();
|
||||||
|
|
||||||
//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.
|
||||||
Fonts = new TextureStore() { ScaleAdjust = 0.01f };
|
Fonts = new FontStore { ScaleAdjust = 0.01f };
|
||||||
|
|
||||||
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"));
|
||||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
@ -55,9 +56,9 @@ namespace osu.Game.Overlays
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
initializeChannels();
|
initializeChannels();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,34 +1,32 @@
|
|||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.General
|
namespace osu.Game.Overlays.Options.General
|
||||||
{
|
{
|
||||||
public class LanguageOptions : OptionsSubsection
|
public class LanguageOptions : OptionsSubsection
|
||||||
{
|
{
|
||||||
protected override string Header => "Language";
|
protected override string Header => "Language";
|
||||||
private CheckBoxOption showUnicode, altChatFont;
|
|
||||||
|
[Initializer]
|
||||||
public LanguageOptions()
|
private void Load(OsuConfigManager config)
|
||||||
{
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new SpriteText { Text = "TODO: Dropdown" },
|
|
||||||
showUnicode = new CheckBoxOption { LabelText = "Prefer metadata in original language" },
|
|
||||||
altChatFont = new CheckBoxOption { LabelText = "Use alternative font for chat display" },
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
|
||||||
{
|
{
|
||||||
base.Load(game);
|
Children = new Drawable[]
|
||||||
var osuGame = game as OsuGameBase;
|
{
|
||||||
if (osuGame != null)
|
new SpriteText { Text = "TODO: Dropdown" },
|
||||||
{
|
new CheckBoxOption
|
||||||
showUnicode.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.ShowUnicode);
|
{
|
||||||
altChatFont.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.AlternativeChatFont);
|
LabelText = "Prefer metadata in original language",
|
||||||
}
|
Bindable = config.GetBindable<bool>(OsuConfig.ShowUnicode)
|
||||||
|
},
|
||||||
|
new CheckBoxOption
|
||||||
|
{
|
||||||
|
LabelText = "Use alternative font for chat display",
|
||||||
|
Bindable = config.GetBindable<bool>(OsuConfig.AlternativeChatFont)
|
||||||
|
},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
@ -27,15 +28,14 @@ namespace osu.Game.Overlays.Options.General
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer(permitNulls: true)]
|
||||||
|
private void Load(APIAccess api)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
if (api == null)
|
||||||
var osuGame = game as OsuGameBase;
|
|
||||||
if (osuGame == null)
|
|
||||||
return;
|
return;
|
||||||
loginForm.Children = new Drawable[]
|
loginForm.Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new LoginForm(osuGame.API)
|
new LoginForm(api)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,4 +63,4 @@ namespace osu.Game.Overlays.Options.General
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
@ -8,28 +9,22 @@ namespace osu.Game.Overlays.Options.General
|
|||||||
{
|
{
|
||||||
public class UpdateOptions : OptionsSubsection
|
public class UpdateOptions : OptionsSubsection
|
||||||
{
|
{
|
||||||
private BasicStorage storage;
|
|
||||||
protected override string Header => "Updates";
|
protected override string Header => "Updates";
|
||||||
|
|
||||||
public UpdateOptions()
|
[Initializer]
|
||||||
{
|
private void Load(BasicStorage storage)
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new SpriteText { Text = "TODO: Dropdown" },
|
|
||||||
new SpriteText { Text = "Your osu! is up to date" }, // TODO: map this to reality
|
|
||||||
new OsuButton
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Text = "Open osu! folder",
|
|
||||||
Action = () => storage?.OpenInNativeExplorer(),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
|
||||||
{
|
{
|
||||||
base.Load(game);
|
Children = new Drawable[]
|
||||||
this.storage = game.Host.Storage;
|
{
|
||||||
|
new SpriteText { Text = "TODO: Dropdown" },
|
||||||
|
new SpriteText { Text = "Your osu! is up to date" }, // TODO: map this to reality
|
||||||
|
new OsuButton
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Text = "Open osu! folder",
|
||||||
|
Action = () => storage.OpenInNativeExplorer(),
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ using osu.Game.Configuration;
|
|||||||
using osu.Game.GameModes.Play;
|
using osu.Game.GameModes.Play;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
@ -111,10 +112,10 @@ namespace osu.Game.Overlays
|
|||||||
Size = new Vector2(1, height);
|
Size = new Vector2(1, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
userButton.Text = config.Get<string>(OsuConfig.Username);
|
||||||
userButton.Text = ((OsuGame)game).Config.Get<string>(OsuConfig.Username);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetGameMode(PlayMode mode) => modeSelector.SetGameMode(mode);
|
public void SetGameMode(PlayMode mode) => modeSelector.SetGameMode(mode);
|
||||||
|
@ -6,6 +6,7 @@ using osu.Game.GameModes.Play;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
@ -43,9 +44,9 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
DrawableIcon.TextSize *= 1.4f;
|
DrawableIcon.TextSize *= 1.4f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ using OpenTK.Graphics;
|
|||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Caching;
|
using osu.Framework.Caching;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
@ -30,10 +31,9 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.Y;
|
RelativeSizeAxes = Axes.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
[Initializer]
|
||||||
|
private void Load()
|
||||||
{
|
{
|
||||||
base.Load(game);
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
|
Loading…
Reference in New Issue
Block a user