1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 00:52:59 +08:00

Merge remote-tracking branch 'refs/remotes/upstream/master' into options-sidebar-tracking

# Conflicts:
#	osu.Game/osu.Game.csproj
This commit is contained in:
Dean Herbert 2016-11-12 22:30:15 +09:00
commit 75be78752b
79 changed files with 1156 additions and 806 deletions

2
.vscode/launch.json vendored
View File

@ -5,7 +5,7 @@
"name": "Launch", "name": "Launch",
"type": "mono", "type": "mono",
"request": "launch", "request": "launch",
"program": "${workspaceRoot}/osu.Desktop/bin/Debug/osu!.exe", "program": "${workspaceRoot}/osu.Desktop.VisualTests/bin/Debug/osu!.exe",
"args": [], "args": [],
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"preLaunchTask": "", "preLaunchTask": "",

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
// Place your settings in this file to overwrite default and user settings.
{
}

@ -1 +1 @@
Subproject commit 244eaf768e744fbd05187b30494f3985e7305a58 Subproject commit 5c0e4edbbcdc26ab56c70676856477cd21e7afdc

View File

@ -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) [BackgroundDependencyLoader]
private void load(APIAccess api)
{ {
base.Load(game); this.api = api;
api = ((OsuGameBase)game).API;
} }
public override void Reset() 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;
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) [BackgroundDependencyLoader]
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);
} }

View File

@ -6,6 +6,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;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.GameModes.Testing; using osu.Framework.GameModes.Testing;
using osu.Game.Overlays; using osu.Game.Overlays;
@ -24,9 +25,9 @@ namespace osu.Desktop.Tests
protected MusicController mc; protected MusicController mc;
protected override void Load(BaseGame game) [BackgroundDependencyLoader]
private void load()
{ {
base.Load(game);
ourClock = new FramedClock(); ourClock = new FramedClock();
} }

View File

@ -11,6 +11,8 @@ using osu.Game.Beatmaps.Objects;
using osu.Game.Beatmaps.Objects.Osu; 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.Allocation;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {

View File

@ -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) [BackgroundDependencyLoader]
private void load()
{ {
base.Load(game);
Add(new TestBrowser()); Add(new TestBrowser());
} }
} }

View File

@ -29,7 +29,7 @@ namespace osu.Game.Tests.Beatmaps.IO
HeadlessGameHost host = new HeadlessGameHost(); HeadlessGameHost host = new HeadlessGameHost();
var osu = loadOsu(host); var osu = loadOsu(host);
osu.Beatmaps.Import(osz_path); osu.Dependencies.Get<BeatmapDatabase>().Import(osz_path);
ensureLoaded(osu); ensureLoaded(osu);
} }
@ -60,7 +60,7 @@ namespace osu.Game.Tests.Beatmaps.IO
Thread.Sleep(1); Thread.Sleep(1);
//reset beatmap database (sqlite and storage backing) //reset beatmap database (sqlite and storage backing)
osu.Beatmaps.Reset(); osu.Dependencies.Get<BeatmapDatabase>().Reset();
return osu; return osu;
} }
@ -71,7 +71,8 @@ namespace osu.Game.Tests.Beatmaps.IO
Action waitAction = () => Action waitAction = () =>
{ {
while ((resultSets = osu.Beatmaps.Query<BeatmapSetInfo>().Where(s => s.BeatmapSetID == 241526)).Count() != 1) while ((resultSets = osu.Dependencies.Get<BeatmapDatabase>()
.Query<BeatmapSetInfo>().Where(s => s.BeatmapSetID == 241526)).Count() != 1)
Thread.Sleep(1); Thread.Sleep(1);
}; };
@ -87,7 +88,8 @@ namespace osu.Game.Tests.Beatmaps.IO
//if we don't re-check here, the set will be inserted but the beatmaps won't be present yet. //if we don't re-check here, the set will be inserted but the beatmaps won't be present yet.
waitAction = () => waitAction = () =>
{ {
while ((resultBeatmaps = osu.Beatmaps.Query<BeatmapInfo>().Where(s => s.BeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12) while ((resultBeatmaps = osu.Dependencies.Get<BeatmapDatabase>()
.Query<BeatmapInfo>().Where(s => s.BeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12)
Thread.Sleep(1); Thread.Sleep(1);
}; };
@ -95,7 +97,7 @@ namespace osu.Game.Tests.Beatmaps.IO
@"Beatmaps did not import to the database"); @"Beatmaps did not import to the database");
//fetch children and check we can load from the post-storage path... //fetch children and check we can load from the post-storage path...
var set = osu.Beatmaps.GetChildren(resultSets.First()); var set = osu.Dependencies.Get<BeatmapDatabase>().GetChildren(resultSets.First());
Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count()); Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count());
@ -104,7 +106,7 @@ namespace osu.Game.Tests.Beatmaps.IO
Assert.IsTrue(set.Beatmaps.Count > 0); Assert.IsTrue(set.Beatmaps.Count > 0);
var beatmap = osu.Beatmaps.GetBeatmap(set.Beatmaps.First(b => b.Mode == PlayMode.Osu)); var beatmap = osu.Dependencies.Get<BeatmapDatabase>().GetBeatmap(set.Beatmaps.First(b => b.Mode == PlayMode.Osu));
Assert.IsTrue(beatmap.HitObjects.Count > 0); Assert.IsTrue(beatmap.HitObjects.Count > 0);
} }

View File

@ -13,6 +13,7 @@ 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
{ {
@ -99,10 +100,9 @@ namespace osu.Game.Beatmaps.Drawable
}; };
} }
protected override void Load(BaseGame game) [BackgroundDependencyLoader]
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,

View File

@ -10,12 +10,20 @@ using osu.Game.Database;
using osu.Game.Graphics; using osu.Game.Graphics;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Game.Configuration;
namespace osu.Game.Beatmaps.Drawable namespace osu.Game.Beatmaps.Drawable
{ {
class BeatmapSetHeader : Panel class BeatmapSetHeader : Panel
{ {
public Action<BeatmapSetHeader> GainedSelection; public Action<BeatmapSetHeader> GainedSelection;
private BeatmapSetInfo beatmapSet;
private SpriteText title, artist;
private OsuConfigManager config;
private Bindable<bool> preferUnicode;
protected override void Selected() protected override void Selected()
{ {
@ -31,8 +39,31 @@ namespace osu.Game.Beatmaps.Drawable
Width = 0.8f; Width = 0.8f;
} }
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
this.config = config;
preferUnicode = config.GetBindable<bool>(OsuConfig.ShowUnicode);
preferUnicode.ValueChanged += preferUnicode_changed;
preferUnicode_changed(preferUnicode, null);
}
private void preferUnicode_changed(object sender, EventArgs e)
{
title.Text = config.GetUnicodeString(beatmapSet.Metadata.Title, beatmapSet.Metadata.TitleUnicode);
artist.Text = config.GetUnicodeString(beatmapSet.Metadata.Artist, beatmapSet.Metadata.ArtistUnicode);
}
protected override void Dispose(bool isDisposing)
{
if (preferUnicode != null)
preferUnicode.ValueChanged -= preferUnicode_changed;
base.Dispose(isDisposing);
}
public BeatmapSetHeader(BeatmapSetInfo beatmapSet, WorkingBeatmap working) public BeatmapSetHeader(BeatmapSetInfo beatmapSet, WorkingBeatmap working)
{ {
this.beatmapSet = beatmapSet;
Children = new Framework.Graphics.Drawable[] Children = new Framework.Graphics.Drawable[]
{ {
working.Background == null ? new Box{ RelativeSizeAxes = Axes.Both, Colour = new Color4(20, 20, 20, 255) } : new Sprite working.Background == null ? new Box{ RelativeSizeAxes = Axes.Both, Colour = new Color4(20, 20, 20, 255) } : new Sprite
@ -51,16 +82,16 @@ namespace osu.Game.Beatmaps.Drawable
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new[] Children = new[]
{ {
new SpriteText title = new SpriteText
{ {
Font = @"Exo2.0-SemiBoldItalic", Font = @"Exo2.0-SemiBoldItalic",
Text = beatmapSet.Metadata.Title ?? beatmapSet.Metadata.TitleUnicode, Text = beatmapSet.Metadata.Title,
TextSize = 22 TextSize = 22
}, },
new SpriteText artist = new SpriteText
{ {
Font = @"Exo2.0-MediumItalic", Font = @"Exo2.0-MediumItalic",
Text = beatmapSet.Metadata.Artist ?? beatmapSet.Metadata.ArtistUnicode, Text = beatmapSet.Metadata.Artist,
TextSize = 16 TextSize = 16
}, },
new FlowContainer new FlowContainer

View File

@ -52,7 +52,7 @@ namespace osu.Game.Beatmaps.Formats
foreach (HitObject h in b.HitObjects) foreach (HitObject h in b.HitObjects)
{ {
if (h.NewCombo) i = (i + 1) % colours.Count; if (h.NewCombo || i == -1) i = (i + 1) % colours.Count;
h.Colour = colours[i]; h.Colour = colours[i];
} }
} }

View File

@ -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) [BackgroundDependencyLoader]
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 });

View File

@ -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) [BackgroundDependencyLoader]
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 });

View File

@ -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) [BackgroundDependencyLoader]
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) [BackgroundDependencyLoader]
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) [BackgroundDependencyLoader]
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) [BackgroundDependencyLoader]
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) [BackgroundDependencyLoader]
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) [BackgroundDependencyLoader]
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++)
{ {

View File

@ -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) [BackgroundDependencyLoader]
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 });

