mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 03:03:21 +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;
|
private ChannelDisplay channelDisplay;
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(APIAccess api)
|
private void load(APIAccess api)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
protected override IFrameBasedClock Clock => ourClock;
|
protected override IFrameBasedClock Clock => ourClock;
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
var swClock = new StopwatchClock(true) { Rate = 1 };
|
var swClock = new StopwatchClock(true) { Rate = 1 };
|
||||||
ourClock = new FramedClock(swClock);
|
ourClock = new FramedClock(swClock);
|
||||||
|
@ -25,8 +25,8 @@ namespace osu.Desktop.Tests
|
|||||||
|
|
||||||
protected MusicController mc;
|
protected MusicController mc;
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
ourClock = new FramedClock();
|
ourClock = new FramedClock();
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ namespace osu.Desktop.VisualTests
|
|||||||
{
|
{
|
||||||
class VisualTestGame : OsuGameBase
|
class VisualTestGame : OsuGameBase
|
||||||
{
|
{
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
Add(new TestBrowser());
|
Add(new TestBrowser());
|
||||||
}
|
}
|
||||||
|
@ -100,8 +100,8 @@ namespace osu.Game.Beatmaps.Drawable
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(BaseGame game)
|
private void load(BaseGame game)
|
||||||
{
|
{
|
||||||
BeatmapPanels = beatmapSet.Beatmaps.Select(b => new BeatmapPanel(b)
|
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
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Drawable
|
namespace osu.Game.Beatmaps.Drawable
|
||||||
{
|
{
|
||||||
class BeatmapSetHeader : Panel
|
class BeatmapSetHeader : Panel
|
||||||
{
|
{
|
||||||
public Action<BeatmapSetHeader> GainedSelection;
|
public Action<BeatmapSetHeader> GainedSelection;
|
||||||
|
private BeatmapSetInfo beatmapSet;
|
||||||
|
private SpriteText title, artist;
|
||||||
|
private OsuConfigManager config;
|
||||||
|
private Bindable<bool> preferUnicode;
|
||||||
|
|
||||||
protected override void Selected()
|
protected override void Selected()
|
||||||
{
|
{
|
||||||
@ -29,10 +37,33 @@ namespace osu.Game.Beatmaps.Drawable
|
|||||||
{
|
{
|
||||||
base.Deselected();
|
base.Deselected();
|
||||||
Width = 0.8f;
|
Width = 0.8f;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuConfigManager config)
|
||||||
|
{
|
||||||
|
this.config = config;
|
||||||
|
|
||||||
|
preferUnicode = config.GetBindable<bool>(OsuConfig.ShowUnicode);
|
||||||
|
preferUnicode.ValueChanged += preferUnicode_changed;
|
||||||
|
preferUnicode_changed(preferUnicode, null);
|
||||||
|
}
|
||||||
|
private void preferUnicode_changed(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
title.Text = config.GetUnicodeString(beatmapSet.Metadata.Title, beatmapSet.Metadata.TitleUnicode);
|
||||||
|
artist.Text = config.GetUnicodeString(beatmapSet.Metadata.Artist, beatmapSet.Metadata.ArtistUnicode);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
if (preferUnicode != null)
|
||||||
|
preferUnicode.ValueChanged -= preferUnicode_changed;
|
||||||
|
base.Dispose(isDisposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BeatmapSetHeader(BeatmapSetInfo beatmapSet, WorkingBeatmap working)
|
public BeatmapSetHeader(BeatmapSetInfo beatmapSet, WorkingBeatmap working)
|
||||||
{
|
{
|
||||||
|
this.beatmapSet = beatmapSet;
|
||||||
Children = new Framework.Graphics.Drawable[]
|
Children = new Framework.Graphics.Drawable[]
|
||||||
{
|
{
|
||||||
working.Background == null ? new Box{ RelativeSizeAxes = Axes.Both, Colour = new Color4(20, 20, 20, 255) } : new Sprite
|
working.Background == null ? new Box{ RelativeSizeAxes = Axes.Both, Colour = new Color4(20, 20, 20, 255) } : new Sprite
|
||||||
@ -51,16 +82,16 @@ namespace osu.Game.Beatmaps.Drawable
|
|||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new SpriteText
|
title = new SpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-SemiBoldItalic",
|
Font = @"Exo2.0-SemiBoldItalic",
|
||||||
Text = beatmapSet.Metadata.Title ?? beatmapSet.Metadata.TitleUnicode,
|
Text = beatmapSet.Metadata.Title,
|
||||||
TextSize = 22
|
TextSize = 22
|
||||||
},
|
},
|
||||||
new SpriteText
|
artist = new SpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-MediumItalic",
|
Font = @"Exo2.0-MediumItalic",
|
||||||
Text = beatmapSet.Metadata.Artist ?? beatmapSet.Metadata.ArtistUnicode,
|
Text = beatmapSet.Metadata.Artist,
|
||||||
TextSize = 16
|
TextSize = 16
|
||||||
},
|
},
|
||||||
new FlowContainer
|
new FlowContainer
|
||||||
|
@ -30,8 +30,8 @@ namespace osu.Game.Beatmaps.Objects.Catch.Drawable
|
|||||||
Position = new Vector2(h.Position, -0.1f);
|
Position = new Vector2(h.Position, -0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
Texture = textures.Get(@"Menu/logo");
|
Texture = textures.Get(@"Menu/logo");
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ namespace osu.Game.Beatmaps.Objects.Mania.Drawable
|
|||||||
Scale = new Vector2(0.1f);
|
Scale = new Vector2(0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
Texture = textures.Get(@"Menu/logo");
|
Texture = textures.Get(@"Menu/logo");
|
||||||
|
|
||||||
|
@ -64,8 +64,8 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
|||||||
Size = circle.DrawSize;
|
Size = circle.DrawSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(BaseGame game)
|
private void load(BaseGame game)
|
||||||
{
|
{
|
||||||
approachCircle.Texture = game.Textures.Get(@"Play/osu/approachcircle@2x");
|
approachCircle.Texture = game.Textures.Get(@"Play/osu/approachcircle@2x");
|
||||||
}
|
}
|
||||||
@ -149,8 +149,8 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
number.Texture = textures.Get(@"Play/osu/number@2x");
|
number.Texture = textures.Get(@"Play/osu/number@2x");
|
||||||
}
|
}
|
||||||
@ -177,8 +177,8 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
layer.Texture = textures.Get(@"Play/osu/ring-glow@2x");
|
layer.Texture = textures.Get(@"Play/osu/ring-glow@2x");
|
||||||
}
|
}
|
||||||
@ -203,8 +203,8 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
ring.Texture = textures.Get(@"Play/osu/ring@2x");
|
ring.Texture = textures.Get(@"Play/osu/ring@2x");
|
||||||
}
|
}
|
||||||
@ -289,8 +289,8 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
disc.Texture = textures.Get(@"Play/osu/disc@2x");
|
disc.Texture = textures.Get(@"Play/osu/disc@2x");
|
||||||
}
|
}
|
||||||
@ -306,8 +306,8 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
|||||||
{
|
{
|
||||||
private Texture tex;
|
private Texture tex;
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
tex = textures.Get(@"Play/osu/triangle@2x");
|
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);
|
Position = new Vector2(1.1f, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
Texture = textures.Get(@"Menu/logo");
|
Texture = textures.Get(@"Menu/logo");
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Beatmaps
|
|||||||
public readonly BeatmapSetInfo BeatmapSetInfo;
|
public readonly BeatmapSetInfo BeatmapSetInfo;
|
||||||
private readonly BeatmapDatabase database;
|
private readonly BeatmapDatabase database;
|
||||||
|
|
||||||
private ArchiveReader reader => database.GetReader(BeatmapSetInfo);
|
private ArchiveReader reader => database?.GetReader(BeatmapSetInfo);
|
||||||
|
|
||||||
private Texture background;
|
private Texture background;
|
||||||
private object backgroundLock = new object();
|
private object backgroundLock = new object();
|
||||||
@ -77,7 +77,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var trackData = reader.GetStream(BeatmapInfo.Metadata.AudioFile);
|
var trackData = reader?.GetStream(BeatmapInfo.Metadata.AudioFile);
|
||||||
if (trackData != null)
|
if (trackData != null)
|
||||||
track = new AudioTrackBass(trackData);
|
track = new AudioTrackBass(trackData);
|
||||||
}
|
}
|
||||||
|
@ -179,6 +179,10 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuConfig.CanForceOptimusCompatibility, true);
|
Set(OsuConfig.CanForceOptimusCompatibility, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//todo: make a UnicodeString class/struct rather than requiring this helper method.
|
||||||
|
public string GetUnicodeString(string nonunicode, string unicode)
|
||||||
|
=> Get<bool>(OsuConfig.ShowUnicode) ? unicode ?? nonunicode : nonunicode ?? unicode;
|
||||||
|
|
||||||
public OsuConfigManager(BasicStorage storage) : base(storage)
|
public OsuConfigManager(BasicStorage storage) : base(storage)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,8 @@ namespace osu.Game.GameModes
|
|||||||
|
|
||||||
BaseGame game;
|
BaseGame game;
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(BaseGame game)
|
private void load(BaseGame game)
|
||||||
{
|
{
|
||||||
this.game = game;
|
this.game = game;
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@ namespace osu.Game.GameModes.Backgrounds
|
|||||||
this.textureName = textureName;
|
this.textureName = textureName;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
Add(new Background(textureName));
|
Add(new Background(textureName));
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@ namespace osu.Game.GameModes.Backgrounds
|
|||||||
{
|
{
|
||||||
public class BackgroundModeDefault : BackgroundMode
|
public class BackgroundModeDefault : BackgroundMode
|
||||||
{
|
{
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(BaseGame game)
|
private void load(BaseGame game)
|
||||||
{
|
{
|
||||||
Add(new Background());
|
Add(new Background());
|
||||||
}
|
}
|
||||||
|
@ -78,8 +78,8 @@ namespace osu.Game.GameModes
|
|||||||
Content.FadeIn(transition_time, EasingTypes.OutExpo);
|
Content.FadeIn(transition_time, EasingTypes.OutExpo);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -49,8 +49,8 @@ namespace osu.Game.GameModes.Menu
|
|||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
Alpha = 0;
|
Alpha = 0;
|
||||||
|
|
||||||
|
@ -54,8 +54,8 @@ namespace osu.Game.GameModes.Menu
|
|||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -28,6 +28,8 @@ namespace osu.Game.GameModes.Menu
|
|||||||
private AudioSample welcome;
|
private AudioSample welcome;
|
||||||
private AudioTrack bgm;
|
private AudioTrack bgm;
|
||||||
|
|
||||||
|
internal override bool ShowToolbar => (ParentGameMode as OsuGameMode)?.ShowToolbar ?? false;
|
||||||
|
|
||||||
protected override BackgroundMode CreateBackground() => new BackgroundModeEmpty();
|
protected override BackgroundMode CreateBackground() => new BackgroundModeEmpty();
|
||||||
|
|
||||||
public Intro()
|
public Intro()
|
||||||
@ -45,8 +47,8 @@ namespace osu.Game.GameModes.Menu
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
welcome = audio.Sample.Get(@"welcome");
|
welcome = audio.Sample.Get(@"welcome");
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@ namespace osu.Game.GameModes.Menu
|
|||||||
private ButtonSystem buttons;
|
private ButtonSystem buttons;
|
||||||
public override string Name => @"Main Menu";
|
public override string Name => @"Main Menu";
|
||||||
|
|
||||||
|
internal override bool ShowToolbar => true;
|
||||||
|
|
||||||
private BackgroundMode background;
|
private BackgroundMode background;
|
||||||
|
|
||||||
protected override BackgroundMode CreateBackground() => background;
|
protected override BackgroundMode CreateBackground() => background;
|
||||||
@ -57,11 +59,12 @@ namespace osu.Game.GameModes.Menu
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(BaseGame game, OptionsOverlay options)
|
private void load(OsuGame game)
|
||||||
{
|
{
|
||||||
background.Preload(game);
|
background.Preload(game);
|
||||||
buttons.OnSettings = options.ToggleVisibility;
|
|
||||||
|
buttons.OnSettings = game.ToggleOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
@ -103,8 +103,8 @@ namespace osu.Game.GameModes.Menu
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
logo.Texture = textures.Get(@"Menu/logo");
|
logo.Texture = textures.Get(@"Menu/logo");
|
||||||
ripple.Texture = textures.Get(@"Menu/logo");
|
ripple.Texture = textures.Get(@"Menu/logo");
|
||||||
|
@ -28,6 +28,12 @@ namespace osu.Game.GameModes
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual BackgroundMode CreateBackground() => null;
|
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 bool boundToBeatmap;
|
||||||
private Bindable<WorkingBeatmap> beatmap;
|
private Bindable<WorkingBeatmap> beatmap;
|
||||||
|
|
||||||
@ -70,10 +76,11 @@ namespace osu.Game.GameModes
|
|||||||
OnBeatmapChanged(beatmap.Value);
|
OnBeatmapChanged(beatmap.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void Load(OsuGameBase game)
|
private void load(OsuGameBase game)
|
||||||
{
|
{
|
||||||
beatmap = game?.Beatmap;
|
if (beatmap == null)
|
||||||
|
beatmap = game?.Beatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Push(GameMode mode)
|
public override bool Push(GameMode mode)
|
||||||
|
@ -21,8 +21,8 @@ namespace osu.Game.GameModes.Play.Catch
|
|||||||
Origin = Anchor.BottomCentre;
|
Origin = Anchor.BottomCentre;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
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;
|
TextSize = 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
DisplayedCountSpriteText.Text = FormatCount(Count);
|
DisplayedCountSpriteText.Text = FormatCount(Count);
|
||||||
DisplayedCountSpriteText.Anchor = Anchor;
|
DisplayedCountSpriteText.Anchor = Anchor;
|
||||||
|
@ -43,8 +43,8 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
protected virtual List<T> Convert(List<HitObject> objects) => Converter.Convert(objects);
|
protected virtual List<T> Convert(List<HitObject> objects) => Converter.Convert(objects);
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ namespace osu.Game.GameModes.Play.Mania
|
|||||||
Origin = Anchor.BottomCentre;
|
Origin = Anchor.BottomCentre;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
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]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
PopOutSpriteText.Origin = Origin;
|
PopOutSpriteText.Origin = Origin;
|
||||||
PopOutSpriteText.Anchor = Anchor;
|
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]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void Load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game)
|
private void load(BeatmapDatabase beatmaps, AudioManager audio, OsuGame game)
|
||||||
{
|
{
|
||||||
// TODO: Load(..., [PermitNull] OsuGame osuGame) or some such
|
if (game != null)
|
||||||
var osuGame = game as OsuGame;
|
|
||||||
if (osuGame != null)
|
|
||||||
{
|
{
|
||||||
playMode = osuGame.PlayMode;
|
playMode = game.PlayMode;
|
||||||
playMode.ValueChanged += playMode_ValueChanged;
|
playMode.ValueChanged += playMode_ValueChanged;
|
||||||
// Temporary:
|
// Temporary:
|
||||||
scrollContainer.Padding = new MarginPadding { Top = osuGame.Toolbar.Height };
|
scrollContainer.Padding = new MarginPadding { Top = ToolbarPadding };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (database == null)
|
if (database == null)
|
||||||
|
@ -15,6 +15,12 @@ using osu.Framework.Audio.Track;
|
|||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.Platform;
|
||||||
|
using OpenTK.Input;
|
||||||
|
using MouseState = osu.Framework.Input.MouseState;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
@ -24,17 +30,52 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
|
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
|
||||||
|
|
||||||
|
internal override bool ShowToolbar => false;
|
||||||
|
|
||||||
public BeatmapInfo BeatmapInfo;
|
public BeatmapInfo BeatmapInfo;
|
||||||
|
|
||||||
|
PlayerInputManager inputManager;
|
||||||
|
|
||||||
|
class PlayerInputManager : UserInputManager
|
||||||
|
{
|
||||||
|
public PlayerInputManager(BasicGameHost host)
|
||||||
|
: base(host)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateMouseState(InputState state)
|
||||||
|
{
|
||||||
|
base.UpdateMouseState(state);
|
||||||
|
|
||||||
|
MouseState mouse = (MouseState)state.Mouse;
|
||||||
|
|
||||||
|
foreach (Key k in state.Keyboard.Keys)
|
||||||
|
{
|
||||||
|
switch (k)
|
||||||
|
{
|
||||||
|
case Key.Z:
|
||||||
|
mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = true;
|
||||||
|
break;
|
||||||
|
case Key.X:
|
||||||
|
mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public PlayMode PreferredPlayMode;
|
public PlayMode PreferredPlayMode;
|
||||||
|
|
||||||
protected override IFrameBasedClock Clock => playerClock;
|
protected override IFrameBasedClock Clock => playerClock;
|
||||||
|
|
||||||
private InterpolatingFramedClock playerClock;
|
private InterpolatingFramedClock playerClock;
|
||||||
private IAdjustableClock sourceClock;
|
private IAdjustableClock sourceClock;
|
||||||
|
private Ruleset Ruleset;
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(AudioManager audio, BeatmapDatabase beatmaps)
|
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -79,49 +120,11 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
PlayMode usablePlayMode = beatmap.BeatmapInfo?.Mode > PlayMode.Osu ? beatmap.BeatmapInfo.Mode : PreferredPlayMode;
|
PlayMode usablePlayMode = beatmap.BeatmapInfo?.Mode > PlayMode.Osu ? beatmap.BeatmapInfo.Mode : PreferredPlayMode;
|
||||||
|
|
||||||
switch (usablePlayMode)
|
Ruleset = Ruleset.GetRuleset(usablePlayMode);
|
||||||
{
|
|
||||||
default:
|
|
||||||
scoreOverlay = new ScoreOverlayOsu();
|
|
||||||
|
|
||||||
hitRenderer = new OsuHitRenderer
|
scoreOverlay = Ruleset.CreateScoreOverlay();
|
||||||
{
|
|
||||||
Objects = beatmap.HitObjects,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
case PlayMode.Taiko:
|
|
||||||
scoreOverlay = new ScoreOverlayOsu();
|
|
||||||
|
|
||||||
hitRenderer = new TaikoHitRenderer
|
hitRenderer = Ruleset.CreateHitRendererWith(beatmap.HitObjects);
|
||||||
{
|
|
||||||
Objects = beatmap.HitObjects,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
case PlayMode.Catch:
|
|
||||||
scoreOverlay = new ScoreOverlayOsu();
|
|
||||||
|
|
||||||
hitRenderer = new CatchHitRenderer
|
|
||||||
{
|
|
||||||
Objects = beatmap.HitObjects,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
case PlayMode.Mania:
|
|
||||||
scoreOverlay = new ScoreOverlayOsu();
|
|
||||||
|
|
||||||
hitRenderer = new ManiaHitRenderer
|
|
||||||
{
|
|
||||||
Objects = beatmap.HitObjects,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
hitRenderer.OnHit += delegate (HitObject h) { scoreOverlay.OnHit(h); };
|
hitRenderer.OnHit += delegate (HitObject h) { scoreOverlay.OnHit(h); };
|
||||||
hitRenderer.OnMiss += delegate (HitObject h) { scoreOverlay.OnMiss(h); };
|
hitRenderer.OnMiss += delegate (HitObject h) { scoreOverlay.OnMiss(h); };
|
||||||
@ -131,7 +134,14 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
hitRenderer,
|
inputManager = new PlayerInputManager(game.Host)
|
||||||
|
{
|
||||||
|
PassThrough = false,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
hitRenderer,
|
||||||
|
}
|
||||||
|
},
|
||||||
scoreOverlay,
|
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;
|
Origin = Anchor.Centre;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
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;
|
Depth = float.MinValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
Add(BackgroundSprite = new Sprite
|
Add(BackgroundSprite = new Sprite
|
||||||
{
|
{
|
||||||
|
@ -39,8 +39,8 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -61,8 +61,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Name = name;
|
Name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -120,8 +120,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
DisplayedCount = Count;
|
DisplayedCount = Count;
|
||||||
|
|
||||||
|
@ -110,8 +110,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
starContainer.Width = MaxStars * StarSize + Math.Max(MaxStars - 1, 0) * StarSpacing;
|
starContainer.Width = MaxStars * StarSize + Math.Max(MaxStars - 1, 0) * StarSpacing;
|
||||||
starContainer.Height = StarSize;
|
starContainer.Height = StarSize;
|
||||||
|
@ -33,8 +33,8 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
|||||||
Origin = Anchor.BottomRight;
|
Origin = Anchor.BottomRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
VolumeGlobal.ValueChanged += volumeChanged;
|
VolumeGlobal.ValueChanged += volumeChanged;
|
||||||
VolumeSample.ValueChanged += volumeChanged;
|
VolumeSample.ValueChanged += volumeChanged;
|
||||||
|
@ -60,8 +60,8 @@ namespace osu.Game.Online.Chat.Display
|
|||||||
channel.NewMessagesArrived -= newMessages;
|
channel.NewMessagesArrived -= newMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
newMessages(channel.Messages);
|
newMessages(channel.Messages);
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@ namespace osu.Game.Online.Chat.Display
|
|||||||
const float padding = 200;
|
const float padding = 200;
|
||||||
const float text_size = 20;
|
const float text_size = 20;
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
@ -18,6 +18,7 @@ using osu.Framework.Input;
|
|||||||
using osu.Game.Input;
|
using osu.Game.Input;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
|
using osu.Game.GameModes;
|
||||||
using osu.Game.Graphics.UserInterface.Volume;
|
using osu.Game.Graphics.UserInterface.Volume;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -27,10 +28,15 @@ namespace osu.Game
|
|||||||
public class OsuGame : OsuGameBase
|
public class OsuGame : OsuGameBase
|
||||||
{
|
{
|
||||||
public Toolbar Toolbar;
|
public Toolbar Toolbar;
|
||||||
public ChatConsole Chat;
|
|
||||||
public MusicController MusicController;
|
private ChatConsole chat;
|
||||||
public MainMenu MainMenu => intro?.ChildGameMode as MainMenu;
|
|
||||||
private Intro intro;
|
private MusicController musicController;
|
||||||
|
|
||||||
|
private MainMenu mainMenu => modeStack?.ChildGameMode as MainMenu;
|
||||||
|
private Intro intro => modeStack as Intro;
|
||||||
|
|
||||||
|
private OsuGameMode modeStack;
|
||||||
|
|
||||||
private VolumeControl volume;
|
private VolumeControl volume;
|
||||||
|
|
||||||
@ -52,8 +58,10 @@ namespace osu.Game
|
|||||||
host.Size = new Vector2(Config.Get<int>(OsuConfig.Width), Config.Get<int>(OsuConfig.Height));
|
host.Size = new Vector2(Config.Get<int>(OsuConfig.Width), Config.Get<int>(OsuConfig.Height));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
public void ToggleOptions() => Options.ToggleVisibility();
|
||||||
private void Load()
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
{
|
{
|
||||||
if (!Host.IsPrimaryInstance)
|
if (!Host.IsPrimaryInstance)
|
||||||
{
|
{
|
||||||
@ -73,6 +81,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
PlayMode = Config.GetBindable<PlayMode>(OsuConfig.PlayMode);
|
PlayMode = Config.GetBindable<PlayMode>(OsuConfig.PlayMode);
|
||||||
|
|
||||||
|
//todo: move to constructor or LoadComplete.
|
||||||
Add(new Drawable[] {
|
Add(new Drawable[] {
|
||||||
new VolumeControlReceptor
|
new VolumeControlReceptor
|
||||||
{
|
{
|
||||||
@ -89,40 +98,41 @@ namespace osu.Game
|
|||||||
VolumeSample = Audio.VolumeSample,
|
VolumeSample = Audio.VolumeSample,
|
||||||
VolumeTrack = Audio.VolumeTrack
|
VolumeTrack = Audio.VolumeTrack
|
||||||
},
|
},
|
||||||
|
overlayContent = new Container{ RelativeSizeAxes = Axes.Both },
|
||||||
new GlobalHotkeys //exists because UserInputManager is at a level below us.
|
new GlobalHotkeys //exists because UserInputManager is at a level below us.
|
||||||
{
|
{
|
||||||
Handler = globalHotkeyPressed
|
Handler = globalHotkeyPressed
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
(Options = new OptionsOverlay { Depth = float.MaxValue / 2 }).Preload(this, Add);
|
(modeStack = new Intro
|
||||||
|
|
||||||
(intro = new Intro
|
|
||||||
{
|
{
|
||||||
Beatmap = Beatmap
|
Beatmap = Beatmap
|
||||||
}).Preload(this, d =>
|
}).Preload(this, d =>
|
||||||
{
|
{
|
||||||
mainContent.Add(d);
|
mainContent.Add(d);
|
||||||
|
|
||||||
intro.ModePushed += modeAdded;
|
modeStack.ModePushed += modeAdded;
|
||||||
intro.Exited += modeRemoved;
|
modeStack.Exited += modeRemoved;
|
||||||
intro.DisplayAsRoot();
|
modeStack.DisplayAsRoot();
|
||||||
});
|
});
|
||||||
|
|
||||||
(Chat = new ChatConsole(API)).Preload(this, Add);
|
//overlay elements
|
||||||
(MusicController = new MusicController()).Preload(this, 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
|
(Toolbar = new Toolbar
|
||||||
{
|
{
|
||||||
OnHome = delegate { MainMenu?.MakeCurrent(); },
|
Depth = 2,
|
||||||
|
OnHome = delegate { mainMenu?.MakeCurrent(); },
|
||||||
OnSettings = Options.ToggleVisibility,
|
OnSettings = Options.ToggleVisibility,
|
||||||
OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; },
|
OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; },
|
||||||
OnMusicController = MusicController.ToggleVisibility
|
OnMusicController = musicController.ToggleVisibility
|
||||||
}).Preload(this, t =>
|
}).Preload(this, t =>
|
||||||
{
|
{
|
||||||
PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); };
|
PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); };
|
||||||
PlayMode.TriggerChange();
|
PlayMode.TriggerChange();
|
||||||
Add(Toolbar);
|
overlayContent.Add(Toolbar);
|
||||||
});
|
});
|
||||||
|
|
||||||
Cursor.Alpha = 0;
|
Cursor.Alpha = 0;
|
||||||
@ -133,7 +143,7 @@ namespace osu.Game
|
|||||||
switch (args.Key)
|
switch (args.Key)
|
||||||
{
|
{
|
||||||
case Key.F8:
|
case Key.F8:
|
||||||
Chat.ToggleVisibility();
|
chat.ToggleVisibility();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,6 +164,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
private Container mainContent;
|
private Container mainContent;
|
||||||
|
|
||||||
|
private Container overlayContent;
|
||||||
|
|
||||||
private void modeChanged(GameMode newMode)
|
private void modeChanged(GameMode newMode)
|
||||||
{
|
{
|
||||||
// - Ability to change window size
|
// - Ability to change window size
|
||||||
@ -161,10 +173,10 @@ namespace osu.Game
|
|||||||
// - Frame limiter changes
|
// - Frame limiter changes
|
||||||
|
|
||||||
//central game mode change logic.
|
//central game mode change logic.
|
||||||
if (newMode is Player || newMode is Intro)
|
if ((newMode as OsuGameMode)?.ShowToolbar != true)
|
||||||
{
|
{
|
||||||
Toolbar.State = Visibility.Hidden;
|
Toolbar.State = Visibility.Hidden;
|
||||||
Chat.State = Visibility.Hidden;
|
chat.State = Visibility.Hidden;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -41,8 +41,8 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
Dependencies.Cache(this);
|
Dependencies.Cache(this);
|
||||||
Dependencies.Cache(new OsuConfigManager(Host.Storage));
|
Dependencies.Cache(new OsuConfigManager(Host.Storage));
|
||||||
@ -68,13 +68,10 @@ namespace osu.Game
|
|||||||
|
|
||||||
AddInternal(ratioContainer = new RatioAdjust());
|
AddInternal(ratioContainer = new RatioAdjust());
|
||||||
|
|
||||||
var options = new OptionsOverlay();
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
options,
|
|
||||||
Cursor = new OsuCursorContainer { Depth = float.MaxValue }
|
Cursor = new OsuCursorContainer { Depth = float.MaxValue }
|
||||||
};
|
};
|
||||||
Dependencies.Cache(options);
|
|
||||||
|
|
||||||
Beatmap.ValueChanged += Beatmap_ValueChanged;
|
Beatmap.ValueChanged += Beatmap_ValueChanged;
|
||||||
|
|
||||||
|
@ -56,8 +56,8 @@ namespace osu.Game.Overlays
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
initializeChannels();
|
initializeChannels();
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ using osu.Framework.Graphics.Transformations;
|
|||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
@ -26,7 +27,9 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
public class MusicController : OverlayContainer
|
public class MusicController : OverlayContainer
|
||||||
{
|
{
|
||||||
private Sprite backgroundSprite;
|
private static readonly Vector2 start_position = new Vector2(10, 60);
|
||||||
|
|
||||||
|
private MusicControllerBackground backgroundSprite;
|
||||||
private DragBar progress;
|
private DragBar progress;
|
||||||
private TextAwesome playButton, listButton;
|
private TextAwesome playButton, listButton;
|
||||||
private SpriteText title, artist;
|
private SpriteText title, artist;
|
||||||
@ -38,27 +41,30 @@ namespace osu.Game.Overlays
|
|||||||
private int playHistoryIndex = -1;
|
private int playHistoryIndex = -1;
|
||||||
|
|
||||||
private TrackManager trackManager;
|
private TrackManager trackManager;
|
||||||
private BeatmapDatabase database;
|
|
||||||
private Bindable<WorkingBeatmap> beatmapSource;
|
private Bindable<WorkingBeatmap> beatmapSource;
|
||||||
|
private Bindable<bool> preferUnicode;
|
||||||
|
private OsuConfigManager config;
|
||||||
private WorkingBeatmap current;
|
private WorkingBeatmap current;
|
||||||
|
private BeatmapDatabase beatmaps;
|
||||||
|
|
||||||
public MusicController(BeatmapDatabase db = null)
|
public MusicController()
|
||||||
{
|
{
|
||||||
database = db;
|
|
||||||
Width = 400;
|
Width = 400;
|
||||||
Height = 130;
|
Height = 130;
|
||||||
CornerRadius = 5;
|
CornerRadius = 5;
|
||||||
|
EdgeEffect = new EdgeEffect
|
||||||
|
{
|
||||||
|
Type = EdgeEffectType.Shadow,
|
||||||
|
Colour = new Color4(0, 0, 0, 40),
|
||||||
|
Radius = 5,
|
||||||
|
};
|
||||||
|
|
||||||
Masking = true;
|
Masking = true;
|
||||||
Anchor = Anchor.TopRight;//placeholder
|
Anchor = Anchor.TopRight;//placeholder
|
||||||
Origin = Anchor.TopRight;
|
Origin = Anchor.TopRight;
|
||||||
Position = new Vector2(10, 60);
|
Position = start_position;
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = new Color4(0, 0, 0, 127)
|
|
||||||
},
|
|
||||||
title = new SpriteText
|
title = new SpriteText
|
||||||
{
|
{
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
@ -79,14 +85,6 @@ namespace osu.Game.Overlays
|
|||||||
Text = @"Nothing to play",
|
Text = @"Nothing to play",
|
||||||
Font = @"Exo2.0-BoldItalic"
|
Font = @"Exo2.0-BoldItalic"
|
||||||
},
|
},
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Height = 50,
|
|
||||||
Origin = Anchor.BottomCentre,
|
|
||||||
Anchor = Anchor.BottomCentre,
|
|
||||||
Colour = new Color4(0, 0, 0, 127)
|
|
||||||
},
|
|
||||||
new ClickableContainer
|
new ClickableContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
@ -176,16 +174,38 @@ namespace osu.Game.Overlays
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer(permitNulls: true)]
|
protected override bool OnDragStart(InputState state) => true;
|
||||||
private void Load(OsuGame osuGame, BeatmapDatabase beatmaps, AudioManager audio, TextureStore textures)
|
|
||||||
|
protected override bool OnDrag(InputState state)
|
||||||
{
|
{
|
||||||
if (database == null) database = beatmaps;
|
Vector2 change = (state.Mouse.Position - state.Mouse.PositionMouseDown.Value);
|
||||||
trackManager = audio.Track;
|
change.X = -change.X;
|
||||||
|
|
||||||
beatmapSource = osuGame?.Beatmap ?? new Bindable<WorkingBeatmap>();
|
change *= (float)Math.Pow(change.Length, 0.7f) / change.Length;
|
||||||
playList = database.GetAllWithChildren<BeatmapSetInfo>();
|
|
||||||
|
|
||||||
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);
|
AddInternal(backgroundSprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,6 +227,11 @@ namespace osu.Game.Overlays
|
|||||||
if (current.Track.HasCompleted && !current.Track.Looping) next();
|
if (current.Track.HasCompleted && !current.Track.Looping) next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void preferUnicode_changed(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
updateDisplay(current, false);
|
||||||
|
}
|
||||||
|
|
||||||
private void workingChanged(object sender = null, EventArgs e = null)
|
private void workingChanged(object sender = null, EventArgs e = null)
|
||||||
{
|
{
|
||||||
if (beatmapSource.Value == current) return;
|
if (beatmapSource.Value == current) return;
|
||||||
@ -266,7 +291,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private void play(BeatmapInfo info, bool isNext)
|
private void play(BeatmapInfo info, bool isNext)
|
||||||
{
|
{
|
||||||
current = database.GetWorkingBeatmap(info, current);
|
current = beatmaps.GetWorkingBeatmap(info, current);
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
trackManager.SetExclusive(current.Track);
|
trackManager.SetExclusive(current.Track);
|
||||||
@ -278,11 +303,15 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private void updateDisplay(WorkingBeatmap beatmap, bool? isNext)
|
private void updateDisplay(WorkingBeatmap beatmap, bool? isNext)
|
||||||
{
|
{
|
||||||
BeatmapMetadata metadata = beatmap.Beatmap.Metadata;
|
if (beatmap.Beatmap == null)
|
||||||
title.Text = metadata.TitleUnicode ?? metadata.Title;
|
//todo: we may need to display some default text here (currently in the constructor).
|
||||||
artist.Text = metadata.ArtistUnicode ?? metadata.Artist;
|
return;
|
||||||
|
|
||||||
Sprite newBackground = getScaledSprite(beatmap.Background ?? fallbackTexture);
|
BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata;
|
||||||
|
title.Text = config.GetUnicodeString(metadata.Title, metadata.TitleUnicode);
|
||||||
|
artist.Text = config.GetUnicodeString(metadata.Artist, metadata.ArtistUnicode);
|
||||||
|
|
||||||
|
MusicControllerBackground newBackground = new MusicControllerBackground(beatmap.Background ?? fallbackTexture);
|
||||||
|
|
||||||
Add(newBackground);
|
Add(newBackground);
|
||||||
|
|
||||||
@ -303,34 +332,61 @@ namespace osu.Game.Overlays
|
|||||||
backgroundSprite = newBackground;
|
backgroundSprite = newBackground;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Sprite getScaledSprite(Texture background)
|
|
||||||
{
|
|
||||||
Sprite scaledSprite = new Sprite
|
|
||||||
{
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Texture = background,
|
|
||||||
Depth = float.MinValue
|
|
||||||
};
|
|
||||||
scaledSprite.Scale = new Vector2(Math.Max(DrawSize.X / scaledSprite.DrawSize.X, DrawSize.Y / scaledSprite.DrawSize.Y));
|
|
||||||
return scaledSprite;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void seek(float position)
|
private void seek(float position)
|
||||||
{
|
{
|
||||||
current?.Track?.Seek(current.Track.Length * position);
|
current?.Track?.Seek(current.Track.Length * position);
|
||||||
current?.Track?.Start();
|
current?.Track?.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
if (preferUnicode != null)
|
||||||
|
preferUnicode.ValueChanged -= preferUnicode_changed;
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnClick(InputState state) => true;
|
protected override bool OnClick(InputState state) => true;
|
||||||
|
|
||||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
|
||||||
|
|
||||||
protected override bool OnDragStart(InputState state) => true;
|
|
||||||
|
|
||||||
//placeholder for toggling
|
//placeholder for toggling
|
||||||
protected override void PopIn() => FadeIn(100);
|
protected override void PopIn() => FadeIn(100);
|
||||||
|
|
||||||
protected override void PopOut() => FadeOut(100);
|
protected override void PopOut() => FadeOut(100);
|
||||||
|
|
||||||
|
private class MusicControllerBackground : BufferedContainer
|
||||||
|
{
|
||||||
|
private Sprite sprite;
|
||||||
|
|
||||||
|
public MusicControllerBackground(Texture backgroundTexture)
|
||||||
|
{
|
||||||
|
CacheDrawnFrameBuffer = true;
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
Depth = float.MinValue;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
sprite = new Sprite
|
||||||
|
{
|
||||||
|
Texture = backgroundTexture,
|
||||||
|
Colour = new Color4(150, 150, 150, 255)
|
||||||
|
},
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 50,
|
||||||
|
Origin = Anchor.BottomCentre,
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Colour = new Color4(0, 0, 0, 127)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
sprite.Scale = new Vector2(Math.Max(DrawSize.X / sprite.DrawSize.X, DrawSize.Y / sprite.DrawSize.Y));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.Audio
|
namespace osu.Game.Overlays.Options.Audio
|
||||||
{
|
{
|
||||||
public class AudioSection : OptionsSection
|
public class AudioSection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "Audio";
|
public override string Header => "Audio";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_headphones;
|
public override FontAwesome Icon => FontAwesome.fa_headphones;
|
||||||
|
|
||||||
public AudioSection()
|
public AudioSection()
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new AudioDevicesOptions(),
|
new AudioDevicesOptions { Alpha = RuntimeInfo.IsWindows ? 1 : 0 },
|
||||||
new VolumeOptions(),
|
new VolumeOptions(),
|
||||||
new OffsetAdjustmentOptions(),
|
new OffsetAdjustmentOptions(),
|
||||||
};
|
};
|
||||||
|
@ -17,8 +17,8 @@ namespace osu.Game.Overlays.Options.Audio
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -10,11 +10,11 @@ namespace osu.Game.Overlays.Options
|
|||||||
{
|
{
|
||||||
public class EditorSection : OptionsSection
|
public class EditorSection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "Editor";
|
public override string Header => "Editor";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_pencil;
|
public override FontAwesome Icon => FontAwesome.fa_pencil;
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
content.Spacing = new Vector2(0, 5);
|
content.Spacing = new Vector2(0, 5);
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
|
@ -5,7 +5,7 @@ namespace osu.Game.Overlays.Options.Gameplay
|
|||||||
{
|
{
|
||||||
public class GameplaySection : OptionsSection
|
public class GameplaySection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "Gameplay";
|
public override string Header => "Gameplay";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_circle_o;
|
public override FontAwesome Icon => FontAwesome.fa_circle_o;
|
||||||
|
|
||||||
public GameplaySection()
|
public GameplaySection()
|
||||||
|
@ -11,8 +11,8 @@ namespace osu.Game.Overlays.Options.Gameplay
|
|||||||
{
|
{
|
||||||
protected override string Header => "General";
|
protected override string Header => "General";
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@ namespace osu.Game.Overlays.Options.General
|
|||||||
{
|
{
|
||||||
public class GeneralSection : OptionsSection
|
public class GeneralSection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "General";
|
public override string Header => "General";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_gear;
|
public override FontAwesome Icon => FontAwesome.fa_gear;
|
||||||
|
|
||||||
public GeneralSection()
|
public GeneralSection()
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.General
|
namespace osu.Game.Overlays.Options.General
|
||||||
{
|
{
|
||||||
public class LanguageOptions : OptionsSubsection
|
public class LanguageOptions : OptionsSubsection
|
||||||
{
|
{
|
||||||
protected override string Header => "Language";
|
protected override string Header => "Language";
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -27,6 +27,6 @@ namespace osu.Game.Overlays.Options.General
|
|||||||
Bindable = config.GetBindable<bool>(OsuConfig.AlternativeChatFont)
|
Bindable = config.GetBindable<bool>(OsuConfig.AlternativeChatFont)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.General
|
namespace osu.Game.Overlays.Options.General
|
||||||
{
|
{
|
||||||
public class LoginOptions : OptionsSubsection
|
public class LoginOptions : OptionsSubsection
|
||||||
@ -28,15 +28,15 @@ namespace osu.Game.Overlays.Options.General
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void Load(APIAccess api)
|
private void load(APIAccess api)
|
||||||
{
|
{
|
||||||
if (api == null)
|
if (api == null)
|
||||||
return;
|
return;
|
||||||
loginForm.Children = new Drawable[]
|
loginForm.Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new LoginForm(api)
|
new LoginForm(api)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
class LoginForm : FlowContainer
|
class LoginForm : FlowContainer
|
||||||
|
@ -5,14 +5,14 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.General
|
namespace osu.Game.Overlays.Options.General
|
||||||
{
|
{
|
||||||
public class UpdateOptions : OptionsSubsection
|
public class UpdateOptions : OptionsSubsection
|
||||||
{
|
{
|
||||||
protected override string Header => "Updates";
|
protected override string Header => "Updates";
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(BasicStorage storage)
|
private void load(BasicStorage storage)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Options.General
|
|||||||
Action = () => storage.OpenInNativeExplorer(),
|
Action = () => storage.OpenInNativeExplorer(),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ namespace osu.Game.Overlays.Options.Graphics
|
|||||||
{
|
{
|
||||||
protected override string Header => "Detail Settings";
|
protected override string Header => "Detail Settings";
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@ namespace osu.Game.Overlays.Options.Graphics
|
|||||||
{
|
{
|
||||||
public class GraphicsSection : OptionsSection
|
public class GraphicsSection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "Graphics";
|
public override string Header => "Graphics";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_laptop;
|
public override FontAwesome Icon => FontAwesome.fa_laptop;
|
||||||
|
|
||||||
public GraphicsSection()
|
public GraphicsSection()
|
||||||
|
@ -5,14 +5,14 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.Graphics
|
namespace osu.Game.Overlays.Options.Graphics
|
||||||
{
|
{
|
||||||
public class LayoutOptions : OptionsSubsection
|
public class LayoutOptions : OptionsSubsection
|
||||||
{
|
{
|
||||||
protected override string Header => "Layout";
|
protected override string Header => "Layout";
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -32,6 +32,6 @@ namespace osu.Game.Overlays.Options.Graphics
|
|||||||
new SpriteText { Text = "Vertical position" },
|
new SpriteText { Text = "Vertical position" },
|
||||||
new SpriteText { Text = "TODO: slider" },
|
new SpriteText { Text = "TODO: slider" },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,8 +9,8 @@ namespace osu.Game.Overlays.Options.Graphics
|
|||||||
{
|
{
|
||||||
protected override string Header => "Main Menu";
|
protected override string Header => "Main Menu";
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
|
@ -5,14 +5,14 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.Graphics
|
namespace osu.Game.Overlays.Options.Graphics
|
||||||
{
|
{
|
||||||
public class RendererOptions : OptionsSubsection
|
public class RendererOptions : OptionsSubsection
|
||||||
{
|
{
|
||||||
protected override string Header => "Renderer";
|
protected override string Header => "Renderer";
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
// NOTE: Compatability mode omitted
|
// NOTE: Compatability mode omitted
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -34,6 +34,6 @@ namespace osu.Game.Overlays.Options.Graphics
|
|||||||
Bindable = config.GetBindable<bool>(OsuConfig.DetectPerformanceIssues),
|
Bindable = config.GetBindable<bool>(OsuConfig.DetectPerformanceIssues),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,8 +9,8 @@ namespace osu.Game.Overlays.Options.Graphics
|
|||||||
{
|
{
|
||||||
protected override string Header => "Song Select";
|
protected override string Header => "Song Select";
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@ namespace osu.Game.Overlays.Options.Input
|
|||||||
{
|
{
|
||||||
public class InputSection : OptionsSection
|
public class InputSection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "Input";
|
public override string Header => "Input";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_keyboard_o;
|
public override FontAwesome Icon => FontAwesome.fa_keyboard_o;
|
||||||
|
|
||||||
public InputSection()
|
public InputSection()
|
||||||
|
@ -17,8 +17,8 @@ namespace osu.Game.Overlays.Options.Input
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -10,8 +10,8 @@ namespace osu.Game.Overlays.Options.Input
|
|||||||
{
|
{
|
||||||
protected override string Header => "Other";
|
protected override string Header => "Other";
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ namespace osu.Game.Overlays.Options
|
|||||||
{
|
{
|
||||||
public class MaintenanceSection : OptionsSection
|
public class MaintenanceSection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "Maintenance";
|
public override string Header => "Maintenance";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_wrench;
|
public override FontAwesome Icon => FontAwesome.fa_wrench;
|
||||||
|
|
||||||
public MaintenanceSection()
|
public MaintenanceSection()
|
||||||
|
@ -9,10 +9,12 @@ namespace osu.Game.Overlays.Options.Online
|
|||||||
{
|
{
|
||||||
public class InGameChatOptions : OptionsSubsection
|
public class InGameChatOptions : OptionsSubsection
|
||||||
{
|
{
|
||||||
|
private TextBoxOption chatIgnoreList;
|
||||||
|
private TextBoxOption chatHighlightWords;
|
||||||
protected override string Header => "In-game Chat";
|
protected override string Header => "In-game Chat";
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -37,10 +39,18 @@ namespace osu.Game.Overlays.Options.Online
|
|||||||
Bindable = config.GetBindable<bool>(OsuConfig.BlockNonFriendPM)
|
Bindable = config.GetBindable<bool>(OsuConfig.BlockNonFriendPM)
|
||||||
},
|
},
|
||||||
new SpriteText { Text = "Chat ignore list (space-seperated list)" },
|
new SpriteText { Text = "Chat ignore list (space-seperated list)" },
|
||||||
new TextBox { Height = 20, RelativeSizeAxes = Axes.X },
|
chatIgnoreList = new TextBoxOption {
|
||||||
|
Height = 20,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Bindable = config.GetBindable<string>(OsuConfig.IgnoreList)
|
||||||
|
},
|
||||||
new SpriteText { Text = "Chat highlight words (space-seperated list)" },
|
new SpriteText { Text = "Chat highlight words (space-seperated list)" },
|
||||||
new TextBox { Height = 20, RelativeSizeAxes = Axes.X },
|
chatHighlightWords = new TextBoxOption {
|
||||||
|
Height = 20,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Bindable = config.GetBindable<string>(OsuConfig.HighlightWords)
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,8 +10,8 @@ namespace osu.Game.Overlays.Options.Online
|
|||||||
{
|
{
|
||||||
protected override string Header => "Notifications";
|
protected override string Header => "Notifications";
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -10,8 +10,8 @@ namespace osu.Game.Overlays.Options.Online
|
|||||||
{
|
{
|
||||||
protected override string Header => "Integration";
|
protected override string Header => "Integration";
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@ namespace osu.Game.Overlays.Options.Online
|
|||||||
{
|
{
|
||||||
public class OnlineSection : OptionsSection
|
public class OnlineSection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "Online";
|
public override string Header => "Online";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_globe;
|
public override FontAwesome Icon => FontAwesome.fa_globe;
|
||||||
|
|
||||||
public OnlineSection()
|
public OnlineSection()
|
||||||
|
@ -10,8 +10,8 @@ namespace osu.Game.Overlays.Options.Online
|
|||||||
{
|
{
|
||||||
protected override string Header => "Privacy";
|
protected override string Header => "Privacy";
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Overlays.Options
|
|||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
public abstract FontAwesome Icon { get; }
|
public abstract FontAwesome Icon { get; }
|
||||||
protected abstract string Header { get; }
|
public abstract string Header { get; }
|
||||||
|
|
||||||
public OptionsSection()
|
public OptionsSection()
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,9 @@ using OpenTK.Graphics;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options
|
namespace osu.Game.Overlays.Options
|
||||||
@ -12,6 +14,7 @@ namespace osu.Game.Overlays.Options
|
|||||||
public class OptionsSidebar : Container
|
public class OptionsSidebar : Container
|
||||||
{
|
{
|
||||||
private FlowContainer content;
|
private FlowContainer content;
|
||||||
|
internal const int default_width = 60, expanded_width = 200;
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
public OptionsSidebar()
|
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
|
private class SidebarScrollContainer : ScrollContainer
|
||||||
{
|
{
|
||||||
public SidebarScrollContainer()
|
public SidebarScrollContainer()
|
||||||
@ -53,6 +75,7 @@ namespace osu.Game.Overlays.Options
|
|||||||
public class SidebarButton : Container
|
public class SidebarButton : Container
|
||||||
{
|
{
|
||||||
private TextAwesome drawableIcon;
|
private TextAwesome drawableIcon;
|
||||||
|
private SpriteText headerText;
|
||||||
private Box backgroundBox;
|
private Box backgroundBox;
|
||||||
public Action Action;
|
public Action Action;
|
||||||
|
|
||||||
@ -61,10 +84,17 @@ namespace osu.Game.Overlays.Options
|
|||||||
get { return drawableIcon.Icon; }
|
get { return drawableIcon.Icon; }
|
||||||
set { drawableIcon.Icon = value; }
|
set { drawableIcon.Icon = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Header
|
||||||
|
{
|
||||||
|
get { return headerText.Text; }
|
||||||
|
set { headerText.Text = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public SidebarButton()
|
public SidebarButton()
|
||||||
{
|
{
|
||||||
Size = new Vector2(60);
|
Height = default_width;
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
backgroundBox = new Box
|
backgroundBox = new Box
|
||||||
@ -74,11 +104,25 @@ namespace osu.Game.Overlays.Options
|
|||||||
Colour = new Color4(60, 60, 60, 255),
|
Colour = new Color4(60, 60, 60, 255),
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
},
|
},
|
||||||
drawableIcon = new TextAwesome
|
new Container
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Width = default_width,
|
||||||
Origin = Anchor.Centre,
|
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)
|
protected override bool OnHover(InputState state)
|
||||||
{
|
{
|
||||||
backgroundBox.FadeTo(0.4f, 200);
|
backgroundBox.FadeTo(0.4f, 200);
|
||||||
return true;
|
return base.OnHover(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHoverLost(InputState state)
|
protected override void OnHoverLost(InputState state)
|
||||||
{
|
{
|
||||||
backgroundBox.FadeTo(0, 200);
|
backgroundBox.FadeTo(0, 200);
|
||||||
|
base.OnHoverLost(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,11 +12,11 @@ namespace osu.Game.Overlays.Options
|
|||||||
{
|
{
|
||||||
public class SkinSection : OptionsSection
|
public class SkinSection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "Skin";
|
public override string Header => "Skin";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_paint_brush;
|
public override FontAwesome Icon => FontAwesome.fa_paint_brush;
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
content.Spacing = new Vector2(0, 5);
|
content.Spacing = new Vector2(0, 5);
|
||||||
Children = new Drawable[]
|
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;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Transformations;
|
using osu.Framework.Graphics.Transformations;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Overlays.Options;
|
using osu.Game.Overlays.Options;
|
||||||
using osu.Game.Overlays.Options.Audio;
|
using osu.Game.Overlays.Options.Audio;
|
||||||
using osu.Game.Overlays.Options.Gameplay;
|
using osu.Game.Overlays.Options.Gameplay;
|
||||||
@ -27,7 +30,8 @@ namespace osu.Game.Overlays
|
|||||||
internal const float CONTENT_MARGINS = 10;
|
internal const float CONTENT_MARGINS = 10;
|
||||||
|
|
||||||
private const float width = 400;
|
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 ScrollContainer scrollContainer;
|
||||||
private OptionsSidebar sidebar;
|
private OptionsSidebar sidebar;
|
||||||
@ -72,6 +76,7 @@ namespace osu.Game.Overlays
|
|||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Direction = FlowDirection.VerticalOnly,
|
Direction = FlowDirection.VerticalOnly,
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SpriteText
|
new SpriteText
|
||||||
@ -105,13 +110,20 @@ namespace osu.Game.Overlays
|
|||||||
new OptionsSidebar.SidebarButton
|
new OptionsSidebar.SidebarButton
|
||||||
{
|
{
|
||||||
Icon = section.Icon,
|
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 OnMouseDown(InputState state, MouseDownEventArgs args) => true;
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
|
@ -112,8 +112,8 @@ namespace osu.Game.Overlays
|
|||||||
Size = new Vector2(1, height);
|
Size = new Vector2(1, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
userButton.Text = config.Get<string>(OsuConfig.Username);
|
userButton.Text = config.Get<string>(OsuConfig.Username);
|
||||||
}
|
}
|
||||||
|
@ -105,10 +105,11 @@ namespace osu.Game.Overlays
|
|||||||
tooltip1 = new SpriteText
|
tooltip1 = new SpriteText
|
||||||
{
|
{
|
||||||
TextSize = 22,
|
TextSize = 22,
|
||||||
|
Font = @"Exo2.0-Bold",
|
||||||
},
|
},
|
||||||
tooltip2 = new SpriteText
|
tooltip2 = new SpriteText
|
||||||
{
|
{
|
||||||
TextSize = 15
|
TextSize = 16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,8 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
DrawableIcon.TextSize *= 1.4f;
|
DrawableIcon.TextSize *= 1.4f;
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,8 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.Y;
|
RelativeSizeAxes = Axes.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Initializer]
|
[BackgroundDependencyLoader]
|
||||||
private void Load()
|
private void load()
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -121,13 +121,18 @@
|
|||||||
<Compile Include="GameModes\Multiplayer\MatchCreate.cs" />
|
<Compile Include="GameModes\Multiplayer\MatchCreate.cs" />
|
||||||
<Compile Include="GameModes\Multiplayer\MatchSongSelect.cs" />
|
<Compile Include="GameModes\Multiplayer\MatchSongSelect.cs" />
|
||||||
<Compile Include="GameModes\OsuGameMode.cs" />
|
<Compile Include="GameModes\OsuGameMode.cs" />
|
||||||
|
<Compile Include="GameModes\Play\Catch\CatchRuleset.cs" />
|
||||||
|
<Compile Include="GameModes\Play\Mania\ManiaRuleset.cs" />
|
||||||
<Compile Include="GameModes\Play\ModSelect.cs" />
|
<Compile Include="GameModes\Play\ModSelect.cs" />
|
||||||
|
<Compile Include="GameModes\Play\Osu\OsuRuleset.cs" />
|
||||||
<Compile Include="GameModes\Play\Osu\ScoreOverlayOsu.cs" />
|
<Compile Include="GameModes\Play\Osu\ScoreOverlayOsu.cs" />
|
||||||
<Compile Include="Beatmaps\Drawable\BeatmapGroup.cs" />
|
<Compile Include="Beatmaps\Drawable\BeatmapGroup.cs" />
|
||||||
<Compile Include="Beatmaps\Drawable\BeatmapPanel.cs" />
|
<Compile Include="Beatmaps\Drawable\BeatmapPanel.cs" />
|
||||||
<Compile Include="GameModes\Play\Player.cs" />
|
<Compile Include="GameModes\Play\Player.cs" />
|
||||||
<Compile Include="GameModes\Charts\ChartListing.cs" />
|
<Compile Include="GameModes\Charts\ChartListing.cs" />
|
||||||
<Compile Include="GameModes\Play\PlayMode.cs" />
|
<Compile Include="GameModes\Play\PlayMode.cs" />
|
||||||
|
<Compile Include="GameModes\Play\Ruleset.cs" />
|
||||||
|
<Compile Include="GameModes\Play\Taiko\TaikoRuleset.cs" />
|
||||||
<Compile Include="GameModes\Ranking\Results.cs" />
|
<Compile Include="GameModes\Ranking\Results.cs" />
|
||||||
<Compile Include="GameModes\Direct\OnlineListing.cs" />
|
<Compile Include="GameModes\Direct\OnlineListing.cs" />
|
||||||
<Compile Include="GameModes\Play\PlaySongSelect.cs" />
|
<Compile Include="GameModes\Play\PlaySongSelect.cs" />
|
||||||
@ -234,6 +239,7 @@
|
|||||||
<Compile Include="Overlays\Options\Online\PrivacyOptions.cs" />
|
<Compile Include="Overlays\Options\Online\PrivacyOptions.cs" />
|
||||||
<Compile Include="Overlays\Options\Online\NotificationsOptions.cs" />
|
<Compile Include="Overlays\Options\Online\NotificationsOptions.cs" />
|
||||||
<Compile Include="Overlays\Options\CheckBoxOption.cs" />
|
<Compile Include="Overlays\Options\CheckBoxOption.cs" />
|
||||||
|
<Compile Include="Overlays\Options\TextBoxOption.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
|
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
|
||||||
|
Loading…
Reference in New Issue
Block a user