1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 06:52:56 +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",
"type": "mono",
"request": "launch",
"program": "${workspaceRoot}/osu.Desktop/bin/Debug/osu!.exe",
"program": "${workspaceRoot}/osu.Desktop.VisualTests/bin/Debug/osu!.exe",
"args": [],
"cwd": "${workspaceRoot}",
"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.Display;
using OpenTK;
using osu.Framework.Allocation;
namespace osu.Desktop.VisualTests.Tests
{
@ -34,11 +35,10 @@ namespace osu.Desktop.VisualTests.Tests
private ChannelDisplay channelDisplay;
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load(APIAccess api)
{
base.Load(game);
api = ((OsuGameBase)game).API;
this.api = api;
}
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.Drawable;
using OpenTK;
using osu.Framework.Allocation;
namespace osu.Desktop.VisualTests.Tests
{
@ -20,10 +21,9 @@ namespace osu.Desktop.VisualTests.Tests
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 };
ourClock = new FramedClock(swClock);
}

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.GameModes.Testing;
using osu.Game.Overlays;
@ -24,9 +25,9 @@ namespace osu.Desktop.Tests
protected MusicController mc;
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load()
{
base.Load(game);
ourClock = new FramedClock();
}

View File

@ -11,6 +11,8 @@ using osu.Game.Beatmaps.Objects;
using osu.Game.Beatmaps.Objects.Osu;
using osu.Game.GameModes.Play;
using OpenTK;
using osu.Framework;
using osu.Framework.Allocation;
namespace osu.Desktop.VisualTests.Tests
{

View File

@ -13,14 +13,15 @@ using System.Collections.Generic;
using osu.Game.GameModes.Play;
using SQLiteNetExtensions.Extensions;
using osu.Desktop.Platform;
using osu.Framework.Allocation;
namespace osu.Desktop.VisualTests
{
class VisualTestGame : OsuGameBase
{
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load()
{
base.Load(game);
Add(new TestBrowser());
}
}

View File

@ -29,7 +29,7 @@ namespace osu.Game.Tests.Beatmaps.IO
HeadlessGameHost host = new HeadlessGameHost();
var osu = loadOsu(host);
osu.Beatmaps.Import(osz_path);
osu.Dependencies.Get<BeatmapDatabase>().Import(osz_path);
ensureLoaded(osu);
}
@ -60,7 +60,7 @@ namespace osu.Game.Tests.Beatmaps.IO
Thread.Sleep(1);
//reset beatmap database (sqlite and storage backing)
osu.Beatmaps.Reset();
osu.Dependencies.Get<BeatmapDatabase>().Reset();
return osu;
}
@ -71,7 +71,8 @@ namespace osu.Game.Tests.Beatmaps.IO
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);
};
@ -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.
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);
};
@ -95,7 +97,7 @@ namespace osu.Game.Tests.Beatmaps.IO
@"Beatmaps did not import to the database");
//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());
@ -104,7 +106,7 @@ namespace osu.Game.Tests.Beatmaps.IO
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);
}

View File

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

View File