View File

@ -18,7 +18,7 @@ namespace osu.Game.Beatmaps
public readonly BeatmapSetInfo BeatmapSetInfo; public readonly BeatmapSetInfo BeatmapSetInfo;
private readonly BeatmapDatabase database; private readonly BeatmapDatabase database;
private ArchiveReader reader => database.GetReader(BeatmapSetInfo); private ArchiveReader reader => database?.GetReader(BeatmapSetInfo);
private Texture background; private Texture background;
private object backgroundLock = new object(); private object backgroundLock = new object();
@ -77,7 +77,7 @@ namespace osu.Game.Beatmaps
try try
{ {
var trackData = reader.GetStream(BeatmapInfo.Metadata.AudioFile); var trackData = reader?.GetStream(BeatmapInfo.Metadata.AudioFile);
if (trackData != null) if (trackData != null)
track = new AudioTrackBass(trackData); track = new AudioTrackBass(trackData);
} }

View File

@ -179,6 +179,10 @@ namespace osu.Game.Configuration
Set(OsuConfig.CanForceOptimusCompatibility, true); Set(OsuConfig.CanForceOptimusCompatibility, true);
} }
//todo: make a UnicodeString class/struct rather than requiring this helper method.
public string GetUnicodeString(string nonunicode, string unicode)
=> Get<bool>(OsuConfig.ShowUnicode) ? unicode ?? nonunicode : nonunicode ?? unicode;
public OsuConfigManager(BasicStorage storage) : base(storage) public OsuConfigManager(BasicStorage storage) : base(storage)
{ {
} }

View File

@ -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) [BackgroundDependencyLoader]
private void load(BaseGame game)
{ {
base.Load(game);
this.game = game; this.game = game;
} }

View File

@ -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) [BackgroundDependencyLoader]
private void load()
{ {
base.Load(game);
Add(new Background(textureName)); Add(new Background(textureName));
} }

View File

@ -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) [BackgroundDependencyLoader]
private void load(BaseGame game)
{ {
base.Load(game);
Add(new Background()); Add(new Background());
} }
} }

View File

@ -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) [BackgroundDependencyLoader]
private void load()
{ {
base.Load(game);
Children = new Drawable[] Children = new Drawable[]
{ {
box = new Box box = new Box

View File

@ -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) [BackgroundDependencyLoader]
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);

View File

@ -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) [BackgroundDependencyLoader]
private void load()
{ {
base.Load(game);
Children = new Drawable[] Children = new Drawable[]
{ {
buttonArea = new Container buttonArea = new Container

View File

@ -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
{ {
@ -45,13 +47,12 @@ namespace osu.Game.GameModes.Menu
}; };
} }
protected override void Load(BaseGame game) [BackgroundDependencyLoader]
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;
} }

View File

@ -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
{ {
@ -57,14 +59,12 @@ namespace osu.Game.GameModes.Menu
}; };
} }
protected override void Load(BaseGame game) [BackgroundDependencyLoader]
private void load(OsuGame game)
{ {
base.Load(game);
background.Preload(game); background.Preload(game);
OsuGame osu = (OsuGame)game; buttons.OnSettings = game.ToggleOptions;
buttons.OnSettings = osu.Options.ToggleVisibility;
} }
protected override void LoadComplete() protected override void LoadComplete()

View File

@ -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) [BackgroundDependencyLoader]
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()

View File

@ -8,6 +8,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
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.Containers; using osu.Framework.Graphics.Containers;
@ -29,9 +30,9 @@ namespace osu.Game.GameModes
internal virtual bool ShowToolbar => true; internal virtual bool ShowToolbar => true;
protected new OsuGame Game => base.Game as OsuGame; protected new OsuGameBase Game => base.Game as OsuGameBase;
protected float ToolbarPadding => ShowToolbar ? Game.Toolbar.DrawHeight : 0; protected float ToolbarPadding => ShowToolbar ? (Game as OsuGame)?.Toolbar.DrawHeight ?? 0 : 0;
private bool boundToBeatmap; private bool boundToBeatmap;
private Bindable<WorkingBeatmap> beatmap; private Bindable<WorkingBeatmap> beatmap;
@ -75,10 +76,11 @@ namespace osu.Game.GameModes
OnBeatmapChanged(beatmap.Value); OnBeatmapChanged(beatmap.Value);
} }
protected override void Load(BaseGame game) [BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuGameBase game)
{ {
base.Load(game); if (beatmap == null)
beatmap = (game as OsuGameBase)?.Beatmap; beatmap = game?.Beatmap;
} }
public override bool Push(GameMode mode) public override bool Push(GameMode mode)

View File

@ -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) [BackgroundDependencyLoader]
private void load()
{ {
base.Load(game);
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f }); Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
} }
} }

View File

@ -0,0 +1,20 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Game.Beatmaps.Objects;
using osu.Game.GameModes.Play.Osu;
namespace osu.Game.GameModes.Play.Catch
{
class CatchRuleset : Ruleset
{
public override ScoreOverlay CreateScoreOverlay() => new ScoreOverlayOsu();
public override HitRenderer CreateHitRendererWith(List<HitObject> objects) => new CatchHitRenderer { Objects = objects };
}
}

View File

@ -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) [BackgroundDependencyLoader]
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();
} }

View File

@ -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) [BackgroundDependencyLoader]
private void load()
{ {
base.Load(game);
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Children = new Drawable[] Children = new Drawable[]

View File

@ -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) [BackgroundDependencyLoader]
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()

View File

@ -0,0 +1,20 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Game.Beatmaps.Objects;
using osu.Game.GameModes.Play.Osu;
namespace osu.Game.GameModes.Play.Mania
{
class ManiaRuleset : Ruleset
{
public override ScoreOverlay CreateScoreOverlay() => new ScoreOverlayOsu();
public override HitRenderer CreateHitRendererWith(List<HitObject> objects) => new ManiaHitRenderer { Objects = objects };
}
}

View File

@ -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) [BackgroundDependencyLoader]
private void load()
{ {
base.Load(game); PopOutSpriteText.Origin = Origin;
PopOutSpriteText.Anchor = Anchor;
PopOutSpriteText.Origin = this.Origin;
PopOutSpriteText.Anchor = this.Anchor;
Add(PopOutSpriteText); Add(PopOutSpriteText);
} }

View File

@ -0,0 +1,18 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Game.Beatmaps.Objects;
namespace osu.Game.GameModes.Play.Osu
{
class OsuRuleset : Ruleset
{
public override ScoreOverlay CreateScoreOverlay() => new ScoreOverlayOsu();
public override HitRenderer CreateHitRendererWith(List<HitObject> objects) => new OsuHitRenderer { Objects = objects };
}}

View File

@ -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
{ {
@ -113,35 +115,34 @@ namespace osu.Game.GameModes.Play
Width = 100, Width = 100,
Text = "Play", Text = "Play",
Colour = new Color4(238, 51, 153, 255), Colour = new Color4(238, 51, 153, 255),
Action = () => Push(new Player { Action = () => Push(new Player
{
BeatmapInfo = selectedBeatmapGroup.SelectedPanel.Beatmap, BeatmapInfo = selectedBeatmapGroup.SelectedPanel.Beatmap,
PreferredPlayMode = playMode.Value PreferredPlayMode = playMode.Value
}), })
}, },
} }
} }
}; };
} }
protected override void Load(BaseGame game) [BackgroundDependencyLoader(permitNulls: true)]
private void load(BeatmapDatabase beatmaps, AudioManager audio, OsuGame game)
{ {
base.Load(game); if (game != null)
OsuGame osuGame = game as OsuGame;
if (osuGame != null)
{ {
playMode = osuGame.PlayMode; playMode = game.PlayMode;
playMode.ValueChanged += playMode_ValueChanged; playMode.ValueChanged += playMode_ValueChanged;
// Temporary: // Temporary:
scrollContainer.Padding = new MarginPadding { Top = ToolbarPadding }; scrollContainer.Padding = new MarginPadding { Top = ToolbarPadding };
} }
if (database == null) if (database == null)
database = (game as OsuGameBase).Beatmaps; 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);
} }

View File

