mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 05:22:54 +08:00
Merge branch 'refs/heads/master' into dependency-injection
# Conflicts: # osu-framework # osu.Game/GameModes/OsuGameMode.cs # osu.Game/GameModes/Play/Player.cs # osu.Game/OsuGame.cs # osu.Game/Overlays/MusicController.cs # osu.Game/Overlays/Options/EditorSection.cs # osu.Game/Overlays/Options/Input/MouseOptions.cs # osu.Game/Overlays/Options/Online/InGameChatOptions.cs # osu.Game/Overlays/Options/SkinSection.cs
This commit is contained in:
commit
cc0f61f545
@ -1 +1 @@
|
||||
Subproject commit aa01720fe9eb6e3b30a4455298a1c6eca7fb7680
|
||||
Subproject commit 5c0e4edbbcdc26ab56c70676856477cd21e7afdc
|
@ -35,8 +35,8 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
private ChannelDisplay channelDisplay;
|
||||
|
||||
[Initializer]
|
||||
private void Load(APIAccess api)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(APIAccess api)
|
||||
{
|
||||
this.api = api;
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
protected override IFrameBasedClock Clock => ourClock;
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
var swClock = new StopwatchClock(true) { Rate = 1 };
|
||||
ourClock = new FramedClock(swClock);
|
||||
|
@ -25,8 +25,8 @@ namespace osu.Desktop.Tests
|
||||
|
||||
protected MusicController mc;
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
ourClock = new FramedClock();
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ namespace osu.Desktop.VisualTests
|
||||
{
|
||||
class VisualTestGame : OsuGameBase
|
||||
{
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Add(new TestBrowser());
|
||||
}
|
||||
|
@ -100,8 +100,8 @@ namespace osu.Game.Beatmaps.Drawable
|
||||
};
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(BaseGame game)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BaseGame game)
|
||||
{
|
||||
BeatmapPanels = beatmapSet.Beatmaps.Select(b => new BeatmapPanel(b)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -30,8 +30,8 @@ namespace osu.Game.Beatmaps.Objects.Catch.Drawable
|
||||
Position = new Vector2(h.Position, -0.1f);
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(TextureStore textures)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
Texture = textures.Get(@"Menu/logo");
|
||||
|
||||
|
@ -22,8 +22,8 @@ namespace osu.Game.Beatmaps.Objects.Mania.Drawable
|
||||
Scale = new Vector2(0.1f);
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(TextureStore textures)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
Texture = textures.Get(@"Menu/logo");
|
||||
|
||||
|
@ -64,8 +64,8 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
||||
Size = circle.DrawSize;
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(BaseGame game)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BaseGame game)
|
||||
{
|
||||
approachCircle.Texture = game.Textures.Get(@"Play/osu/approachcircle@2x");
|
||||
}
|
||||
@ -149,8 +149,8 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
||||
};
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(TextureStore textures)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
number.Texture = textures.Get(@"Play/osu/number@2x");
|
||||
}
|
||||
@ -177,8 +177,8 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
||||
};
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(TextureStore textures)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
layer.Texture = textures.Get(@"Play/osu/ring-glow@2x");
|
||||
}
|
||||
@ -203,8 +203,8 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
||||
};
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(TextureStore textures)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
ring.Texture = textures.Get(@"Play/osu/ring@2x");
|
||||
}
|
||||
@ -289,8 +289,8 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
||||
};
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(TextureStore textures)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
disc.Texture = textures.Get(@"Play/osu/disc@2x");
|
||||
}
|
||||
@ -306,8 +306,8 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
||||
{
|
||||
private Texture tex;
|
||||
|
||||
[Initializer]
|
||||
private void Load(TextureStore textures)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
tex = textures.Get(@"Play/osu/triangle@2x");
|
||||
|
||||
|
@ -25,8 +25,8 @@ namespace osu.Game.Beatmaps.Objects.Taiko.Drawable
|
||||
Position = new Vector2(1.1f, 0.5f);
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(TextureStore textures)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
Texture = textures.Get(@"Menu/logo");
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ namespace osu.Game.GameModes
|
||||
|
||||
BaseGame game;
|
||||
|
||||
[Initializer]
|
||||
private void Load(BaseGame game)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BaseGame game)
|
||||
{
|
||||
this.game = game;
|
||||
}
|
||||
|
@ -16,8 +16,8 @@ namespace osu.Game.GameModes.Backgrounds
|
||||
this.textureName = textureName;
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Add(new Background(textureName));
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ namespace osu.Game.GameModes.Backgrounds
|
||||
{
|
||||
public class BackgroundModeDefault : BackgroundMode
|
||||
{
|
||||
[Initializer]
|
||||
private void Load(BaseGame game)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BaseGame game)
|
||||
{
|
||||
Add(new Background());
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ namespace osu.Game.GameModes
|
||||
Content.FadeIn(transition_time, EasingTypes.OutExpo);
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -49,8 +49,8 @@ namespace osu.Game.GameModes.Menu
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Alpha = 0;
|
||||
|
||||
|
@ -54,8 +54,8 @@ namespace osu.Game.GameModes.Menu
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -28,6 +28,8 @@ namespace osu.Game.GameModes.Menu
|
||||
private AudioSample welcome;
|
||||
private AudioTrack bgm;
|
||||
|
||||
internal override bool ShowToolbar => (ParentGameMode as OsuGameMode)?.ShowToolbar ?? false;
|
||||
|
||||
protected override BackgroundMode CreateBackground() => new BackgroundModeEmpty();
|
||||
|
||||
public Intro()
|
||||
@ -45,8 +47,8 @@ namespace osu.Game.GameModes.Menu
|
||||
};
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(AudioManager audio)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
welcome = audio.Sample.Get(@"welcome");
|
||||
|
||||
|
@ -27,6 +27,8 @@ namespace osu.Game.GameModes.Menu
|
||||
private ButtonSystem buttons;
|
||||
public override string Name => @"Main Menu";
|
||||
|
||||
internal override bool ShowToolbar => true;
|
||||
|
||||
private BackgroundMode background;
|
||||
|
||||
protected override BackgroundMode CreateBackground() => background;
|
||||
@ -57,11 +59,12 @@ namespace osu.Game.GameModes.Menu
|
||||
};
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(BaseGame game, OptionsOverlay options)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGame game)
|
||||
{
|
||||
background.Preload(game);
|
||||
buttons.OnSettings = options.ToggleVisibility;
|
||||
|
||||
buttons.OnSettings = game.ToggleOptions;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
@ -103,8 +103,8 @@ namespace osu.Game.GameModes.Menu
|
||||
};
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(TextureStore textures)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
logo.Texture = textures.Get(@"Menu/logo");
|
||||
ripple.Texture = textures.Get(@"Menu/logo");
|
||||
|
@ -28,6 +28,12 @@ namespace osu.Game.GameModes
|
||||
/// </summary>
|
||||
protected virtual BackgroundMode CreateBackground() => null;
|
||||
|
||||
internal virtual bool ShowToolbar => true;
|
||||
|
||||
protected new OsuGameBase Game => base.Game as OsuGameBase;
|
||||
|
||||
protected float ToolbarPadding => ShowToolbar ? (Game as OsuGame)?.Toolbar.DrawHeight ?? 0 : 0;
|
||||
|
||||
private bool boundToBeatmap;
|
||||
private Bindable<WorkingBeatmap> beatmap;
|
||||
|
||||
@ -70,10 +76,11 @@ namespace osu.Game.GameModes
|
||||
OnBeatmapChanged(beatmap.Value);
|
||||
}
|
||||
|
||||
[Initializer(permitNulls: true)]
|
||||
private void Load(OsuGameBase game)
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(OsuGameBase game)
|
||||
{
|
||||
beatmap = game?.Beatmap;
|
||||
if (beatmap == null)
|
||||
beatmap = game?.Beatmap;
|
||||
}
|
||||
|
||||
public override bool Push(GameMode mode)
|
||||
|
@ -21,8 +21,8 @@ namespace osu.Game.GameModes.Play.Catch
|
||||
Origin = Anchor.BottomCentre;
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
||||
}
|
||||
|
20
osu.Game/GameModes/Play/Catch/CatchRuleset.cs
Normal file
20
osu.Game/GameModes/Play/Catch/CatchRuleset.cs
Normal 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 };
|
||||
}
|
||||
}
|
@ -121,8 +121,8 @@ namespace osu.Game.GameModes.Play
|
||||
TextSize = 80;
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
DisplayedCountSpriteText.Text = FormatCount(Count);
|
||||
DisplayedCountSpriteText.Anchor = Anchor;
|
||||
|
@ -43,8 +43,8 @@ namespace osu.Game.GameModes.Play
|
||||
|
||||
protected virtual List<T> Convert(List<HitObject> objects) => Converter.Convert(objects);
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
|
@ -24,8 +24,8 @@ namespace osu.Game.GameModes.Play.Mania
|
||||
Origin = Anchor.BottomCentre;
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
||||
|
||||
|
20
osu.Game/GameModes/Play/Mania/ManiaRuleset.cs
Normal file
20
osu.Game/GameModes/Play/Mania/ManiaRuleset.cs
Normal 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 };
|
||||
}
|
||||
}
|
@ -34,8 +34,8 @@ namespace osu.Game.GameModes.Play.Osu
|
||||
}
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
PopOutSpriteText.Origin = Origin;
|
||||
PopOutSpriteText.Anchor = Anchor;
|
||||
|
18
osu.Game/GameModes/Play/Osu/OsuRuleset.cs
Normal file
18
osu.Game/GameModes/Play/Osu/OsuRuleset.cs
Normal 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 };
|
||||
}}
|
@ -126,17 +126,15 @@ namespace osu.Game.GameModes.Play
|
||||
};
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game)
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(BeatmapDatabase beatmaps, AudioManager audio, OsuGame game)
|
||||
{
|
||||
// TODO: Load(..., [PermitNull] OsuGame osuGame) or some such
|
||||
var 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 = osuGame.Toolbar.Height };
|
||||
scrollContainer.Padding = new MarginPadding { Top = ToolbarPadding };
|
||||
}
|
||||
|
||||
if (database == null)
|
||||
|
@ -15,6 +15,12 @@ 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
|
||||
{
|
||||
@ -24,17 +30,52 @@ namespace osu.Game.GameModes.Play
|
||||
|
||||
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
|
||||
|
||||
internal override bool ShowToolbar => false;
|
||||
|
||||
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;
|
||||
|
||||
[Initializer]
|
||||
private void Load(AudioManager audio, BeatmapDatabase beatmaps)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -79,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); };
|
||||
@ -131,7 +134,14 @@ namespace osu.Game.GameModes.Play
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
hitRenderer,
|
||||
inputManager = new PlayerInputManager(game.Host)
|
||||
{
|
||||
PassThrough = false,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
hitRenderer,
|
||||
}
|
||||
},
|
||||
scoreOverlay,
|
||||
};
|
||||
}
|
||||
|
38
osu.Game/GameModes/Play/Ruleset.cs
Normal file
38
osu.Game/GameModes/Play/Ruleset.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -22,8 +22,8 @@ namespace osu.Game.GameModes.Play.Taiko
|
||||
Origin = Anchor.Centre;
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(TextureStore textures)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
||||
|
||||
|
20
osu.Game/GameModes/Play/Taiko/TaikoRuleset.cs
Normal file
20
osu.Game/GameModes/Play/Taiko/TaikoRuleset.cs
Normal 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 };
|
||||
}
|
||||
}
|
@ -28,8 +28,8 @@ namespace osu.Game.Graphics.Background
|
||||
Depth = float.MinValue;
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(TextureStore textures)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
Add(BackgroundSprite = new Sprite
|
||||
{
|
||||
|
@ -39,8 +39,8 @@ namespace osu.Game.Graphics.Cursor
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(TextureStore textures)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -61,8 +61,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Name = name;
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(TextureStore textures)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -120,8 +120,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
DisplayedCount = Count;
|
||||
|
||||
|
@ -110,8 +110,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
};
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
starContainer.Width = MaxStars * StarSize + Math.Max(MaxStars - 1, 0) * StarSpacing;
|
||||
starContainer.Height = StarSize;
|
||||
|
@ -33,8 +33,8 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
||||
Origin = Anchor.BottomRight;
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
VolumeGlobal.ValueChanged += volumeChanged;
|
||||
VolumeSample.ValueChanged += volumeChanged;
|
||||
|
@ -60,8 +60,8 @@ namespace osu.Game.Online.Chat.Display
|
||||
channel.NewMessagesArrived -= newMessages;
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
newMessages(channel.Messages);
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ namespace osu.Game.Online.Chat.Display
|
||||
const float padding = 200;
|
||||
const float text_size = 20;
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
@ -18,6 +18,7 @@ using osu.Framework.Input;
|
||||
using osu.Game.Input;
|
||||
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;
|
||||
@ -27,10 +28,15 @@ namespace osu.Game
|
||||
public class OsuGame : OsuGameBase
|
||||
{
|
||||
public Toolbar Toolbar;
|
||||
public ChatConsole Chat;
|
||||
public MusicController MusicController;
|
||||
public MainMenu MainMenu => intro?.ChildGameMode as MainMenu;
|
||||
private Intro intro;
|
||||
|
||||
private ChatConsole chat;
|
||||
|
||||
private MusicController musicController;
|
||||
|
||||
private MainMenu mainMenu => modeStack?.ChildGameMode as MainMenu;
|
||||
private Intro intro => modeStack as Intro;
|
||||
|
||||
private OsuGameMode modeStack;
|
||||
|
||||
private VolumeControl volume;
|
||||
|
||||
@ -52,8 +58,10 @@ namespace osu.Game
|
||||
host.Size = new Vector2(Config.Get<int>(OsuConfig.Width), Config.Get<int>(OsuConfig.Height));
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
public void ToggleOptions() => Options.ToggleVisibility();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
if (!Host.IsPrimaryInstance)
|
||||
{
|
||||
@ -73,6 +81,7 @@ namespace osu.Game
|
||||
|
||||
PlayMode = Config.GetBindable<PlayMode>(OsuConfig.PlayMode);
|
||||
|
||||
//todo: move to constructor or LoadComplete.
|
||||
Add(new Drawable[] {
|
||||
new VolumeControlReceptor
|
||||
{
|
||||
@ -89,40 +98,41 @@ namespace osu.Game
|
||||
VolumeSample = Audio.VolumeSample,
|
||||
VolumeTrack = Audio.VolumeTrack
|
||||
},
|
||||
overlayContent = new Container{ RelativeSizeAxes = Axes.Both },
|
||||
new GlobalHotkeys //exists because UserInputManager is at a level below us.
|
||||
{
|
||||
Handler = globalHotkeyPressed
|
||||
}
|
||||
});
|
||||
|
||||
(Options = new OptionsOverlay { Depth = float.MaxValue / 2 }).Preload(this, Add);
|
||||
|
||||
(intro = new Intro
|
||||
(modeStack = new Intro
|
||||
{
|
||||
Beatmap = Beatmap
|
||||
}).Preload(this, d =>
|
||||
{
|
||||
mainContent.Add(d);
|
||||
|
||||
intro.ModePushed += modeAdded;
|
||||
intro.Exited += modeRemoved;
|
||||
intro.DisplayAsRoot();
|
||||
modeStack.ModePushed += modeAdded;
|
||||
modeStack.Exited += modeRemoved;
|
||||
modeStack.DisplayAsRoot();
|
||||
});
|
||||
|
||||
(Chat = new ChatConsole(API)).Preload(this, Add);
|
||||
(MusicController = new MusicController()).Preload(this, Add);
|
||||
|
||||
//overlay elements
|
||||
(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
|
||||
{
|
||||
OnHome = delegate { MainMenu?.MakeCurrent(); },
|
||||
Depth = 2,
|
||||
OnHome = delegate { mainMenu?.MakeCurrent(); },
|
||||
OnSettings = Options.ToggleVisibility,
|
||||
OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; },
|
||||
OnMusicController = MusicController.ToggleVisibility
|
||||
OnMusicController = musicController.ToggleVisibility
|
||||
}).Preload(this, t =>
|
||||
{
|
||||
PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); };
|
||||
PlayMode.TriggerChange();
|
||||
Add(Toolbar);
|
||||
overlayContent.Add(Toolbar);
|
||||
});
|
||||
|
||||
Cursor.Alpha = 0;
|
||||
@ -133,7 +143,7 @@ namespace osu.Game
|
||||
switch (args.Key)
|
||||
{
|
||||
case Key.F8:
|
||||
Chat.ToggleVisibility();
|
||||
chat.ToggleVisibility();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -154,6 +164,8 @@ namespace osu.Game
|
||||
|
||||
private Container mainContent;
|
||||
|
||||
private Container overlayContent;
|
||||
|
||||
private void modeChanged(GameMode newMode)
|
||||
{
|
||||
// - Ability to change window size
|
||||
@ -161,10 +173,10 @@ namespace osu.Game
|
||||
// - Frame limiter changes
|
||||
|
||||
//central game mode change logic.
|
||||
if (newMode is Player || newMode is Intro)
|
||||
if ((newMode as OsuGameMode)?.ShowToolbar != true)
|
||||
{
|
||||
Toolbar.State = Visibility.Hidden;
|
||||
Chat.State = Visibility.Hidden;
|
||||
chat.State = Visibility.Hidden;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -41,8 +41,8 @@ namespace osu.Game
|
||||
{
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Dependencies.Cache(this);
|
||||
Dependencies.Cache(new OsuConfigManager(Host.Storage));
|
||||
@ -68,13 +68,10 @@ namespace osu.Game
|
||||
|
||||
AddInternal(ratioContainer = new RatioAdjust());
|
||||
|
||||
var options = new OptionsOverlay();
|
||||
Children = new Drawable[]
|
||||
{
|
||||
options,
|
||||
Cursor = new OsuCursorContainer { Depth = float.MaxValue }
|
||||
};
|
||||
Dependencies.Cache(options);
|
||||
|
||||
Beatmap.ValueChanged += Beatmap_ValueChanged;
|
||||
|
||||
|
@ -56,8 +56,8 @@ namespace osu.Game.Overlays
|
||||
});
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
initializeChannels();
|
||||
}
|
||||
|
@ -19,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;
|
||||
|
||||
@ -26,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;
|
||||
@ -38,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,
|
||||
@ -79,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,
|
||||
@ -176,16 +174,38 @@ namespace osu.Game.Overlays
|
||||
};
|
||||
}
|
||||
|
||||
[Initializer(permitNulls: true)]
|
||||
private void Load(OsuGame osuGame, BeatmapDatabase beatmaps, AudioManager audio, TextureStore textures)
|
||||
protected override bool OnDragStart(InputState state) => true;
|
||||
|
||||
protected override bool OnDrag(InputState state)
|
||||
{
|
||||
if (database == null) database = beatmaps;
|
||||
trackManager = audio.Track;
|
||||
Vector2 change = (state.Mouse.Position - state.Mouse.PositionMouseDown.Value);
|
||||
change.X = -change.X;
|
||||
|
||||
beatmapSource = osuGame?.Beatmap ?? new Bindable<WorkingBeatmap>();
|
||||
playList = database.GetAllWithChildren<BeatmapSetInfo>();
|
||||
change *= (float)Math.Pow(change.Length, 0.7f) / change.Length;
|
||||
|
||||
backgroundSprite = getScaledSprite(fallbackTexture = textures.Get(@"Backgrounds/bg4"));
|
||||
MoveTo(start_position + change);
|
||||
return base.OnDrag(state);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -207,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;
|
||||
@ -266,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);
|
||||
@ -278,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);
|
||||
|
||||
@ -303,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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,19 @@
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Audio
|
||||
{
|
||||
public class AudioSection : OptionsSection
|
||||
{
|
||||
protected override string Header => "Audio";
|
||||
public override string Header => "Audio";
|
||||
public override FontAwesome Icon => FontAwesome.fa_headphones;
|
||||
|
||||
public AudioSection()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new AudioDevicesOptions(),
|
||||
new AudioDevicesOptions { Alpha = RuntimeInfo.IsWindows ? 1 : 0 },
|
||||
new VolumeOptions(),
|
||||
new OffsetAdjustmentOptions(),
|
||||
};
|
||||
|
@ -17,8 +17,8 @@ namespace osu.Game.Overlays.Options.Audio
|
||||
{
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(OsuConfigManager config)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -10,11 +10,11 @@ namespace osu.Game.Overlays.Options
|
||||
{
|
||||
public class EditorSection : OptionsSection
|
||||
{
|
||||
protected override string Header => "Editor";
|
||||
public override string Header => "Editor";
|
||||
public override FontAwesome Icon => FontAwesome.fa_pencil;
|
||||
|
||||
[Initializer]
|
||||
private void Load(OsuConfigManager config)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
content.Spacing = new Vector2(0, 5);
|
||||
Children = new Drawable[]
|
||||
|
@ -5,7 +5,7 @@ namespace osu.Game.Overlays.Options.Gameplay
|
||||
{
|
||||
public class GameplaySection : OptionsSection
|
||||
{
|
||||
protected override string Header => "Gameplay";
|
||||
public override string Header => "Gameplay";
|
||||
public override FontAwesome Icon => FontAwesome.fa_circle_o;
|
||||
|
||||
public GameplaySection()
|
||||
|
@ -11,8 +11,8 @@ namespace osu.Game.Overlays.Options.Gameplay
|
||||
{
|
||||
protected override string Header => "General";
|
||||
|
||||
[Initializer]
|
||||
private void Load(OsuConfigManager config)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ namespace osu.Game.Overlays.Options.General
|
||||
{
|
||||
public class GeneralSection : OptionsSection
|
||||
{
|
||||
protected override string Header => "General";
|
||||
public override string Header => "General";
|
||||
public override FontAwesome Icon => FontAwesome.fa_gear;
|
||||
|
||||
public GeneralSection()
|
||||
|
@ -1,17 +1,17 @@
|
||||
using osu.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Configuration;
|
||||
|
||||
namespace osu.Game.Overlays.Options.General
|
||||
{
|
||||
public class LanguageOptions : OptionsSubsection
|
||||
{
|
||||
protected override string Header => "Language";
|
||||
|
||||
[Initializer]
|
||||
private void Load(OsuConfigManager config)
|
||||
namespace osu.Game.Overlays.Options.General
|
||||
{
|
||||
public class LanguageOptions : OptionsSubsection
|
||||
{
|
||||
protected override string Header => "Language";
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -27,6 +27,6 @@ namespace osu.Game.Overlays.Options.General
|
||||
Bindable = config.GetBindable<bool>(OsuConfig.AlternativeChatFont)
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
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;
|
||||
|
||||
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
|
||||
@ -28,15 +28,15 @@ namespace osu.Game.Overlays.Options.General
|
||||
};
|
||||
}
|
||||
|
||||
[Initializer(permitNulls: true)]
|
||||
private void Load(APIAccess api)
|
||||
{
|
||||
if (api == null)
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(APIAccess api)
|
||||
{
|
||||
if (api == null)
|
||||
return;
|
||||
loginForm.Children = new Drawable[]
|
||||
{
|
||||
new LoginForm(api)
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
class LoginForm : FlowContainer
|
||||
|
@ -5,14 +5,14 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Options.General
|
||||
{
|
||||
public class UpdateOptions : OptionsSubsection
|
||||
{
|
||||
protected override string Header => "Updates";
|
||||
|
||||
[Initializer]
|
||||
private void Load(BasicStorage storage)
|
||||
namespace osu.Game.Overlays.Options.General
|
||||
{
|
||||
public class UpdateOptions : OptionsSubsection
|
||||
{
|
||||
protected override string Header => "Updates";
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BasicStorage storage)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Options.General
|
||||
Action = () => storage.OpenInNativeExplorer(),
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,8 @@ namespace osu.Game.Overlays.Options.Graphics
|
||||
{
|
||||
protected override string Header => "Detail Settings";
|
||||
|
||||
[Initializer]
|
||||
private void Load(OsuConfigManager config)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ namespace osu.Game.Overlays.Options.Graphics
|
||||
{
|
||||
public class GraphicsSection : OptionsSection
|
||||
{
|
||||
protected override string Header => "Graphics";
|
||||
public override string Header => "Graphics";
|
||||
public override FontAwesome Icon => FontAwesome.fa_laptop;
|
||||
|
||||
public GraphicsSection()
|
||||
|
@ -5,14 +5,14 @@ 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";
|
||||
|
||||
[Initializer]
|
||||
private void Load(OsuConfigManager config)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -32,6 +32,6 @@ namespace osu.Game.Overlays.Options.Graphics
|
||||
new SpriteText { Text = "Vertical position" },
|
||||
new SpriteText { Text = "TODO: slider" },
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,8 +9,8 @@ namespace osu.Game.Overlays.Options.Graphics
|
||||
{
|
||||
protected override string Header => "Main Menu";
|
||||
|
||||
[Initializer]
|
||||
private void Load(OsuConfigManager config)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
|
@ -5,14 +5,14 @@ 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";
|
||||
|
||||
[Initializer]
|
||||
private void Load(OsuConfigManager config)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
// NOTE: Compatability mode omitted
|
||||
Children = new Drawable[]
|
||||
@ -34,6 +34,6 @@ namespace osu.Game.Overlays.Options.Graphics
|
||||
Bindable = config.GetBindable<bool>(OsuConfig.DetectPerformanceIssues),
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,8 +9,8 @@ namespace osu.Game.Overlays.Options.Graphics
|
||||
{
|
||||
protected override string Header => "Song Select";
|
||||
|
||||
[Initializer]
|
||||
private void Load(OsuConfigManager config)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ namespace osu.Game.Overlays.Options.Input
|
||||
{
|
||||
public class InputSection : OptionsSection
|
||||
{
|
||||
protected override string Header => "Input";
|
||||
public override string Header => "Input";
|
||||
public override FontAwesome Icon => FontAwesome.fa_keyboard_o;
|
||||
|
||||
public InputSection()
|
||||
|
@ -17,8 +17,8 @@ namespace osu.Game.Overlays.Options.Input
|
||||
{
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(OsuConfigManager config)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -10,8 +10,8 @@ namespace osu.Game.Overlays.Options.Input
|
||||
{
|
||||
protected override string Header => "Other";
|
||||
|
||||
[Initializer]
|
||||
private void Load(OsuConfigManager config)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ namespace osu.Game.Overlays.Options
|
||||
{
|
||||
public class MaintenanceSection : OptionsSection
|
||||
{
|
||||
protected override string Header => "Maintenance";
|
||||
public override string Header => "Maintenance";
|
||||
public override FontAwesome Icon => FontAwesome.fa_wrench;
|
||||
|
||||
public MaintenanceSection()
|
||||
|
@ -9,10 +9,12 @@ namespace osu.Game.Overlays.Options.Online
|
||||
{
|
||||
public class InGameChatOptions : OptionsSubsection
|
||||
{
|
||||
private TextBoxOption chatIgnoreList;
|
||||
private TextBoxOption chatHighlightWords;
|
||||
protected override string Header => "In-game Chat";
|
||||
|
||||
[Initializer]
|
||||
private void Load(OsuConfigManager config)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -37,10 +39,18 @@ namespace osu.Game.Overlays.Options.Online
|
||||
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)
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -10,8 +10,8 @@ namespace osu.Game.Overlays.Options.Online
|
||||
{
|
||||
protected override string Header => "Notifications";
|
||||
|
||||
[Initializer]
|
||||
private void Load(OsuConfigManager config)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -10,8 +10,8 @@ namespace osu.Game.Overlays.Options.Online
|
||||
{
|
||||
protected override string Header => "Integration";
|
||||
|
||||
[Initializer]
|
||||
private void Load(OsuConfigManager config)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ namespace osu.Game.Overlays.Options.Online
|
||||
{
|
||||
public class OnlineSection : OptionsSection
|
||||
{
|
||||
protected override string Header => "Online";
|
||||
public override string Header => "Online";
|
||||
public override FontAwesome Icon => FontAwesome.fa_globe;
|
||||
|
||||
public OnlineSection()
|
||||
|
@ -10,8 +10,8 @@ namespace osu.Game.Overlays.Options.Online
|
||||
{
|
||||
protected override string Header => "Privacy";
|
||||
|
||||
[Initializer]
|
||||
private void Load(OsuConfigManager config)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Overlays.Options
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
public abstract FontAwesome Icon { get; }
|
||||
protected abstract string Header { get; }
|
||||
public abstract string Header { get; }
|
||||
|
||||
public OptionsSection()
|
||||
{
|
||||
|
@ -4,7 +4,9 @@ using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Options
|
||||
@ -12,6 +14,7 @@ namespace osu.Game.Overlays.Options
|
||||
public class OptionsSidebar : Container
|
||||
{
|
||||
private FlowContainer content;
|
||||
internal const int default_width = 60, expanded_width = 200;
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
public OptionsSidebar()
|
||||
@ -41,6 +44,25 @@ namespace osu.Game.Overlays.Options
|
||||
};
|
||||
}
|
||||
|
||||
private ScheduledDelegate expandEvent;
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
{
|
||||
expandEvent = Scheduler.AddDelayed(() =>
|
||||
{
|
||||
expandEvent = null;
|
||||
ResizeTo(new Vector2(expanded_width, Height), 150, EasingTypes.OutQuad);
|
||||
}, 750);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
{
|
||||
expandEvent?.Cancel();
|
||||
ResizeTo(new Vector2(default_width, Height), 150, EasingTypes.OutQuad);
|
||||
base.OnHoverLost(state);
|
||||
}
|
||||
|
||||
private class SidebarScrollContainer : ScrollContainer
|
||||
{
|
||||
public SidebarScrollContainer()
|
||||
@ -53,6 +75,7 @@ namespace osu.Game.Overlays.Options
|
||||
public class SidebarButton : Container
|
||||
{
|
||||
private TextAwesome drawableIcon;
|
||||
private SpriteText headerText;
|
||||
private Box backgroundBox;
|
||||
public Action Action;
|
||||
|
||||
@ -61,10 +84,17 @@ namespace osu.Game.Overlays.Options
|
||||
get { return drawableIcon.Icon; }
|
||||
set { drawableIcon.Icon = value; }
|
||||
}
|
||||
|
||||
public string Header
|
||||
{
|
||||
get { return headerText.Text; }
|
||||
set { headerText.Text = value; }
|
||||
}
|
||||
|
||||
public SidebarButton()
|
||||
{
|
||||
Size = new Vector2(60);
|
||||
Height = default_width;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
backgroundBox = new Box
|
||||
@ -74,11 +104,25 @@ namespace osu.Game.Overlays.Options
|
||||
Colour = new Color4(60, 60, 60, 255),
|
||||
Alpha = 0,
|
||||
},
|
||||
drawableIcon = new TextAwesome
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Width = default_width,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Children = new[]
|
||||
{
|
||||
drawableIcon = new TextAwesome
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
}
|
||||
},
|
||||
headerText = new SpriteText
|
||||
{
|
||||
Position = new Vector2(default_width + 10, 0),
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -92,12 +136,13 @@ namespace osu.Game.Overlays.Options
|
||||
protected override bool OnHover(InputState state)
|
||||
{
|
||||
backgroundBox.FadeTo(0.4f, 200);
|
||||
return true;
|
||||
return base.OnHover(state);
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
{
|
||||
backgroundBox.FadeTo(0, 200);
|
||||
base.OnHoverLost(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,11 +12,11 @@ namespace osu.Game.Overlays.Options
|
||||
{
|
||||
public class SkinSection : OptionsSection
|
||||
{
|
||||
protected override string Header => "Skin";
|
||||
public override string Header => "Skin";
|
||||
public override FontAwesome Icon => FontAwesome.fa_paint_brush;
|
||||
|
||||
[Initializer]
|
||||
private void Load(OsuConfigManager config)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
content.Spacing = new Vector2(0, 5);
|
||||
Children = new Drawable[]
|
||||
|
49
osu.Game/Overlays/Options/TextBoxOption.cs
Normal file
49
osu.Game/Overlays/Options/TextBoxOption.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -6,12 +6,15 @@ using System.Linq;
|
||||
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;
|
||||
@ -27,7 +30,8 @@ namespace osu.Game.Overlays
|
||||
internal const float CONTENT_MARGINS = 10;
|
||||
|
||||
private const float width = 400;
|
||||
private const float sidebar_width = 60;
|
||||
private const float sidebar_width = OptionsSidebar.default_width;
|
||||
private const float sidebar_padding = 10;
|
||||
|
||||
private ScrollContainer scrollContainer;
|
||||
private OptionsSidebar sidebar;
|
||||
@ -72,6 +76,7 @@ namespace osu.Game.Overlays
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Direction = FlowDirection.VerticalOnly,
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteText
|
||||
@ -105,13 +110,20 @@ namespace osu.Game.Overlays
|
||||
new OptionsSidebar.SidebarButton
|
||||
{
|
||||
Icon = section.Icon,
|
||||
Action = () => scrollContainer.ScrollIntoView(section)
|
||||
Header = section.Header,
|
||||
Action = () => scrollContainer.ScrollIntoView(section),
|
||||
}
|
||||
)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(OsuGame game)
|
||||
{
|
||||
scrollContainer.Padding = new MarginPadding { Top = game?.Toolbar.DrawHeight ?? 0 };
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
|
@ -112,8 +112,8 @@ namespace osu.Game.Overlays
|
||||
Size = new Vector2(1, height);
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load(OsuConfigManager config)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
userButton.Text = config.Get<string>(OsuConfig.Username);
|
||||
}
|
||||
|
@ -105,10 +105,11 @@ namespace osu.Game.Overlays
|
||||
tooltip1 = new SpriteText
|
||||
{
|
||||
TextSize = 22,
|
||||
Font = @"Exo2.0-Bold",
|
||||
},
|
||||
tooltip2 = new SpriteText
|
||||
{
|
||||
TextSize = 15
|
||||
TextSize = 16
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,8 +44,8 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
DrawableIcon.TextSize *= 1.4f;
|
||||
}
|
||||
|
@ -31,8 +31,8 @@ namespace osu.Game.Overlays
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
}
|
||||
|
||||
[Initializer]
|
||||
private void Load()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -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" />
|
||||
@ -234,6 +239,7 @@
|
||||
<Compile Include="Overlays\Options\Online\PrivacyOptions.cs" />
|
||||
<Compile Include="Overlays\Options\Online\NotificationsOptions.cs" />
|
||||
<Compile Include="Overlays\Options\CheckBoxOption.cs" />
|
||||
<Compile Include="Overlays\Options\TextBoxOption.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
|
||||
|
Loading…
Reference in New Issue
Block a user