@ -2,20 +2,28 @@
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Game.Database;
using osu.Game.Graphics;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Game.Database;
using osu.Game.Graphics;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Game.Configuration;
namespace osu.Game.Beatmaps.Drawable
{
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()
{
@ -29,10 +37,33 @@ namespace osu.Game.Beatmaps.Drawable
{
base.Deselected();
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)
{
this.beatmapSet = beatmapSet;
Children = new Framework.Graphics.Drawable[]
{
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,
Children = new[]
{
new SpriteText
title = new SpriteText
{
Font = @"Exo2.0-SemiBoldItalic",
Text = beatmapSet.Metadata.Title ?? beatmapSet.Metadata.TitleUnicode,
Text = beatmapSet.Metadata.Title,
TextSize = 22
},
new SpriteText
artist = new SpriteText
{
Font = @"Exo2.0-MediumItalic",
Text = beatmapSet.Metadata.Artist ?? beatmapSet.Metadata.ArtistUnicode,
Text = beatmapSet.Metadata.Artist,
TextSize = 16
},
new FlowContainer

View File

@ -52,7 +52,7 @@ namespace osu.Game.Beatmaps.Formats
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];
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -179,6 +179,10 @@ namespace osu.Game.Configuration
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)
{
}

View File

@ -13,6 +13,7 @@ using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework;
using System.Threading;
using osu.Framework.Allocation;
namespace osu.Game.GameModes
{
@ -34,9 +35,9 @@ namespace osu.Game.GameModes
BaseGame game;
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load(BaseGame game)
{
base.Load(game);
this.game = game;
}

View File

@ -2,6 +2,7 @@
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework;
using osu.Framework.Allocation;
using osu.Game.Graphics.Background;
namespace osu.Game.GameModes.Backgrounds
@ -15,9 +16,9 @@ namespace osu.Game.GameModes.Backgrounds
this.textureName = textureName;
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load()
{
base.Load(game);
Add(new Background(textureName));
}

View File

@ -2,16 +2,16 @@
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework;
using osu.Framework.Allocation;
using osu.Game.Graphics.Background;
namespace osu.Game.GameModes.Backgrounds
{
public class BackgroundModeDefault : BackgroundMode
{
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load(BaseGame game)
{
base.Load(game);
Add(new Background());
}
}

View File

@ -13,6 +13,7 @@ using osu.Game.GameModes.Backgrounds;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Allocation;
namespace osu.Game.GameModes
{
@ -77,10 +78,9 @@ namespace osu.Game.GameModes
Content.FadeIn(transition_time, EasingTypes.OutExpo);
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load()
{
base.Load(game);
Children = new Drawable[]
{
box = new Box

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Transformations;
using osu.Framework.Input;
using osu.Game.Graphics;
using System;
using osu.Framework.Allocation;
namespace osu.Game.GameModes.Menu
{
@ -48,9 +49,9 @@ namespace osu.Game.GameModes.Menu
AutoSizeAxes = Axes.Both;
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load()
{
base.Load(game);
Alpha = 0;
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.Input;
using osu.Framework;
using osu.Framework.Allocation;
namespace osu.Game.GameModes.Menu
{
@ -53,10 +54,9 @@ namespace osu.Game.GameModes.Menu
RelativeSizeAxes = Axes.Both;
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load()
{
base.Load(game);
Children = new Drawable[]
{
buttonArea = new Container

View File

@ -10,6 +10,8 @@ using osu.Framework.Graphics.Transformations;
using osu.Game.GameModes.Backgrounds;
using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
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 = game.Audio.Track.Get(@"circles");
bgm = audio.Track.Get(@"circles");
bgm.Looping = true;
}

View File

@ -17,6 +17,8 @@ using OpenTK;
using osu.Framework;
using osu.Game.Overlays;
using System.Threading.Tasks;
using osu.Game.Configuration;
using osu.Framework.Allocation;
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);
OsuGame osu = (OsuGame)game;
buttons.OnSettings = osu.Options.ToggleVisibility;
buttons.OnSettings = game.ToggleOptions;
}
protected override void LoadComplete()

View File

@ -9,6 +9,8 @@ using osu.Framework.Graphics.Transformations;
using osu.Framework.Input;
using osu.Framework;
using OpenTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Textures;
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 = game.Textures.Get(@"Menu/logo");
ripple.Texture = game.Textures.Get(@"Menu/logo");
logo.Texture = textures.Get(@"Menu/logo");
ripple.Texture = textures.Get(@"Menu/logo");
}
protected override void LoadComplete()

View File

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

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Allocation;
namespace osu.Game.GameModes.Play.Catch
{
@ -20,10 +21,9 @@ namespace osu.Game.GameModes.Play.Catch
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 });
}
}

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.Text;
using System.Threading.Tasks;
using osu.Framework.Allocation;
namespace osu.Game.GameModes.Play
{
@ -120,13 +121,12 @@ namespace osu.Game.GameModes.Play
TextSize = 80;
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load()
{
base.Load(game);
DisplayedCountSpriteText.Text = FormatCount(Count);
DisplayedCountSpriteText.Anchor = this.Anchor;
DisplayedCountSpriteText.Origin = this.Origin;
DisplayedCountSpriteText.Anchor = Anchor;
DisplayedCountSpriteText.Origin = Origin;
StopRolling();
}

View File

@ -8,6 +8,7 @@ using osu.Game.Beatmaps.Objects;
using osu.Framework;
using System;
using System.Linq;
using osu.Framework.Allocation;
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 override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load()
{
base.Load(game);
RelativeSizeAxes = Axes.Both;
Children = new Drawable[]

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Allocation;
namespace osu.Game.GameModes.Play.Mania
{
@ -23,11 +24,10 @@ namespace osu.Game.GameModes.Play.Mania
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++)
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.Text;
using System.Threading.Tasks;
using osu.Framework.Allocation;
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 = this.Origin;
PopOutSpriteText.Anchor = this.Anchor;
PopOutSpriteText.Origin = Origin;
PopOutSpriteText.Anchor = Anchor;
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.Game.Beatmaps;
using osu.Framework.GameModes;
using osu.Framework.Allocation;
using osu.Framework.Audio;
namespace osu.Game.GameModes.Play
{
@ -113,35 +115,34 @@ namespace osu.Game.GameModes.Play
Width = 100,
Text = "Play",
Colour = new Color4(238, 51, 153, 255),
Action = () => Push(new Player {
Action = () => Push(new Player
{
BeatmapInfo = selectedBeatmapGroup.SelectedPanel.Beatmap,
PreferredPlayMode = playMode.Value
}),
})
},
}
}
};
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader(permitNulls: true)]
private void load(BeatmapDatabase beatmaps, AudioManager audio, OsuGame game)
{
base.Load(game);
OsuGame osuGame = game as OsuGame;
if (osuGame != null)
if (game != null)
{
playMode = osuGame.PlayMode;
playMode = game.PlayMode;
playMode.ValueChanged += playMode_ValueChanged;
// Temporary:
scrollContainer.Padding = new MarginPadding { Top = ToolbarPadding };
}
if (database == null)
database = (game as OsuGameBase).Beatmaps;
database = beatmaps;
database.BeatmapSetAdded += s => Schedule(() => addBeatmapSet(s));
trackManager = game.Audio.Track;
trackManager = audio.Track;
Task.Factory.StartNew(addBeatmapSets);
}

View File

@ -13,6 +13,14 @@ using osu.Game.Database;
using osu.Framework.Timing;
using osu.Framework.Audio.Track;
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
{
@ -26,21 +34,53 @@ namespace osu.Game.GameModes.Play
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;
protected override IFrameBasedClock Clock => playerClock;
private InterpolatingFramedClock playerClock;
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
{
if (Beatmap == null)
Beatmap = ((OsuGame)game).Beatmaps.GetWorkingBeatmap(BeatmapInfo);
Beatmap = beatmaps.GetWorkingBeatmap(BeatmapInfo);
}
catch
{
@ -53,7 +93,7 @@ namespace osu.Game.GameModes.Play
if (track != null)
{
game.Audio.Track.SetExclusive(track);
audio.Track.SetExclusive(track);
sourceClock = track;
}
@ -80,49 +120,11 @@ namespace osu.Game.GameModes.Play
PlayMode usablePlayMode = beatmap.BeatmapInfo?.Mode > PlayMode.Osu ? beatmap.BeatmapInfo.Mode : PreferredPlayMode;
switch (usablePlayMode)
{
default:
scoreOverlay = new ScoreOverlayOsu();
Ruleset = Ruleset.GetRuleset(usablePlayMode);
hitRenderer = new OsuHitRenderer
{
Objects = beatmap.HitObjects,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
};
break;
case PlayMode.Taiko:
scoreOverlay = new ScoreOverlayOsu();
scoreOverlay = Ruleset.CreateScoreOverlay();
hitRenderer = new TaikoHitRenderer
{
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 = Ruleset.CreateHitRendererWith(beatmap.HitObjects);
hitRenderer.OnHit += delegate (HitObject h) { scoreOverlay.OnHit(h); };
hitRenderer.OnMiss += delegate (HitObject h) { scoreOverlay.OnMiss(h); };
@ -132,7 +134,14 @@ namespace osu.Game.GameModes.Play
Children = new Drawable[]
{
hitRenderer,
inputManager = new PlayerInputManager(game.Host)
{
PassThrough = false,
Children = new Drawable[]
{
hitRenderer,
}
},
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.Graphics;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Textures;
namespace osu.Game.GameModes.Play.Taiko
{
@ -20,15 +22,14 @@ namespace osu.Game.GameModes.Play.Taiko
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 Sprite
{
Texture = game.Textures.Get(@"Menu/logo"),
Texture = textures.Get(@"Menu/logo"),
Origin = Anchor.Centre,
Scale = new Vector2(0.2f),
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;
using System.Threading.Tasks;
using osu.Framework.Graphics.Textures;
using osu.Framework.Allocation;
namespace osu.Game.Graphics.Background
{
@ -26,13 +28,12 @@ namespace osu.Game.Graphics.Background
Depth = float.MinValue;
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
base.Load(game);
Add(BackgroundSprite = new Sprite
{
Texture = game.Textures.Get(textureName),
Texture = textures.Get(textureName),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Colour = Color4.DarkGray

View File

@ -3,6 +3,7 @@ using osu.Framework.Graphics;
using osu.Framework.Input;
using OpenTK;
using osu.Framework;
using osu.Framework.Allocation;
namespace osu.Game.Graphics.Containers
{
@ -15,7 +16,7 @@ namespace osu.Game.Graphics.Containers
public ParallaxContainer()
{
RelativeSizeAxes = Axes.Both;
AddInternal(content = new Container()
AddInternal(content = new Container
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
@ -27,11 +28,6 @@ namespace osu.Game.Graphics.Containers
protected override Container<Drawable> Content => content;
protected override void Load(BaseGame game)
{
base.Load(game);
}
protected override bool OnMouseMove(InputState state)
{
content.Position = (state.Mouse.Position - DrawSize / 2) * ParallaxAmount;
@ -44,4 +40,4 @@ namespace osu.Game.Graphics.Containers
content.Scale = new Vector2(1 + ParallaxAmount);
}
}
}
}

View File

@ -2,10 +2,12 @@
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Graphics.Transformations;
using osu.Framework.Input;
@ -37,15 +39,14 @@ namespace osu.Game.Graphics.Cursor
AutoSizeAxes = Axes.Both;
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
base.Load(game);
Children = new Drawable[]
{
new Sprite
{
Texture = game.Textures.Get(@"Cursor/cursor")
Texture = textures.Get(@"Cursor/cursor")
}
};
}

View File

@ -4,9 +4,11 @@
using OpenTK;
using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
namespace osu.Game.Graphics.UserInterface
{
@ -59,20 +61,20 @@ namespace osu.Game.Graphics.UserInterface
Name = name;
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
base.Load(game);
Children = new Drawable[]
{
buttonSprite = new Sprite
{
Texture = game.Textures.Get(@"KeyCounter/key-up"),
Texture = textures.Get(@"KeyCounter/key-up"),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
glowSprite = new Sprite
{
Texture = game.Textures.Get(@"KeyCounter/key-glow"),
Texture = textures.Get(@"KeyCounter/key-glow"),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Alpha = 0

View File

@ -12,6 +12,7 @@ using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework.Allocation;
namespace osu.Game.Graphics.UserInterface
{
@ -119,15 +120,14 @@ namespace osu.Game.Graphics.UserInterface
AutoSizeAxes = Axes.Both;
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load()
{
base.Load(game);
DisplayedCount = Count;
DisplayedCountSpriteText.Text = FormatCount(count);
DisplayedCountSpriteText.Anchor = this.Anchor;
DisplayedCountSpriteText.Origin = this.Origin;
DisplayedCountSpriteText.Anchor = Anchor;
DisplayedCountSpriteText.Origin = Origin;
}
protected override void LoadComplete()

View File

@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework.Allocation;
namespace osu.Game.Graphics.UserInterface
{
@ -109,10 +110,9 @@ namespace osu.Game.Graphics.UserInterface
};
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load()
{
base.Load(game);
starContainer.Width = MaxStars * StarSize + Math.Max(MaxStars - 1, 0) * StarSpacing;
starContainer.Height = StarSize;

View File

@ -6,6 +6,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Threading;
using OpenTK;
using osu.Framework.Allocation;
namespace osu.Game.Graphics.UserInterface.Volume
{
@ -32,7 +33,8 @@ namespace osu.Game.Graphics.UserInterface.Volume
Origin = Anchor.BottomRight;
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load()
{
VolumeGlobal.ValueChanged += volumeChanged;
VolumeSample.ValueChanged += volumeChanged;
@ -55,8 +57,6 @@ namespace osu.Game.Graphics.UserInterface.Volume
}
}
};
base.Load(game);
}
protected override void Dispose(bool isDisposing)

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics.Transformations;
using osu.Game.Online.Chat.Display.osu.Online.Social;
using OpenTK;
using osu.Framework;
using osu.Framework.Allocation;
namespace osu.Game.Online.Chat.Display
{
@ -59,9 +60,9 @@ namespace osu.Game.Online.Chat.Display
channel.NewMessagesArrived -= newMessages;
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load()
{
base.Load(game);
newMessages(channel.Messages);
}

View File

@ -10,6 +10,7 @@ using OpenTK;
using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Allocation;
namespace osu.Game.Online.Chat.Display
{
@ -27,10 +28,9 @@ namespace osu.Game.Online.Chat.Display
const float padding = 200;
const float text_size = 20;
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load()
{
base.Load(game);
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;

View File

@ -20,6 +20,8 @@ using OpenTK.Input;
using osu.Framework.Logging;
using osu.Game.GameModes;
using osu.Game.Graphics.UserInterface.Volume;
using osu.Game.Database;
using osu.Framework.Allocation;
namespace osu.Game
{
@ -56,7 +58,10 @@ namespace osu.Game
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)
{
@ -64,10 +69,10 @@ namespace osu.Game
Environment.Exit(0);
}
base.Load(game);
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.
Audio.Volume.Weld(Config.GetBindable<double>(OsuConfig.VolumeUniversal));
@ -76,6 +81,7 @@ namespace osu.Game
PlayMode = Config.GetBindable<PlayMode>(OsuConfig.PlayMode);
//todo: move to constructor or LoadComplete.
Add(new Drawable[] {
new VolumeControlReceptor
{
@ -102,7 +108,7 @@ namespace osu.Game
(modeStack = new Intro
{
Beatmap = Beatmap
}).Preload(game, d =>
}).Preload(this, d =>
{
mainContent.Add(d);
@ -112,9 +118,9 @@ namespace osu.Game
});
//overlay elements
(chat = new ChatConsole(API) { Depth = 0 }).Preload(game, overlayContent.Add);
(musicController = new MusicController()).Preload(game, overlayContent.Add);
(Options = new OptionsOverlay { Depth = 1 }).Preload(game, overlayContent.Add);
(chat = new ChatConsole(API) { Depth = 0 }).Preload(this, overlayContent.Add);
(musicController = new MusicController()).Preload(this, overlayContent.Add);
(Options = new OptionsOverlay { Depth = 1 }).Preload(this, overlayContent.Add);
(Toolbar = new Toolbar
{
Depth = 2,
@ -122,7 +128,7 @@ namespace osu.Game
OnSettings = Options.ToggleVisibility,
OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; },
OnMusicController = musicController.ToggleVisibility
}).Preload(game, t =>
}).Preload(this, t =>
{
PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); };
PlayMode.TriggerChange();

View File

@ -1,5 +1,6 @@
using System;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.GameModes;
using osu.Framework.Graphics;
@ -23,7 +24,6 @@ namespace osu.Game
public class OsuGameBase : BaseGame
{
internal OsuConfigManager Config;
public BeatmapDatabase Beatmaps { get; private set; }
protected override string MainResourceFile => @"osu.Game.Resources.dll";
@ -37,31 +37,19 @@ namespace osu.Game
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)
{
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load()
{
base.Load(game);
OszArchiveReader.Register();
Beatmaps = new BeatmapDatabase(Host.Storage, Host);
Dependencies.Cache(this);
Dependencies.Cache(new OsuConfigManager(Host.Storage));
Dependencies.Cache(new BeatmapDatabase(Host.Storage, Host));
//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/osuFont"));
@ -77,13 +65,24 @@ namespace osu.Game
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-MediumItalic"));
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Black"));
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BlackItalic"));
AddInternal(ratioContainer = new RatioAdjust());
API = new APIAccess()
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),
Password = Config.Get<string>(OsuConfig.Password),
Token = Config.Get<string>(OsuConfig.Token)
};
});
}
public override void SetHost(BasicGameHost host)

View File

@ -7,6 +7,7 @@ using System.Linq;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
@ -55,9 +56,9 @@ namespace osu.Game.Overlays
});
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load()
{
base.Load(game);
initializeChannels();
}

View File

@ -7,6 +7,8 @@ using System.Threading.Tasks;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
@ -17,6 +19,7 @@ using osu.Framework.Graphics.Transformations;
using osu.Framework.Input;
using osu.Framework.MathUtils;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Database;
using osu.Game.Graphics;
@ -24,7 +27,9 @@ namespace osu.Game.Overlays
{
public class MusicController : OverlayContainer
{
private Sprite backgroundSprite;
private static readonly Vector2 start_position = new Vector2(10, 60);
private MusicControllerBackground backgroundSprite;
private DragBar progress;
private TextAwesome playButton, listButton;
private SpriteText title, artist;
@ -36,27 +41,30 @@ namespace osu.Game.Overlays
private int playHistoryIndex = -1;
private TrackManager trackManager;
private BeatmapDatabase database;
private Bindable<WorkingBeatmap> beatmapSource;
private Bindable<bool> preferUnicode;
private OsuConfigManager config;
private WorkingBeatmap current;
private BeatmapDatabase beatmaps;
public MusicController(BeatmapDatabase db = null)
public MusicController()
{
database = db;
Width = 400;
Height = 130;
CornerRadius = 5;
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Colour = new Color4(0, 0, 0, 40),
Radius = 5,
};
Masking = true;
Anchor = Anchor.TopRight;//placeholder
Origin = Anchor.TopRight;
Position = new Vector2(10, 60);
Position = start_position;
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = new Color4(0, 0, 0, 127)
},
title = new SpriteText
{
Origin = Anchor.BottomCentre,
@ -77,14 +85,6 @@ namespace osu.Game.Overlays
Text = @"Nothing to play",
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
{
AutoSizeAxes = Axes.Both,
@ -174,21 +174,38 @@ namespace osu.Game.Overlays
};
}
protected override void Load(BaseGame game)
protected override bool OnDragStart(InputState state) => true;
protected override bool OnDrag(InputState state)
{
base.Load(game);
var osuGame = game as OsuGameBase;
Vector2 change = (state.Mouse.Position - state.Mouse.PositionMouseDown.Value);
change.X = -change.X;
if (osuGame != null)
{
if (database == null) database = osuGame.Beatmaps;
trackManager = osuGame.Audio.Track;
}
change *= (float)Math.Pow(change.Length, 0.7f) / change.Length;
beatmapSource = osuGame?.Beatmap ?? new Bindable<WorkingBeatmap>();
playList = database.GetAllWithChildren<BeatmapSetInfo>();
MoveTo(start_position + change);
return base.OnDrag(state);
}
backgroundSprite = getScaledSprite(fallbackTexture = game.Textures.Get(@"Backgrounds/bg4"));
protected override bool OnDragEnd(InputState state)
{
MoveTo(start_position, 800, EasingTypes.OutElastic);
return base.OnDragEnd(state);
}
[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);
}
@ -210,6 +227,11 @@ namespace osu.Game.Overlays
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)
{
if (beatmapSource.Value == current) return;
@ -269,7 +291,7 @@ namespace osu.Game.Overlays
private void play(BeatmapInfo info, bool isNext)
{
current = database.GetWorkingBeatmap(info, current);
current = beatmaps.GetWorkingBeatmap(info, current);
Task.Run(() =>
{
trackManager.SetExclusive(current.Track);
@ -281,11 +303,15 @@ namespace osu.Game.Overlays
private void updateDisplay(WorkingBeatmap beatmap, bool? isNext)
{
BeatmapMetadata metadata = beatmap.Beatmap.Metadata;
title.Text = metadata.TitleUnicode ?? metadata.Title;
artist.Text = metadata.ArtistUnicode ?? metadata.Artist;
if (beatmap.Beatmap == null)
//todo: we may need to display some default text here (currently in the constructor).
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);
@ -306,34 +332,61 @@ namespace osu.Game.Overlays
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)
{
current?.Track?.Seek(current.Track.Length * position);
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 OnMouseDown(InputState state, MouseDownEventArgs args) => true;
protected override bool OnDragStart(InputState state) => true;
//placeholder for toggling
protected override void PopIn() => FadeIn(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;
namespace osu.Game.Overlays.Options.Audio
@ -12,7 +13,7 @@ namespace osu.Game.Overlays.Options.Audio
{
Children = new Drawable[]
{
new AudioDevicesOptions(),
new AudioDevicesOptions { Alpha = RuntimeInfo.IsWindows ? 1 : 0 },
new VolumeOptions(),
new OffsetAdjustmentOptions(),
};

View File

@ -1,36 +1,36 @@
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration;
namespace osu.Game.Overlays.Options.Audio
{
public class VolumeOptions : OptionsSubsection
{
namespace osu.Game.Overlays.Options.Audio
{
public class VolumeOptions : OptionsSubsection
{
protected override string Header => "Volume";
private CheckBoxOption ignoreHitsounds;
public VolumeOptions()
{
Children = new Drawable[]
{
new SpriteText { Text = "Master: TODO slider" },
new SpriteText { Text = "Music: TODO slider" },
new SpriteText { Text = "Effect: TODO slider" },
ignoreHitsounds = new CheckBoxOption { LabelText = "Ignore beatmap hitsounds" }
};
private CheckBoxOption ignoreHitsounds;
public VolumeOptions()
{
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
Children = new Drawable[]
{
ignoreHitsounds.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.IgnoreBeatmapSamples);
}
}
}
new SpriteText { Text = "Master: TODO slider" },
new SpriteText { Text = "Music: TODO slider" },
new SpriteText { Text = "Effect: TODO slider" },
new CheckBoxOption
{
LabelText = "Ignore beatmap hitsounds",
Bindable = config.GetBindable<bool>(OsuConfig.IgnoreBeatmapSamples)
}
};
}
}
}

View File

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

View File

@ -1,18 +1,18 @@
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration;
namespace osu.Game.Overlays.Options.Gameplay
{
public class GeneralGameplayOptions : OptionsSubsection
{
protected override string Header => "General";
private CheckBoxOption keyOverlay, hiddenApproachCircle, scaleManiaScroll, rememberManiaScroll;
protected override string Header => "General";
public GeneralGameplayOptions()
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
@ -20,24 +20,27 @@ namespace osu.Game.Overlays.Options.Gameplay
new SpriteText { Text = "Progress display: TODO dropdown" },
new SpriteText { Text = "Score meter type: TODO dropdown" },
new SpriteText { Text = "Score meter size: TODO slider" },
keyOverlay = new CheckBoxOption { LabelText = "Always show key overlay" },
hiddenApproachCircle = new CheckBoxOption { LabelText = "Show approach circle on first \"Hidden\" object" },
scaleManiaScroll = new CheckBoxOption { LabelText = "Scale osu!mania scroll speed with BPM" },
rememberManiaScroll = new CheckBoxOption { LabelText = "Remember osu!mania scroll speed per beatmap" },
new CheckBoxOption
{
LabelText = "Always show key overlay",
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,34 +1,32 @@
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Allocation;
using osu.Game.Configuration;
namespace osu.Game.Overlays.Options.General
{
public class LanguageOptions : OptionsSubsection
{
namespace osu.Game.Overlays.Options.General
{
public class LanguageOptions : OptionsSubsection
{
protected override string Header => "Language";
private CheckBoxOption showUnicode, altChatFont;
public LanguageOptions()
{
Children = new Drawable[]
{
new SpriteText { Text = "TODO: Dropdown" },
showUnicode = new CheckBoxOption { LabelText = "Prefer metadata in original language" },
altChatFont = new CheckBoxOption { LabelText = "Use alternative font for chat display" },
};
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
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);
}
}
}
}
Children = new Drawable[]
{
new SpriteText { Text = "TODO: Dropdown" },
new CheckBoxOption
{
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)
},
};
}
}
}

View File

@ -1,12 +1,13 @@
using OpenTK;
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using OpenTK;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
namespace osu.Game.Overlays.Options.General
{
public class LoginOptions : OptionsSubsection
@ -27,16 +28,15 @@ namespace osu.Game.Overlays.Options.General
};
}
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame == null)
[BackgroundDependencyLoader(permitNulls: true)]
private void load(APIAccess api)
{
if (api == null)
return;
loginForm.Children = new Drawable[]
{
new LoginForm(osuGame.API)
};
new LoginForm(api)
};
}
class LoginForm : FlowContainer
@ -63,4 +63,4 @@ namespace osu.Game.Overlays.Options.General
}
}
}
}
}

View File

@ -1,36 +1,31 @@
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Platform;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options.General
{
public class UpdateOptions : OptionsSubsection
{
private BasicStorage storage;
protected override string Header => "Updates";
public UpdateOptions()
{
Children = new Drawable[]
{
new SpriteText { Text = "TODO: Dropdown" },
new SpriteText { Text = "Your osu! is up to date" }, // TODO: map this to reality
new OsuButton
{
RelativeSizeAxes = Axes.X,
Text = "Open osu! folder",
Action = () => storage?.OpenInNativeExplorer(),
}
};
}
protected override void Load(BaseGame game)
namespace osu.Game.Overlays.Options.General
{
public class UpdateOptions : OptionsSubsection
{
protected override string Header => "Updates";
[BackgroundDependencyLoader]
private void load(BasicStorage storage)
{
base.Load(game);
this.storage = game.Host.Storage;
}
}
}
Children = new Drawable[]
{
new SpriteText { Text = "TODO: Dropdown" },
new SpriteText { Text = "Your osu! is up to date" }, // TODO: map this to reality
new OsuButton
{
RelativeSizeAxes = Axes.X,
Text = "Open osu! folder",
Action = () => storage.OpenInNativeExplorer(),
}
};
}
}
}

View File

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

View File

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

View File

@ -1,39 +1,45 @@
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration;
namespace osu.Game.Overlays.Options.Graphics
{
public class MainMenuOptions : OptionsSubsection
{
namespace osu.Game.Overlays.Options.Graphics
{
public class MainMenuOptions : OptionsSubsection
{
protected override string Header => "Main Menu";
private CheckBoxOption snow, parallax, tips, voices, musicTheme;
public MainMenuOptions()
{
Children = new[]
{
snow = new CheckBoxOption { LabelText = "Snow" },
parallax = new CheckBoxOption { LabelText = "Parallax" },
tips = new CheckBoxOption { LabelText = "Menu tips" },
voices = new CheckBoxOption { LabelText = "Interface voices" },
musicTheme = new CheckBoxOption { LabelText = "osu! music theme" },
};
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
Children = new[]
{
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);
}
}
}
new CheckBoxOption
{
LabelText = "Snow",
Bindable = config.GetBindable<bool>(OsuConfig.MenuSnow)
},
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)
},
};
}
}
}

View File

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

View File

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

View File

@ -1,43 +1,55 @@
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration;
namespace osu.Game.Overlays.Options.Input
{
public class MouseOptions : OptionsSubsection
{
namespace osu.Game.Overlays.Options.Input
{
public class MouseOptions : OptionsSubsection
{
protected override string Header => "Mouse";
private CheckBoxOption rawInput, mapRawInput, disableWheel, disableButtons, enableRipples;
public MouseOptions()
{
Children = new Drawable[]
{
new SpriteText { Text = "Sensitivity: TODO slider" },
rawInput = new CheckBoxOption { LabelText = "Raw input" },
mapRawInput = new CheckBoxOption { LabelText = "Map absolute raw input to the osu! window" },
new SpriteText { Text = "Confine mouse cursor: TODO dropdown" },
disableWheel = new CheckBoxOption { LabelText = "Disable mouse wheel in play mode" },
disableButtons = new CheckBoxOption { LabelText = "Disable mouse buttons in play mode" },
enableRipples = new CheckBoxOption { LabelText = "Cursor ripples" },
};
private CheckBoxOption rawInput, mapRawInput, disableWheel, disableButtons, enableRipples;
public MouseOptions()
{
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
Children = new Drawable[]
{
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);
}
}
}
new SpriteText { Text = "Sensitivity: TODO slider" },
new CheckBoxOption
{
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 CheckBoxOption
{
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)
},
};
}
}
}

View File

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

View File

@ -1,43 +1,56 @@
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration;
namespace osu.Game.Overlays.Options.Online
{
public class InGameChatOptions : OptionsSubsection
{
protected override string Header => "In-game Chat";
private CheckBoxOption filterWords, filterForeign, logPMs, blockPMs;
private TextBoxOption chatIgnoreList;
private TextBoxOption chatHighlightWords;
protected override string Header => "In-game Chat";
public InGameChatOptions()
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
filterWords = new CheckBoxOption { LabelText = "Filter offensive words" },
filterForeign = new CheckBoxOption { LabelText = "Filter foreign characters" },
logPMs = new CheckBoxOption { LabelText = "Log private messages" },
blockPMs = new CheckBoxOption { LabelText = "Block private messages from non-friends" },
new CheckBoxOption
{
LabelText = "Filter offensive words",
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 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 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.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration;
@ -9,35 +10,42 @@ namespace osu.Game.Overlays.Options.Online
{
protected override string Header => "Notifications";
private CheckBoxOption chatTicker, notifyMention, notifyChat, audibleNotification,
notificationsDuringGameplay, notifyFriendStatus;
public NotificationsOptions()
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
chatTicker = new CheckBoxOption { LabelText = "Enable chat ticker" },
notifyMention = new CheckBoxOption { LabelText = "Show a notification popup when someone says your name" },
notifyChat = new CheckBoxOption { LabelText = "Show chat message notifications" },
audibleNotification = new CheckBoxOption { LabelText = "Play a sound when someone says your name" },
notificationsDuringGameplay = new CheckBoxOption { LabelText = "Show notification popups instantly during gameplay" },
notifyFriendStatus = new CheckBoxOption { LabelText = "Show notification popups when friends change status" },
new CheckBoxOption
{
LabelText = "Enable chat ticker",
Bindable = config.GetBindable<bool>(OsuConfig.Ticker)
},
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,38 +1,41 @@
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration;
namespace osu.Game.Overlays.Options.Online
{
public class OnlineIntegrationOptions : OptionsSubsection
{
namespace osu.Game.Overlays.Options.Online
{
public class OnlineIntegrationOptions : OptionsSubsection
{
protected override string Header => "Integration";
private CheckBoxOption yahoo, msn, autoDirect, noVideo;
public OnlineIntegrationOptions()
{
Children = new Drawable[]
{
yahoo = new CheckBoxOption { LabelText = "Integrate with Yahoo! status display" },
msn = new CheckBoxOption { LabelText = "Integrate with MSN Live status display" },
autoDirect = new CheckBoxOption { LabelText = "Automatically start osu!direct downloads" },
noVideo = new CheckBoxOption { LabelText = "Prefer no-video downloads" },
};
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
Children = new Drawable[]
{
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);
}
}
}
new CheckBoxOption
{
LabelText = "Integrate with Yahoo! status display",
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)
},
};
}
}
}

View File

@ -1,4 +1,5 @@
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration;
@ -8,27 +9,23 @@ namespace osu.Game.Overlays.Options.Online
public class PrivacyOptions : OptionsSubsection
{
protected override string Header => "Privacy";
private CheckBoxOption shareCity, allowInvites;
public PrivacyOptions()
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
shareCity = new CheckBoxOption { LabelText = "Share your city location with others" },
allowInvites = new CheckBoxOption { LabelText = "Allow multiplayer game invites from all users" },
new CheckBoxOption
{
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,22 +1,22 @@
using OpenTK;
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options
{
public class SkinSection : OptionsSection
{
public override string Header => "Skin";
public override FontAwesome Icon => FontAwesome.fa_paint_brush;
private CheckBoxOption ignoreSkins, useSkinSoundSamples, useTaikoSkin, useSkinCursor, autoCursorSize;
public SkinSection()
public override FontAwesome Icon => FontAwesome.fa_paint_brush;
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
content.Spacing = new Vector2(0, 5);
Children = new Drawable[]
@ -38,27 +38,33 @@ namespace osu.Game.Overlays.Options
RelativeSizeAxes = Axes.X,
Text = "Export as .osk",
},
ignoreSkins = new CheckBoxOption { LabelText = "Ignore all beatmap skins" },
useSkinSoundSamples = new CheckBoxOption { LabelText = "Use skin's sound samples" },
useTaikoSkin = new CheckBoxOption { LabelText = "Use Taiko skin for Taiko mode" },
useSkinCursor = new CheckBoxOption { LabelText = "Always use skin cursor" },
new CheckBoxOption
{
LabelText = "Ignore all beatmap skins",
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" },
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.Input;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using osu.Framework.Input;
using osu.Game.Configuration;
using osu.Game.Overlays.Options;
using osu.Game.Overlays.Options.Audio;
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 as OsuGame)?.Toolbar.DrawHeight ?? 0 };
scrollContainer.Padding = new MarginPadding { Top = game?.Toolbar.DrawHeight ?? 0 };
}
protected override void Update()

View File

@ -12,6 +12,7 @@ using osu.Game.Configuration;
using osu.Game.GameModes.Play;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Allocation;
namespace osu.Game.Overlays
{
@ -111,10 +112,10 @@ namespace osu.Game.Overlays
Size = new Vector2(1, height);
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
base.Load(game);
userButton.Text = ((OsuGame)game).Config.Get<string>(OsuConfig.Username);
userButton.Text = config.Get<string>(OsuConfig.Username);
}
public void SetGameMode(PlayMode mode) => modeSelector.SetGameMode(mode);

View File

@ -6,6 +6,7 @@ using osu.Game.GameModes.Play;
using osu.Game.Graphics;
using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Allocation;
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;
}
}

View File

@ -12,6 +12,7 @@ using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Caching;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Allocation;
namespace osu.Game.Overlays
{
@ -30,10 +31,9 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.Y;
}
protected override void Load(BaseGame game)
[BackgroundDependencyLoader]
private void load()
{
base.Load(game);
Children = new Drawable[]
{
new Box

View File

@ -121,13 +121,18 @@
<Compile Include="GameModes\Multiplayer\MatchCreate.cs" />
<Compile Include="GameModes\Multiplayer\MatchSongSelect.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\Osu\OsuRuleset.cs" />
<Compile Include="GameModes\Play\Osu\ScoreOverlayOsu.cs" />
<Compile Include="Beatmaps\Drawable\BeatmapGroup.cs" />
<Compile Include="Beatmaps\Drawable\BeatmapPanel.cs" />
<Compile Include="GameModes\Play\Player.cs" />
<Compile Include="GameModes\Charts\ChartListing.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\Direct\OnlineListing.cs" />
<Compile Include="GameModes\Play\PlaySongSelect.cs" />
@ -235,6 +240,7 @@
<Compile Include="Overlays\Options\Online\NotificationsOptions.cs" />
<Compile Include="Overlays\Options\CheckBoxOption.cs" />
<Compile Include="Overlays\Options\SidebarButton.cs" />
<Compile Include="Overlays\Options\TextBoxOption.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">