@ -13,6 +13,14 @@ 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;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Input;
using osu.Framework.Platform;
using OpenTK.Input;
using MouseState = osu.Framework.Input.MouseState;
using osu.Framework.Graphics.Primitives;
namespace osu.Game.GameModes.Play namespace osu.Game.GameModes.Play
{ {
@ -26,21 +34,53 @@ namespace osu.Game.GameModes.Play
public BeatmapInfo BeatmapInfo; public BeatmapInfo BeatmapInfo;
PlayerInputManager inputManager;
class PlayerInputManager : UserInputManager
{
public PlayerInputManager(BasicGameHost host)
: base(host)
{
}
protected override void UpdateMouseState(InputState state)
{
base.UpdateMouseState(state);
MouseState mouse = (MouseState)state.Mouse;
foreach (Key k in state.Keyboard.Keys)
{
switch (k)
{
case Key.Z:
mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = true;
break;
case Key.X:
mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = true;
break;
}
}
}
}
public PlayMode PreferredPlayMode; public PlayMode PreferredPlayMode;
protected override IFrameBasedClock Clock => playerClock; protected override IFrameBasedClock Clock => playerClock;
private InterpolatingFramedClock playerClock; private InterpolatingFramedClock playerClock;
private IAdjustableClock sourceClock; private IAdjustableClock sourceClock;
private Ruleset Ruleset;
protected override void Load(BaseGame game) [BackgroundDependencyLoader]
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game)
{ {
base.Load(game);
try try
{ {
if (Beatmap == null) if (Beatmap == null)
Beatmap = ((OsuGame)game).Beatmaps.GetWorkingBeatmap(BeatmapInfo); Beatmap = beatmaps.GetWorkingBeatmap(BeatmapInfo);
} }
catch catch
{ {
@ -53,7 +93,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;
} }
@ -80,49 +120,11 @@ namespace osu.Game.GameModes.Play
PlayMode usablePlayMode = beatmap.BeatmapInfo?.Mode > PlayMode.Osu ? beatmap.BeatmapInfo.Mode : PreferredPlayMode; PlayMode usablePlayMode = beatmap.BeatmapInfo?.Mode > PlayMode.Osu ? beatmap.BeatmapInfo.Mode : PreferredPlayMode;
switch (usablePlayMode) Ruleset = Ruleset.GetRuleset(usablePlayMode);
{
default:
scoreOverlay = new ScoreOverlayOsu();
hitRenderer = new OsuHitRenderer scoreOverlay = Ruleset.CreateScoreOverlay();
{
Objects = beatmap.HitObjects,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
};
break;
case PlayMode.Taiko:
scoreOverlay = new ScoreOverlayOsu();
hitRenderer = new TaikoHitRenderer hitRenderer = Ruleset.CreateHitRendererWith(beatmap.HitObjects);
{
Objects = beatmap.HitObjects,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
};
break;
case PlayMode.Catch:
scoreOverlay = new ScoreOverlayOsu();
hitRenderer = new CatchHitRenderer
{
Objects = beatmap.HitObjects,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
};
break;
case PlayMode.Mania:
scoreOverlay = new ScoreOverlayOsu();
hitRenderer = new ManiaHitRenderer
{
Objects = beatmap.HitObjects,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
};
break;
}
hitRenderer.OnHit += delegate (HitObject h) { scoreOverlay.OnHit(h); }; hitRenderer.OnHit += delegate (HitObject h) { scoreOverlay.OnHit(h); };
hitRenderer.OnMiss += delegate (HitObject h) { scoreOverlay.OnMiss(h); }; hitRenderer.OnMiss += delegate (HitObject h) { scoreOverlay.OnMiss(h); };
@ -130,9 +132,16 @@ namespace osu.Game.GameModes.Play
if (autoplay) if (autoplay)
hitRenderer.Schedule(() => hitRenderer.DrawableObjects.ForEach(h => h.State = ArmedState.Armed)); hitRenderer.Schedule(() => hitRenderer.DrawableObjects.ForEach(h => h.State = ArmedState.Armed));
Children = new Drawable[]
{
inputManager = new PlayerInputManager(game.Host)
{
PassThrough = false,
Children = new Drawable[] Children = new Drawable[]
{ {
hitRenderer, hitRenderer,
}
},
scoreOverlay, scoreOverlay,
}; };
} }

View File

@ -0,0 +1,38 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Game.Beatmaps.Objects;
using osu.Game.GameModes.Play.Catch;
using osu.Game.GameModes.Play.Mania;
using osu.Game.GameModes.Play.Osu;
using osu.Game.GameModes.Play.Taiko;
namespace osu.Game.GameModes.Play
{
public abstract class Ruleset
{
public abstract ScoreOverlay CreateScoreOverlay();
public abstract HitRenderer CreateHitRendererWith(List<HitObject> objects);
public static Ruleset GetRuleset(PlayMode mode)
{
switch (mode)
{
default:
return new OsuRuleset();
case PlayMode.Catch:
return new CatchRuleset();
case PlayMode.Mania:
return new ManiaRuleset();
case PlayMode.Taiko:
return new TaikoRuleset();
}
}
}
}

View File

@ -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) [BackgroundDependencyLoader]
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,

View File

@ -0,0 +1,20 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Game.Beatmaps.Objects;
using osu.Game.GameModes.Play.Osu;
namespace osu.Game.GameModes.Play.Taiko
{
class TaikoRuleset : Ruleset
{
public override ScoreOverlay CreateScoreOverlay() => new ScoreOverlayOsu();
public override HitRenderer CreateHitRendererWith(List<HitObject> objects) => new TaikoHitRenderer { Objects = objects };
}
}

View File

@ -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) [BackgroundDependencyLoader]
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

View File

@ -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,7 +16,7 @@ namespace osu.Game.Graphics.Containers
public ParallaxContainer() public ParallaxContainer()
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
AddInternal(content = new Container() AddInternal(content = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
@ -27,11 +28,6 @@ namespace osu.Game.Graphics.Containers
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
protected override void Load(BaseGame game)
{
base.Load(game);
}
protected override bool OnMouseMove(InputState state) protected override bool OnMouseMove(InputState state)
{ {
content.Position = (state.Mouse.Position - DrawSize / 2) * ParallaxAmount; content.Position = (state.Mouse.Position - DrawSize / 2) * ParallaxAmount;

View File

@ -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) [BackgroundDependencyLoader]
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")
} }
}; };
} }

View File

@ -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) [BackgroundDependencyLoader]
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

View File

@ -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) [BackgroundDependencyLoader]
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()

View File

@ -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) [BackgroundDependencyLoader]
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;

View File

@ -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) [BackgroundDependencyLoader]
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)

View File

@ -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) [BackgroundDependencyLoader]
private void load()
{ {
base.Load(game);
newMessages(channel.Messages); newMessages(channel.Messages);
} }

View File

@ -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) [BackgroundDependencyLoader]
private void load()
{ {
base.Load(game);
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;

View File

@ -20,6 +20,8 @@ using OpenTK.Input;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.GameModes; using osu.Game.GameModes;
using osu.Game.Graphics.UserInterface.Volume; using osu.Game.Graphics.UserInterface.Volume;
using osu.Game.Database;
using osu.Framework.Allocation;
namespace osu.Game namespace osu.Game
{ {
@ -56,7 +58,10 @@ 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) public void ToggleOptions() => Options.ToggleVisibility();
[BackgroundDependencyLoader]
private void load()
{ {
if (!Host.IsPrimaryInstance) if (!Host.IsPrimaryInstance)
{ {
@ -64,10 +69,10 @@ namespace osu.Game
Environment.Exit(0); Environment.Exit(0);
} }
base.Load(game);
if (args?.Length > 0) if (args?.Length > 0)
Schedule(delegate { Beatmaps.Import(args); }); Schedule(delegate { Dependencies.Get<BeatmapDatabase>().Import(args); });
Dependencies.Cache(this);
//attach our bindables to the audio subsystem. //attach our bindables to the audio subsystem.
Audio.Volume.Weld(Config.GetBindable<double>(OsuConfig.VolumeUniversal)); Audio.Volume.Weld(Config.GetBindable<double>(OsuConfig.VolumeUniversal));
@ -76,6 +81,7 @@ namespace osu.Game
PlayMode = Config.GetBindable<PlayMode>(OsuConfig.PlayMode); PlayMode = Config.GetBindable<PlayMode>(OsuConfig.PlayMode);
//todo: move to constructor or LoadComplete.
Add(new Drawable[] { Add(new Drawable[] {
new VolumeControlReceptor new VolumeControlReceptor
{ {
@ -102,7 +108,7 @@ namespace osu.Game
(modeStack = new Intro (modeStack = new Intro
{ {
Beatmap = Beatmap Beatmap = Beatmap
}).Preload(game, d => }).Preload(this, d =>
{ {
mainContent.Add(d); mainContent.Add(d);
@ -112,9 +118,9 @@ namespace osu.Game
}); });
//overlay elements //overlay elements
(chat = new ChatConsole(API) { Depth = 0 }).Preload(game, overlayContent.Add); (chat = new ChatConsole(API) { Depth = 0 }).Preload(this, overlayContent.Add);
(musicController = new MusicController()).Preload(game, overlayContent.Add); (musicController = new MusicController()).Preload(this, overlayContent.Add);
(Options = new OptionsOverlay { Depth = 1 }).Preload(game, overlayContent.Add); (Options = new OptionsOverlay { Depth = 1 }).Preload(this, overlayContent.Add);
(Toolbar = new Toolbar (Toolbar = new Toolbar
{ {
Depth = 2, Depth = 2,
@ -122,7 +128,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();

View File

@ -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;
@ -23,7 +24,6 @@ namespace osu.Game
public class OsuGameBase : BaseGame public class OsuGameBase : BaseGame
{ {
internal OsuConfigManager Config; internal OsuConfigManager Config;
public BeatmapDatabase Beatmaps { get; private set; }
protected override string MainResourceFile => @"osu.Game.Resources.dll"; protected override string MainResourceFile => @"osu.Game.Resources.dll";
@ -37,31 +37,19 @@ namespace osu.Game
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>(); public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
public OsuGameBase()
{
AddInternal(ratioContainer = new RatioAdjust());
Children = new Drawable[]
{
Cursor = new OsuCursorContainer { Depth = float.MaxValue }
};
Beatmap.ValueChanged += Beatmap_ValueChanged;
}
private void Beatmap_ValueChanged(object sender, EventArgs e) private void Beatmap_ValueChanged(object sender, EventArgs e)
{ {
} }
protected override void Load(BaseGame game) [BackgroundDependencyLoader]
private void load()
{ {
base.Load(game); Dependencies.Cache(this);
Dependencies.Cache(new OsuConfigManager(Host.Storage));
OszArchiveReader.Register(); Dependencies.Cache(new BeatmapDatabase(Host.Storage, Host));
Beatmaps = new BeatmapDatabase(Host.Storage, Host);
//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 }; Dependencies.Cache(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"));
@ -78,12 +66,23 @@ namespace osu.Game
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Black")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Black"));
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BlackItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BlackItalic"));
API = new APIAccess() AddInternal(ratioContainer = new RatioAdjust());
Children = new Drawable[]
{
Cursor = new OsuCursorContainer { Depth = float.MaxValue }
};
Beatmap.ValueChanged += Beatmap_ValueChanged;
OszArchiveReader.Register();
Dependencies.Cache(API = new APIAccess
{ {
Username = Config.Get<string>(OsuConfig.Username), Username = Config.Get<string>(OsuConfig.Username),
Password = Config.Get<string>(OsuConfig.Password), Password = Config.Get<string>(OsuConfig.Password),
Token = Config.Get<string>(OsuConfig.Token) Token = Config.Get<string>(OsuConfig.Token)
}; });
} }
public override void SetHost(BasicGameHost host) public override void SetHost(BasicGameHost host)

View File

@ -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) [BackgroundDependencyLoader]
private void load()
{ {
base.Load(game);
initializeChannels(); initializeChannels();
} }

View File

@ -7,6 +7,8 @@ using System.Threading.Tasks;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework; using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Track; using osu.Framework.Audio.Track;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -17,6 +19,7 @@ using osu.Framework.Graphics.Transformations;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -24,7 +27,9 @@ namespace osu.Game.Overlays
{ {
public class MusicController : OverlayContainer public class MusicController : OverlayContainer
{ {
private Sprite backgroundSprite; private static readonly Vector2 start_position = new Vector2(10, 60);
private MusicControllerBackground backgroundSprite;
private DragBar progress; private DragBar progress;
private TextAwesome playButton, listButton; private TextAwesome playButton, listButton;
private SpriteText title, artist; private SpriteText title, artist;
@ -36,27 +41,30 @@ namespace osu.Game.Overlays
private int playHistoryIndex = -1; private int playHistoryIndex = -1;
private TrackManager trackManager; private TrackManager trackManager;
private BeatmapDatabase database;
private Bindable<WorkingBeatmap> beatmapSource; private Bindable<WorkingBeatmap> beatmapSource;
private Bindable<bool> preferUnicode;
private OsuConfigManager config;
private WorkingBeatmap current; private WorkingBeatmap current;
private BeatmapDatabase beatmaps;
public MusicController(BeatmapDatabase db = null) public MusicController()
{ {
database = db;
Width = 400; Width = 400;
Height = 130; Height = 130;
CornerRadius = 5; CornerRadius = 5;
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Colour = new Color4(0, 0, 0, 40),
Radius = 5,
};
Masking = true; Masking = true;
Anchor = Anchor.TopRight;//placeholder Anchor = Anchor.TopRight;//placeholder
Origin = Anchor.TopRight; Origin = Anchor.TopRight;
Position = new Vector2(10, 60); Position = start_position;
Children = new Drawable[] Children = new Drawable[]
{ {
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = new Color4(0, 0, 0, 127)
},
title = new SpriteText title = new SpriteText
{ {
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
@ -77,14 +85,6 @@ namespace osu.Game.Overlays
Text = @"Nothing to play", Text = @"Nothing to play",
Font = @"Exo2.0-BoldItalic" Font = @"Exo2.0-BoldItalic"
}, },
new Box
{
RelativeSizeAxes = Axes.X,
Height = 50,
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre,
Colour = new Color4(0, 0, 0, 127)
},
new ClickableContainer new ClickableContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
@ -174,21 +174,38 @@ namespace osu.Game.Overlays
}; };
} }
protected override void Load(BaseGame game) protected override bool OnDragStart(InputState state) => true;
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null) protected override bool OnDrag(InputState state)
{ {
if (database == null) database = osuGame.Beatmaps; Vector2 change = (state.Mouse.Position - state.Mouse.PositionMouseDown.Value);
trackManager = osuGame.Audio.Track; change.X = -change.X;
change *= (float)Math.Pow(change.Length, 0.7f) / change.Length;
MoveTo(start_position + change);
return base.OnDrag(state);
} }
beatmapSource = osuGame?.Beatmap ?? new Bindable<WorkingBeatmap>(); protected override bool OnDragEnd(InputState state)
playList = database.GetAllWithChildren<BeatmapSetInfo>(); {
MoveTo(start_position, 800, EasingTypes.OutElastic);
return base.OnDragEnd(state);
}
backgroundSprite = getScaledSprite(fallbackTexture = game.Textures.Get(@"Backgrounds/bg4")); [BackgroundDependencyLoader]
private void load(OsuGameBase osuGame, BeatmapDatabase beatmaps, AudioManager audio, TextureStore textures)
{
this.beatmaps = beatmaps;
trackManager = osuGame.Audio.Track;
config = osuGame.Config;
preferUnicode = osuGame.Config.GetBindable<bool>(OsuConfig.ShowUnicode);
preferUnicode.ValueChanged += preferUnicode_changed;
beatmapSource = osuGame.Beatmap ?? new Bindable<WorkingBeatmap>();
playList = beatmaps.GetAllWithChildren<BeatmapSetInfo>();
backgroundSprite = new MusicControllerBackground(fallbackTexture = textures.Get(@"Backgrounds/bg4"));
AddInternal(backgroundSprite); AddInternal(backgroundSprite);
} }
@ -210,6 +227,11 @@ namespace osu.Game.Overlays
if (current.Track.HasCompleted && !current.Track.Looping) next(); if (current.Track.HasCompleted && !current.Track.Looping) next();
} }
void preferUnicode_changed(object sender, EventArgs e)
{
updateDisplay(current, false);
}
private void workingChanged(object sender = null, EventArgs e = null) private void workingChanged(object sender = null, EventArgs e = null)
{ {
if (beatmapSource.Value == current) return; if (beatmapSource.Value == current) return;
@ -269,7 +291,7 @@ namespace osu.Game.Overlays
private void play(BeatmapInfo info, bool isNext) private void play(BeatmapInfo info, bool isNext)
{ {
current = database.GetWorkingBeatmap(info, current); current = beatmaps.GetWorkingBeatmap(info, current);
Task.Run(() => Task.Run(() =>
{ {
trackManager.SetExclusive(current.Track); trackManager.SetExclusive(current.Track);
@ -281,11 +303,15 @@ namespace osu.Game.Overlays
private void updateDisplay(WorkingBeatmap beatmap, bool? isNext) private void updateDisplay(WorkingBeatmap beatmap, bool? isNext)
{ {
BeatmapMetadata metadata = beatmap.Beatmap.Metadata; if (beatmap.Beatmap == null)
title.Text = metadata.TitleUnicode ?? metadata.Title; //todo: we may need to display some default text here (currently in the constructor).
artist.Text = metadata.ArtistUnicode ?? metadata.Artist; return;
Sprite newBackground = getScaledSprite(beatmap.Background ?? fallbackTexture); BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata;
title.Text = config.GetUnicodeString(metadata.Title, metadata.TitleUnicode);
artist.Text = config.GetUnicodeString(metadata.Artist, metadata.ArtistUnicode);
MusicControllerBackground newBackground = new MusicControllerBackground(beatmap.Background ?? fallbackTexture);
Add(newBackground); Add(newBackground);
@ -306,34 +332,61 @@ namespace osu.Game.Overlays
backgroundSprite = newBackground; backgroundSprite = newBackground;
} }
private Sprite getScaledSprite(Texture background)
{
Sprite scaledSprite = new Sprite
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Texture = background,
Depth = float.MinValue
};
scaledSprite.Scale = new Vector2(Math.Max(DrawSize.X / scaledSprite.DrawSize.X, DrawSize.Y / scaledSprite.DrawSize.Y));
return scaledSprite;
}
private void seek(float position) private void seek(float position)
{ {
current?.Track?.Seek(current.Track.Length * position); current?.Track?.Seek(current.Track.Length * position);
current?.Track?.Start(); current?.Track?.Start();
} }
protected override void Dispose(bool isDisposing)
{
if (preferUnicode != null)
preferUnicode.ValueChanged -= preferUnicode_changed;
base.Dispose(isDisposing);
}
protected override bool OnClick(InputState state) => true; protected override bool OnClick(InputState state) => true;
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
protected override bool OnDragStart(InputState state) => true;
//placeholder for toggling //placeholder for toggling
protected override void PopIn() => FadeIn(100); protected override void PopIn() => FadeIn(100);
protected override void PopOut() => FadeOut(100); protected override void PopOut() => FadeOut(100);
private class MusicControllerBackground : BufferedContainer
{
private Sprite sprite;
public MusicControllerBackground(Texture backgroundTexture)
{
CacheDrawnFrameBuffer = true;
RelativeSizeAxes = Axes.Both;
Depth = float.MinValue;
Children = new Drawable[]
{
sprite = new Sprite
{
Texture = backgroundTexture,
Colour = new Color4(150, 150, 150, 255)
},
new Box
{
RelativeSizeAxes = Axes.X,
Height = 50,
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre,
Colour = new Color4(0, 0, 0, 127)
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
sprite.Scale = new Vector2(Math.Max(DrawSize.X / sprite.DrawSize.X, DrawSize.Y / sprite.DrawSize.Y));
}
}
} }
} }

View File

@ -1,4 +1,5 @@
using osu.Framework.Graphics; using osu.Framework;
using osu.Framework.Graphics;
using osu.Game.Graphics; using osu.Game.Graphics;
namespace osu.Game.Overlays.Options.Audio namespace osu.Game.Overlays.Options.Audio
@ -12,7 +13,7 @@ namespace osu.Game.Overlays.Options.Audio
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new AudioDevicesOptions(), new AudioDevicesOptions { Alpha = RuntimeInfo.IsWindows ? 1 : 0 },
new VolumeOptions(), new VolumeOptions(),
new OffsetAdjustmentOptions(), new OffsetAdjustmentOptions(),
}; };

View File

@ -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.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
@ -13,24 +14,23 @@ namespace osu.Game.Overlays.Options.Audio
private CheckBoxOption ignoreHitsounds; private CheckBoxOption ignoreHitsounds;
public VolumeOptions() public VolumeOptions()
{
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new SpriteText { Text = "Master: TODO slider" }, new SpriteText { Text = "Master: TODO slider" },
new SpriteText { Text = "Music: TODO slider" }, new SpriteText { Text = "Music: TODO slider" },
new SpriteText { Text = "Effect: TODO slider" }, new SpriteText { Text = "Effect: TODO slider" },
ignoreHitsounds = new CheckBoxOption { LabelText = "Ignore beatmap hitsounds" } new CheckBoxOption
{
LabelText = "Ignore beatmap hitsounds",
Bindable = config.GetBindable<bool>(OsuConfig.IgnoreBeatmapSamples)
}
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
ignoreHitsounds.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.IgnoreBeatmapSamples);
}
}
} }
} }

View File

@ -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.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration; using osu.Game.Configuration;
@ -12,36 +13,44 @@ namespace osu.Game.Overlays.Options
public override string Header => "Editor"; public override string Header => "Editor";
public override FontAwesome Icon => FontAwesome.fa_pencil; public override FontAwesome Icon => FontAwesome.fa_pencil;
private CheckBoxOption backgroundVideo, defaultSkin, snakingSliders, hitAnimations, followPoints, stacking; [BackgroundDependencyLoader]
private void load(OsuConfigManager config)
public EditorSection()
{ {
content.Spacing = new Vector2(0, 5); content.Spacing = new Vector2(0, 5);
Children = new Drawable[] Children = new Drawable[]
{ {
backgroundVideo = new CheckBoxOption { LabelText = "Background video" }, new CheckBoxOption
defaultSkin = new CheckBoxOption { LabelText = "Always use default skin" }, {
snakingSliders = new CheckBoxOption { LabelText = "Snaking sliders" }, LabelText = "Background video",
hitAnimations = new CheckBoxOption { LabelText = "Hit animations" }, Bindable = config.GetBindable<bool>(OsuConfig.VideoEditor)
followPoints = new CheckBoxOption { LabelText = "Follow points" }, },
stacking = new CheckBoxOption { LabelText = "Stacking" }, new CheckBoxOption
{
LabelText = "Always use default skin",
Bindable = config.GetBindable<bool>(OsuConfig.EditorDefaultSkin)
},
new CheckBoxOption
{
LabelText = "Snaking sliders",
Bindable = config.GetBindable<bool>(OsuConfig.EditorSnakingSliders)
},
new CheckBoxOption
{
LabelText = "Hit animations",
Bindable = config.GetBindable<bool>(OsuConfig.EditorHitAnimations)
},
new CheckBoxOption
{
LabelText = "Follow points",
Bindable = config.GetBindable<bool>(OsuConfig.EditorFollowPoints)
},
new CheckBoxOption
{
LabelText = "Stacking",
Bindable = config.GetBindable<bool>(OsuConfig.EditorStacking)
},
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
backgroundVideo.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.VideoEditor);
defaultSkin.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.EditorDefaultSkin);
snakingSliders.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.EditorSnakingSliders);
hitAnimations.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.EditorHitAnimations);
followPoints.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.EditorFollowPoints);
stacking.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.EditorStacking);
}
}
} }
} }

View File

@ -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.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
@ -10,9 +11,8 @@ namespace osu.Game.Overlays.Options.Gameplay
{ {
protected override string Header => "General"; protected override string Header => "General";
private CheckBoxOption keyOverlay, hiddenApproachCircle, scaleManiaScroll, rememberManiaScroll; [BackgroundDependencyLoader]
private void load(OsuConfigManager config)
public GeneralGameplayOptions()
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
@ -20,24 +20,27 @@ namespace osu.Game.Overlays.Options.Gameplay
new SpriteText { Text = "Progress display: TODO dropdown" }, new SpriteText { Text = "Progress display: TODO dropdown" },
new SpriteText { Text = "Score meter type: TODO dropdown" }, new SpriteText { Text = "Score meter type: TODO dropdown" },
new SpriteText { Text = "Score meter size: TODO slider" }, new SpriteText { Text = "Score meter size: TODO slider" },
keyOverlay = new CheckBoxOption { LabelText = "Always show key overlay" }, new CheckBoxOption
hiddenApproachCircle = new CheckBoxOption { LabelText = "Show approach circle on first \"Hidden\" object" }, {
scaleManiaScroll = new CheckBoxOption { LabelText = "Scale osu!mania scroll speed with BPM" }, LabelText = "Always show key overlay",
rememberManiaScroll = new CheckBoxOption { LabelText = "Remember osu!mania scroll speed per beatmap" }, Bindable = config.GetBindable<bool>(OsuConfig.KeyOverlay)
},
new CheckBoxOption
{
LabelText = "Show approach circle on first \"Hidden\" object",
Bindable = config.GetBindable<bool>(OsuConfig.HiddenShowFirstApproach)
},
new CheckBoxOption
{
LabelText = "Scale osu!mania scroll speed with BPM",
Bindable = config.GetBindable<bool>(OsuConfig.ManiaSpeedBPMScale)
},
new CheckBoxOption
{
LabelText = "Remember osu!mania scroll speed per beatmap",
Bindable = config.GetBindable<bool>(OsuConfig.UsePerBeatmapManiaSpeed)
},
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
keyOverlay.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.KeyOverlay);
hiddenApproachCircle.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.HiddenShowFirstApproach);
scaleManiaScroll.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.ManiaSpeedBPMScale);
rememberManiaScroll.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.UsePerBeatmapManiaSpeed);
}
}
} }
} }

View File

@ -1,6 +1,7 @@
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
@ -8,27 +9,24 @@ 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;
public LanguageOptions() [BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new SpriteText { Text = "TODO: Dropdown" }, new SpriteText { Text = "TODO: Dropdown" },
showUnicode = new CheckBoxOption { LabelText = "Prefer metadata in original language" }, new CheckBoxOption
altChatFont = new CheckBoxOption { LabelText = "Use alternative font for chat display" }, {
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)
},
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
showUnicode.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.ShowUnicode);
altChatFont.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.AlternativeChatFont);
}
}
} }
} }

View File

@ -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) [BackgroundDependencyLoader(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)
}; };
} }

View File

@ -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,10 +9,10 @@ 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() [BackgroundDependencyLoader]
private void load(BasicStorage storage)
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
@ -21,16 +22,10 @@ namespace osu.Game.Overlays.Options.General
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Open osu! folder", Text = "Open osu! folder",
Action = () => storage?.OpenInNativeExplorer(), Action = () => storage.OpenInNativeExplorer(),
} }
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
this.storage = game.Host.Storage;
}
} }
} }

View File

@ -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.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
@ -10,38 +11,48 @@ namespace osu.Game.Overlays.Options.Graphics
{ {
protected override string Header => "Detail Settings"; protected override string Header => "Detail Settings";
private CheckBoxOption snakingSliders, backgroundVideo, storyboards, comboBursts, [BackgroundDependencyLoader]
hitLighting, shaders, softeningFilter; private void load(OsuConfigManager config)
public DetailOptions()
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
snakingSliders = new CheckBoxOption { LabelText = "Snaking sliders" }, new CheckBoxOption
backgroundVideo = new CheckBoxOption { LabelText = "Background video" }, {
storyboards = new CheckBoxOption { LabelText = "Storyboards" }, LabelText = "Snaking sliders",
comboBursts = new CheckBoxOption { LabelText = "Combo bursts" }, Bindable = config.GetBindable<bool>(OsuConfig.SnakingSliders)
hitLighting = new CheckBoxOption { LabelText = "Hit lighting" }, },
shaders = new CheckBoxOption { LabelText = "Shaders" }, new CheckBoxOption
softeningFilter = new CheckBoxOption { LabelText = "Softening filter" }, {
LabelText = "Background video",
Bindable = config.GetBindable<bool>(OsuConfig.Video)
},
new CheckBoxOption
{
LabelText = "Storyboards",
Bindable = config.GetBindable<bool>(OsuConfig.ShowStoryboard)
},
new CheckBoxOption
{
LabelText = "Combo bursts",
Bindable = config.GetBindable<bool>(OsuConfig.ComboBurst)
},
new CheckBoxOption
{
LabelText = "Hit lighting",
Bindable = config.GetBindable<bool>(OsuConfig.HitLighting)
},
new CheckBoxOption
{
LabelText = "Shaders",
Bindable = config.GetBindable<bool>(OsuConfig.Bloom)
},
new CheckBoxOption
{
LabelText = "Softening filter",
Bindable = config.GetBindable<bool>(OsuConfig.BloomSoftening)
},
new SpriteText { Text = "Screenshot format TODO: dropdown" } new SpriteText { Text = "Screenshot format TODO: dropdown" }
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
snakingSliders.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.SnakingSliders);
backgroundVideo.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.Video);
storyboards.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.ShowStoryboard);
comboBursts.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.ComboBurst);
hitLighting.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.HitLighting);
shaders.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.Bloom);
softeningFilter.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.BloomSoftening);
}
}
} }
} }

View File

@ -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.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
@ -10,31 +11,27 @@ namespace osu.Game.Overlays.Options.Graphics
{ {
protected override string Header => "Layout"; protected override string Header => "Layout";
private CheckBoxOption fullscreen, letterboxing; [BackgroundDependencyLoader]
private void load(OsuConfigManager config)
public LayoutOptions()
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new SpriteText { Text = "Resolution: TODO dropdown" }, new SpriteText { Text = "Resolution: TODO dropdown" },
fullscreen = new CheckBoxOption { LabelText = "Fullscreen mode" }, new CheckBoxOption
letterboxing = new CheckBoxOption { LabelText = "Letterboxing" }, {
LabelText = "Fullscreen mode",
Bindable = config.GetBindable<bool>(OsuConfig.Fullscreen),
},
new CheckBoxOption
{
LabelText = "Letterboxing",
Bindable = config.GetBindable<bool>(OsuConfig.Letterboxing),
},
new SpriteText { Text = "Horizontal position" }, new SpriteText { Text = "Horizontal position" },
new SpriteText { Text = "TODO: slider" }, new SpriteText { Text = "TODO: slider" },
new SpriteText { Text = "Vertical position" }, new SpriteText { Text = "Vertical position" },
new SpriteText { Text = "TODO: slider" }, new SpriteText { Text = "TODO: slider" },
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
fullscreen.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.Fullscreen);
letterboxing.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.Letterboxing);
}
}
} }
} }

View File

@ -1,4 +1,5 @@
using osu.Framework; using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration; using osu.Game.Configuration;
@ -8,32 +9,37 @@ namespace osu.Game.Overlays.Options.Graphics
{ {
protected override string Header => "Main Menu"; protected override string Header => "Main Menu";
private CheckBoxOption snow, parallax, tips, voices, musicTheme; [BackgroundDependencyLoader]
private void load(OsuConfigManager config)
public MainMenuOptions()
{ {
Children = new[] Children = new[]
{ {
snow = new CheckBoxOption { LabelText = "Snow" }, new CheckBoxOption
parallax = new CheckBoxOption { LabelText = "Parallax" }, {
tips = new CheckBoxOption { LabelText = "Menu tips" }, LabelText = "Snow",
voices = new CheckBoxOption { LabelText = "Interface voices" }, Bindable = config.GetBindable<bool>(OsuConfig.MenuSnow)
musicTheme = new CheckBoxOption { LabelText = "osu! music theme" }, },
new CheckBoxOption
{
LabelText = "Parallax",
Bindable = config.GetBindable<bool>(OsuConfig.MenuParallax)
},
new CheckBoxOption
{
LabelText = "Menu tips",
Bindable = config.GetBindable<bool>(OsuConfig.ShowMenuTips)
},
new CheckBoxOption
{
LabelText = "Interface voices",
Bindable = config.GetBindable<bool>(OsuConfig.MenuVoice)
},
new CheckBoxOption
{
LabelText = "osu! music theme",
Bindable = config.GetBindable<bool>(OsuConfig.MenuMusic)
},
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
snow.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.MenuSnow);
parallax.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.MenuParallax);
tips.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.ShowMenuTips);
voices.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.MenuVoice);
musicTheme.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.MenuMusic);
}
}
} }
} }

View File

@ -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.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
@ -10,30 +11,29 @@ namespace osu.Game.Overlays.Options.Graphics
{ {
protected override string Header => "Renderer"; protected override string Header => "Renderer";
private CheckBoxOption fpsCounter, reduceDroppedFrames, detectPerformanceIssues; [BackgroundDependencyLoader]
private void load(OsuConfigManager config)
public RendererOptions()
{ {
// NOTE: Compatability mode omitted // NOTE: Compatability mode omitted
Children = new Drawable[] Children = new Drawable[]
{ {
new SpriteText { Text = "Frame limiter: TODO dropdown" }, new SpriteText { Text = "Frame limiter: TODO dropdown" },
fpsCounter = new CheckBoxOption { LabelText = "Show FPS counter" }, new CheckBoxOption
reduceDroppedFrames = new CheckBoxOption { LabelText = "Reduce dropped frames" }, {
detectPerformanceIssues = new CheckBoxOption { LabelText = "Detect performance issues" }, LabelText = "Show FPS counter",
Bindable = config.GetBindable<bool>(OsuConfig.FpsCounter),
},
new CheckBoxOption
{
LabelText = "Reduce dropped frames",
Bindable = config.GetBindable<bool>(OsuConfig.ForceFrameFlush),
},
new CheckBoxOption
{
LabelText = "Detect performance issues",
Bindable = config.GetBindable<bool>(OsuConfig.DetectPerformanceIssues),
},
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
fpsCounter.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.FpsCounter);
reduceDroppedFrames.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.ForceFrameFlush);
detectPerformanceIssues.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.DetectPerformanceIssues);
}
}
} }
} }

View File

@ -1,4 +1,5 @@
using osu.Framework; using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration; using osu.Game.Configuration;
@ -8,24 +9,17 @@ namespace osu.Game.Overlays.Options.Graphics
{ {
protected override string Header => "Song Select"; protected override string Header => "Song Select";
private CheckBoxOption showThumbs; [BackgroundDependencyLoader]
private void load(OsuConfigManager config)
public SongSelectGraphicsOptions()
{ {
Children = new[] Children = new[]
{ {
showThumbs = new CheckBoxOption { LabelText = "Show thumbnails" } new CheckBoxOption
{
LabelText = "Show thumbnails",
Bindable = config.GetBindable<bool>(OsuConfig.SongSelectThumbnails)
}
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
showThumbs.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.SongSelectThumbnails);
}
}
} }
} }

View File

@ -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.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
@ -13,31 +14,42 @@ namespace osu.Game.Overlays.Options.Input
private CheckBoxOption rawInput, mapRawInput, disableWheel, disableButtons, enableRipples; private CheckBoxOption rawInput, mapRawInput, disableWheel, disableButtons, enableRipples;
public MouseOptions() public MouseOptions()
{
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new SpriteText { Text = "Sensitivity: TODO slider" }, new SpriteText { Text = "Sensitivity: TODO slider" },
rawInput = new CheckBoxOption { LabelText = "Raw input" }, new CheckBoxOption
mapRawInput = new CheckBoxOption { LabelText = "Map absolute raw input to the osu! window" }, {
LabelText = "Raw input",
Bindable = config.GetBindable<bool>(OsuConfig.RawInput)
},
new CheckBoxOption
{
LabelText = "Map absolute raw input to the osu! window",
Bindable = config.GetBindable<bool>(OsuConfig.AbsoluteToOsuWindow)
},
new SpriteText { Text = "Confine mouse cursor: TODO dropdown" }, new SpriteText { Text = "Confine mouse cursor: TODO dropdown" },
disableWheel = new CheckBoxOption { LabelText = "Disable mouse wheel in play mode" }, new CheckBoxOption
disableButtons = new CheckBoxOption { LabelText = "Disable mouse buttons in play mode" }, {
enableRipples = new CheckBoxOption { LabelText = "Cursor ripples" }, LabelText = "Disable mouse wheel in play mode",
Bindable = config.GetBindable<bool>(OsuConfig.MouseDisableWheel)
},
new CheckBoxOption
{
LabelText = "Disable mouse buttons in play mode",
Bindable = config.GetBindable<bool>(OsuConfig.MouseDisableButtons)
},
new CheckBoxOption
{
LabelText = "Cursor ripples",
Bindable = config.GetBindable<bool>(OsuConfig.CursorRipple)
},
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
rawInput.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.RawInput);
mapRawInput.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.AbsoluteToOsuWindow);
disableWheel.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.MouseDisableWheel);
disableButtons.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.MouseDisableButtons);
enableRipples.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.CursorRipple);
}
}
} }
} }

View File

@ -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.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration; using osu.Game.Configuration;
@ -9,27 +10,23 @@ namespace osu.Game.Overlays.Options.Input
{ {
protected override string Header => "Other"; protected override string Header => "Other";
private CheckBoxOption tabletSupport, wiimoteSupport; [BackgroundDependencyLoader]
private void load(OsuConfigManager config)
public OtherInputOptions()
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
tabletSupport = new CheckBoxOption { LabelText = "OS TabletPC support" }, new CheckBoxOption
wiimoteSupport = new CheckBoxOption { LabelText = "Wiimote/TaTaCon Drum Support" }, {
LabelText = "OS TabletPC support",
Bindable = config.GetBindable<bool>(OsuConfig.Tablet)
},
new CheckBoxOption
{
LabelText = "Wiimote/TaTaCon Drum Support",
Bindable = config.GetBindable<bool>(OsuConfig.Wiimote)
},
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
tabletSupport.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.Tablet);
wiimoteSupport.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.Wiimote);
}
}
} }
} }

View File

@ -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.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
@ -8,36 +9,48 @@ namespace osu.Game.Overlays.Options.Online
{ {
public class InGameChatOptions : OptionsSubsection public class InGameChatOptions : OptionsSubsection
{ {
private TextBoxOption chatIgnoreList;
private TextBoxOption chatHighlightWords;
protected override string Header => "In-game Chat"; protected override string Header => "In-game Chat";
private CheckBoxOption filterWords, filterForeign, logPMs, blockPMs; [BackgroundDependencyLoader]
private void load(OsuConfigManager config)
public InGameChatOptions()
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
filterWords = new CheckBoxOption { LabelText = "Filter offensive words" }, new CheckBoxOption
filterForeign = new CheckBoxOption { LabelText = "Filter foreign characters" }, {
logPMs = new CheckBoxOption { LabelText = "Log private messages" }, LabelText = "Filter offensive words",
blockPMs = new CheckBoxOption { LabelText = "Block private messages from non-friends" }, Bindable = config.GetBindable<bool>(OsuConfig.ChatFilter)
},
new CheckBoxOption
{
LabelText = "Filter foreign characters",
Bindable = config.GetBindable<bool>(OsuConfig.ChatRemoveForeign)
},
new CheckBoxOption
{
LabelText = "Log private messages",
Bindable = config.GetBindable<bool>(OsuConfig.LogPrivateMessages)
},
new CheckBoxOption
{
LabelText = "Block private messages from non-friends",
Bindable = config.GetBindable<bool>(OsuConfig.BlockNonFriendPM)
},
new SpriteText { Text = "Chat ignore list (space-seperated list)" }, new SpriteText { Text = "Chat ignore list (space-seperated list)" },
new TextBox { Height = 20, RelativeSizeAxes = Axes.X }, chatIgnoreList = new TextBoxOption {
Height = 20,
RelativeSizeAxes = Axes.X,
Bindable = config.GetBindable<string>(OsuConfig.IgnoreList)
},
new SpriteText { Text = "Chat highlight words (space-seperated list)" }, new SpriteText { Text = "Chat highlight words (space-seperated list)" },
new TextBox { Height = 20, RelativeSizeAxes = Axes.X }, chatHighlightWords = new TextBoxOption {
Height = 20,
RelativeSizeAxes = Axes.X,
Bindable = config.GetBindable<string>(OsuConfig.HighlightWords)
},
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
filterWords.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.ChatFilter);
filterForeign.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.ChatRemoveForeign);
logPMs.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.LogPrivateMessages);
blockPMs.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.BlockNonFriendPM);
}
}
} }
} }

View File

@ -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.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration; using osu.Game.Configuration;
@ -9,35 +10,42 @@ namespace osu.Game.Overlays.Options.Online
{ {
protected override string Header => "Notifications"; protected override string Header => "Notifications";
private CheckBoxOption chatTicker, notifyMention, notifyChat, audibleNotification, [BackgroundDependencyLoader]
notificationsDuringGameplay, notifyFriendStatus; private void load(OsuConfigManager config)
public NotificationsOptions()
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
chatTicker = new CheckBoxOption { LabelText = "Enable chat ticker" }, new CheckBoxOption
notifyMention = new CheckBoxOption { LabelText = "Show a notification popup when someone says your name" }, {
notifyChat = new CheckBoxOption { LabelText = "Show chat message notifications" }, LabelText = "Enable chat ticker",
audibleNotification = new CheckBoxOption { LabelText = "Play a sound when someone says your name" }, Bindable = config.GetBindable<bool>(OsuConfig.Ticker)
notificationsDuringGameplay = new CheckBoxOption { LabelText = "Show notification popups instantly during gameplay" }, },
notifyFriendStatus = new CheckBoxOption { LabelText = "Show notification popups when friends change status" }, new CheckBoxOption
{
LabelText = "Show a notification popup when someone says your name",
Bindable = config.GetBindable<bool>(OsuConfig.ChatHighlightName)
},
new CheckBoxOption
{
LabelText = "Show chat message notifications",
Bindable = config.GetBindable<bool>(OsuConfig.ChatMessageNotification)
},
new CheckBoxOption
{
LabelText = "Play a sound when someone says your name",
Bindable = config.GetBindable<bool>(OsuConfig.ChatAudibleHighlight)
},
new CheckBoxOption
{
LabelText = "Show notification popups instantly during gameplay",
Bindable = config.GetBindable<bool>(OsuConfig.PopupDuringGameplay)
},
new CheckBoxOption
{
LabelText = "Show notification popups when friends change status",
Bindable = config.GetBindable<bool>(OsuConfig.NotifyFriends)
},
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
chatTicker.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.Ticker);
notifyMention.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.ChatHighlightName);
notifyChat.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.ChatMessageNotification);
audibleNotification.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.ChatAudibleHighlight);
notificationsDuringGameplay.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.PopupDuringGameplay);
notifyFriendStatus.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.NotifyFriends);
}
}
} }
} }

View File

@ -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.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration; using osu.Game.Configuration;
@ -9,30 +10,32 @@ namespace osu.Game.Overlays.Options.Online
{ {
protected override string Header => "Integration"; protected override string Header => "Integration";
private CheckBoxOption yahoo, msn, autoDirect, noVideo; [BackgroundDependencyLoader]
private void load(OsuConfigManager config)
public OnlineIntegrationOptions()
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
yahoo = new CheckBoxOption { LabelText = "Integrate with Yahoo! status display" }, new CheckBoxOption
msn = new CheckBoxOption { LabelText = "Integrate with MSN Live status display" }, {
autoDirect = new CheckBoxOption { LabelText = "Automatically start osu!direct downloads" }, LabelText = "Integrate with Yahoo! status display",
noVideo = new CheckBoxOption { LabelText = "Prefer no-video downloads" }, Bindable = config.GetBindable<bool>(OsuConfig.YahooIntegration)
},
new CheckBoxOption
{
LabelText = "Integrate with MSN Live status display",
Bindable = config.GetBindable<bool>(OsuConfig.MsnIntegration)
},
new CheckBoxOption
{
LabelText = "Automatically start osu!direct downloads",
Bindable = config.GetBindable<bool>(OsuConfig.AutomaticDownload)
},
new CheckBoxOption
{
LabelText = "Prefer no-video downloads",
Bindable = config.GetBindable<bool>(OsuConfig.AutomaticDownloadNoVideo)
},
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
yahoo.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.YahooIntegration);
msn.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.MsnIntegration);
autoDirect.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.AutomaticDownload);
noVideo.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.AutomaticDownloadNoVideo);
}
}
} }
} }

View File

@ -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.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration; using osu.Game.Configuration;
@ -9,26 +10,22 @@ namespace osu.Game.Overlays.Options.Online
{ {
protected override string Header => "Privacy"; protected override string Header => "Privacy";
private CheckBoxOption shareCity, allowInvites; [BackgroundDependencyLoader]
private void load(OsuConfigManager config)
public PrivacyOptions()
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
shareCity = new CheckBoxOption { LabelText = "Share your city location with others" }, new CheckBoxOption
allowInvites = new CheckBoxOption { LabelText = "Allow multiplayer game invites from all users" }, {
LabelText = "Share your city location with others",
Bindable = config.GetBindable<bool>(OsuConfig.DisplayCityLocation)
},
new CheckBoxOption
{
LabelText = "Allow multiplayer game invites from all users",
Bindable = config.GetBindable<bool>(OsuConfig.AllowPublicInvites)
},
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
shareCity.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.DisplayCityLocation);
allowInvites.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.AllowPublicInvites);
}
}
} }
} }

View File

@ -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.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
@ -14,9 +15,8 @@ namespace osu.Game.Overlays.Options
public override string Header => "Skin"; public override string Header => "Skin";
public override FontAwesome Icon => FontAwesome.fa_paint_brush; public override FontAwesome Icon => FontAwesome.fa_paint_brush;
private CheckBoxOption ignoreSkins, useSkinSoundSamples, useTaikoSkin, useSkinCursor, autoCursorSize; [BackgroundDependencyLoader]
private void load(OsuConfigManager config)
public SkinSection()
{ {
content.Spacing = new Vector2(0, 5); content.Spacing = new Vector2(0, 5);
Children = new Drawable[] Children = new Drawable[]
@ -38,27 +38,33 @@ namespace osu.Game.Overlays.Options
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Export as .osk", Text = "Export as .osk",
}, },
ignoreSkins = new CheckBoxOption { LabelText = "Ignore all beatmap skins" }, new CheckBoxOption
useSkinSoundSamples = new CheckBoxOption { LabelText = "Use skin's sound samples" }, {
useTaikoSkin = new CheckBoxOption { LabelText = "Use Taiko skin for Taiko mode" }, LabelText = "Ignore all beatmap skins",
useSkinCursor = new CheckBoxOption { LabelText = "Always use skin cursor" }, Bindable = config.GetBindable<bool>(OsuConfig.IgnoreBeatmapSkins)
},
new CheckBoxOption
{
LabelText = "Use skin's sound samples",
Bindable = config.GetBindable<bool>(OsuConfig.SkinSamples)
},
new CheckBoxOption
{
LabelText = "Use Taiko skin for Taiko mode",
Bindable = config.GetBindable<bool>(OsuConfig.UseTaikoSkin)
},
new CheckBoxOption
{
LabelText = "Always use skin cursor",
Bindable = config.GetBindable<bool>(OsuConfig.UseSkinCursor)
},
new SpriteText { Text = "Cursor size: TODO slider" }, new SpriteText { Text = "Cursor size: TODO slider" },
autoCursorSize = new CheckBoxOption { LabelText = "Automatic cursor size" }, new CheckBoxOption
{
LabelText = "Automatic cursor size",
Bindable = config.GetBindable<bool>(OsuConfig.AutomaticCursorSizing)
},
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
ignoreSkins.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.IgnoreBeatmapSkins);
useSkinSoundSamples.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.SkinSamples);
useTaikoSkin.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.UseTaikoSkin);
useSkinCursor.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.UseSkinCursor);
autoCursorSize.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.AutomaticCursorSizing);
}
}
} }
} }

View File

@ -0,0 +1,49 @@
using System;
using osu.Framework.Configuration;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options
{
public class TextBoxOption : TextBox
{
private Bindable<string> bindable;
public Bindable<string> Bindable
{
set
{
if (bindable != null)
bindable.ValueChanged -= bindableValueChanged;
bindable = value;
if (bindable != null)
{
base.Text = bindable.Value;
bindable.ValueChanged += bindableValueChanged;
}
}
}
protected override string InternalText
{
get { return base.InternalText; }
set
{
base.InternalText = value;
if (bindable != null)
bindable.Value = value;
}
}
private void bindableValueChanged(object sender, EventArgs e)
{
Text = bindable.Value;
}
protected override void Dispose(bool isDisposing)
{
if (bindable != null)
bindable.ValueChanged -= bindableValueChanged;
base.Dispose(isDisposing);
}
}
}

View File

@ -7,12 +7,14 @@ using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using OpenTK.Input; using OpenTK.Input;
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.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.Transformations;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Game.Configuration;
using osu.Game.Overlays.Options; using osu.Game.Overlays.Options;
using osu.Game.Overlays.Options.Audio; using osu.Game.Overlays.Options.Audio;
using osu.Game.Overlays.Options.Gameplay; using osu.Game.Overlays.Options.Gameplay;
@ -120,11 +122,10 @@ namespace osu.Game.Overlays
}; };
} }
protected override void Load(BaseGame game) [BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuGame game)
{ {
base.Load(game); scrollContainer.Padding = new MarginPadding { Top = game?.Toolbar.DrawHeight ?? 0 };
scrollContainer.Padding = new MarginPadding { Top = (game as OsuGame)?.Toolbar.DrawHeight ?? 0 };
} }
protected override void Update() protected override void Update()

View File

@ -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) [BackgroundDependencyLoader]
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);

View File

@ -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) [BackgroundDependencyLoader]
private void load()
{ {
base.Load(game);
DrawableIcon.TextSize *= 1.4f; DrawableIcon.TextSize *= 1.4f;
} }
} }

View File

@ -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) [BackgroundDependencyLoader]
private void load()
{ {
base.Load(game);
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box

View File

@ -121,13 +121,18 @@
<Compile Include="GameModes\Multiplayer\MatchCreate.cs" /> <Compile Include="GameModes\Multiplayer\MatchCreate.cs" />
<Compile Include="GameModes\Multiplayer\MatchSongSelect.cs" /> <Compile Include="GameModes\Multiplayer\MatchSongSelect.cs" />
<Compile Include="GameModes\OsuGameMode.cs" /> <Compile Include="GameModes\OsuGameMode.cs" />
<Compile Include="GameModes\Play\Catch\CatchRuleset.cs" />
<Compile Include="GameModes\Play\Mania\ManiaRuleset.cs" />
<Compile Include="GameModes\Play\ModSelect.cs" /> <Compile Include="GameModes\Play\ModSelect.cs" />
<Compile Include="GameModes\Play\Osu\OsuRuleset.cs" />
<Compile Include="GameModes\Play\Osu\ScoreOverlayOsu.cs" /> <Compile Include="GameModes\Play\Osu\ScoreOverlayOsu.cs" />
<Compile Include="Beatmaps\Drawable\BeatmapGroup.cs" /> <Compile Include="Beatmaps\Drawable\BeatmapGroup.cs" />
<Compile Include="Beatmaps\Drawable\BeatmapPanel.cs" /> <Compile Include="Beatmaps\Drawable\BeatmapPanel.cs" />
<Compile Include="GameModes\Play\Player.cs" /> <Compile Include="GameModes\Play\Player.cs" />
<Compile Include="GameModes\Charts\ChartListing.cs" /> <Compile Include="GameModes\Charts\ChartListing.cs" />
<Compile Include="GameModes\Play\PlayMode.cs" /> <Compile Include="GameModes\Play\PlayMode.cs" />
<Compile Include="GameModes\Play\Ruleset.cs" />
<Compile Include="GameModes\Play\Taiko\TaikoRuleset.cs" />
<Compile Include="GameModes\Ranking\Results.cs" /> <Compile Include="GameModes\Ranking\Results.cs" />
<Compile Include="GameModes\Direct\OnlineListing.cs" /> <Compile Include="GameModes\Direct\OnlineListing.cs" />
<Compile Include="GameModes\Play\PlaySongSelect.cs" /> <Compile Include="GameModes\Play\PlaySongSelect.cs" />
@ -235,6 +240,7 @@
<Compile Include="Overlays\Options\Online\NotificationsOptions.cs" /> <Compile Include="Overlays\Options\Online\NotificationsOptions.cs" />
<Compile Include="Overlays\Options\CheckBoxOption.cs" /> <Compile Include="Overlays\Options\CheckBoxOption.cs" />
<Compile Include="Overlays\Options\SidebarButton.cs" /> <Compile Include="Overlays\Options\SidebarButton.cs" />
<Compile Include="Overlays\Options\TextBoxOption.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj"> <ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">