diff --git a/.vscode/launch.json b/.vscode/launch.json index d9a6ae12ff..f1682a2ce2 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "name": "Launch", "type": "mono", "request": "launch", - "program": "${workspaceRoot}/osu.Desktop/bin/Debug/osu!.exe", + "program": "${workspaceRoot}/osu.Desktop.VisualTests/bin/Debug/osu!.exe", "args": [], "cwd": "${workspaceRoot}", "preLaunchTask": "", diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..20af2f68a6 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +// Place your settings in this file to overwrite default and user settings. +{ +} \ No newline at end of file diff --git a/osu-framework b/osu-framework index eb16219058..aa01720fe9 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit eb16219058e87210c9ad90b1e214ccc2c1556058 +Subproject commit aa01720fe9eb6e3b30a4455298a1c6eca7fb7680 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs index 070745a49c..36b2c49274 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.GameModes.Testing; using osu.Game.Overlays; @@ -24,9 +25,9 @@ namespace osu.Desktop.Tests protected MusicController mc; - protected override void Load(BaseGame game) + [Initializer] + private void Load() { - base.Load(game); ourClock = new FramedClock(); } diff --git a/osu.Game/GameModes/OsuGameMode.cs b/osu.Game/GameModes/OsuGameMode.cs index 33889e3689..18219b152d 100644 --- a/osu.Game/GameModes/OsuGameMode.cs +++ b/osu.Game/GameModes/OsuGameMode.cs @@ -8,6 +8,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using osu.Framework; +using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.GameModes; using osu.Framework.Graphics.Containers; @@ -69,10 +70,10 @@ namespace osu.Game.GameModes OnBeatmapChanged(beatmap.Value); } - protected override void Load(BaseGame game) + [Initializer(permitNulls: true)] + private void Load(OsuGameBase game) { - base.Load(game); - beatmap = (game as OsuGameBase)?.Beatmap; + beatmap = game?.Beatmap; } public override bool Push(GameMode mode) diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index 370f7fbbe9..52029dbf8e 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -16,16 +16,7 @@ namespace osu.Game.Graphics.Containers public ParallaxContainer() { RelativeSizeAxes = Axes.Both; - } - - private Container content; - - protected override Container Content => content; - - [Initializer] - private void Load() - { - AddInternal(content = new Container() + AddInternal(content = new Container { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, @@ -33,6 +24,10 @@ namespace osu.Game.Graphics.Containers }); } + private Container content; + + protected override Container Content => content; + protected override bool OnMouseMove(InputState state) { content.Position = (state.Mouse.Position - DrawSize / 2) * ParallaxAmount; diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 5b5134cd4f..490389237f 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -64,6 +64,8 @@ namespace osu.Game if (args?.Length > 0) Schedule(delegate { Dependencies.Get().Import(args); }); + Dependencies.Cache(this); + //attach our bindables to the audio subsystem. Audio.Volume.Weld(Config.GetBindable(OsuConfig.VolumeUniversal)); Audio.VolumeSample.Weld(Config.GetBindable(OsuConfig.VolumeEffect)); @@ -93,7 +95,7 @@ namespace osu.Game } }); - (Options = new OptionsOverlay { Depth = float.MaxValue / 2 }).Preload(game, Add); + (Options = new OptionsOverlay { Depth = float.MaxValue / 2 }).Preload(this, Add); (intro = new Intro { diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 1288473934..2ca8c452a5 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -67,14 +67,14 @@ namespace osu.Game Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BlackItalic")); AddInternal(ratioContainer = new RatioAdjust()); - + + var options = new OptionsOverlay(); Children = new Drawable[] { - Options = new OptionsOverlay(), + options, Cursor = new OsuCursorContainer { Depth = float.MaxValue } }; - - Dependencies.Cache(Options); + Dependencies.Cache(options); Beatmap.ValueChanged += Beatmap_ValueChanged; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 310bae37e4..4043c10327 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -7,6 +7,8 @@ using System.Threading.Tasks; using OpenTK; using OpenTK.Graphics; using osu.Framework; +using osu.Framework.Allocation; +using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -174,21 +176,16 @@ namespace osu.Game.Overlays }; } - protected override void Load(BaseGame game) + [Initializer(permitNulls: true)] + private void Load(OsuGame osuGame, BeatmapDatabase beatmaps, AudioManager audio, TextureStore textures) { - base.Load(game); - var osuGame = game as OsuGameBase; - - if (osuGame != null) - { - if (database == null) database = osuGame.Beatmaps; - trackManager = osuGame.Audio.Track; - } + if (database == null) database = beatmaps; + trackManager = audio.Track; beatmapSource = osuGame?.Beatmap ?? new Bindable(); playList = database.GetAllWithChildren(); - backgroundSprite = getScaledSprite(fallbackTexture = game.Textures.Get(@"Backgrounds/bg4")); + backgroundSprite = getScaledSprite(fallbackTexture = textures.Get(@"Backgrounds/bg4")); AddInternal(backgroundSprite); } diff --git a/osu.Game/Overlays/Options/Audio/VolumeOptions.cs b/osu.Game/Overlays/Options/Audio/VolumeOptions.cs index f9c2326123..adf7e923f7 100644 --- a/osu.Game/Overlays/Options/Audio/VolumeOptions.cs +++ b/osu.Game/Overlays/Options/Audio/VolumeOptions.cs @@ -1,36 +1,36 @@ using osu.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Game.Configuration; -namespace osu.Game.Overlays.Options.Audio -{ - public class VolumeOptions : OptionsSubsection - { +namespace osu.Game.Overlays.Options.Audio +{ + public class VolumeOptions : OptionsSubsection + { protected override string Header => "Volume"; - private CheckBoxOption ignoreHitsounds; - - public VolumeOptions() - { - Children = new Drawable[] - { - new SpriteText { Text = "Master: TODO slider" }, - new SpriteText { Text = "Music: TODO slider" }, - new SpriteText { Text = "Effect: TODO slider" }, - ignoreHitsounds = new CheckBoxOption { LabelText = "Ignore beatmap hitsounds" } - }; + private CheckBoxOption ignoreHitsounds; + + public VolumeOptions() + { } - protected override void Load(BaseGame game) + [Initializer] + private void Load(OsuConfigManager config) { - base.Load(game); - var osuGame = game as OsuGameBase; - if (osuGame != null) + Children = new Drawable[] { - ignoreHitsounds.Bindable = osuGame.Config.GetBindable(OsuConfig.IgnoreBeatmapSamples); - } - } - } + new SpriteText { Text = "Master: TODO slider" }, + new SpriteText { Text = "Music: TODO slider" }, + new SpriteText { Text = "Effect: TODO slider" }, + new CheckBoxOption + { + LabelText = "Ignore beatmap hitsounds", + Bindable = config.GetBindable(OsuConfig.IgnoreBeatmapSamples) + } + }; + } + } } \ No newline at end of file diff --git a/osu.Game/Overlays/Options/EditorSection.cs b/osu.Game/Overlays/Options/EditorSection.cs index be02af7c7b..998f31c77c 100644 --- a/osu.Game/Overlays/Options/EditorSection.cs +++ b/osu.Game/Overlays/Options/EditorSection.cs @@ -1,47 +1,56 @@ using OpenTK; using osu.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; using osu.Game.Configuration; using osu.Game.Graphics; -namespace osu.Game.Overlays.Options -{ - public class EditorSection : OptionsSection - { - protected override string Header => "Editor"; +namespace osu.Game.Overlays.Options +{ + public class EditorSection : OptionsSection + { + protected override string Header => "Editor"; public override FontAwesome Icon => FontAwesome.fa_pencil; - private CheckBoxOption backgroundVideo, defaultSkin, snakingSliders, hitAnimations, followPoints, stacking; - - public EditorSection() - { - content.Spacing = new Vector2(0, 5); - Children = new Drawable[] - { - backgroundVideo = new CheckBoxOption { LabelText = "Background video" }, - defaultSkin = new CheckBoxOption { LabelText = "Always use default skin" }, - snakingSliders = new CheckBoxOption { LabelText = "Snaking sliders" }, - hitAnimations = new CheckBoxOption { LabelText = "Hit animations" }, - followPoints = new CheckBoxOption { LabelText = "Follow points" }, - stacking = new CheckBoxOption { LabelText = "Stacking" }, - }; - } - - protected override void Load(BaseGame game) + [Initializer] + private void Load(OsuConfigManager config) { - base.Load(game); - var osuGame = game as OsuGameBase; - if (osuGame != null) + content.Spacing = new Vector2(0, 5); + Children = new Drawable[] { - backgroundVideo.Bindable = osuGame.Config.GetBindable(OsuConfig.VideoEditor); - defaultSkin.Bindable = osuGame.Config.GetBindable(OsuConfig.EditorDefaultSkin); - snakingSliders.Bindable = osuGame.Config.GetBindable(OsuConfig.EditorSnakingSliders); - hitAnimations.Bindable = osuGame.Config.GetBindable(OsuConfig.EditorHitAnimations); - followPoints.Bindable = osuGame.Config.GetBindable(OsuConfig.EditorFollowPoints); - stacking.Bindable = osuGame.Config.GetBindable(OsuConfig.EditorStacking); - } - } - } -} - + new CheckBoxOption + { + LabelText = "Background video", + Bindable = config.GetBindable(OsuConfig.VideoEditor) + }, + new CheckBoxOption + { + LabelText = "Always use default skin", + Bindable = config.GetBindable(OsuConfig.EditorDefaultSkin) + }, + new CheckBoxOption + { + LabelText = "Snaking sliders", + Bindable = config.GetBindable(OsuConfig.EditorSnakingSliders) + }, + new CheckBoxOption + { + LabelText = "Hit animations", + Bindable = config.GetBindable(OsuConfig.EditorHitAnimations) + }, + new CheckBoxOption + { + LabelText = "Follow points", + Bindable = config.GetBindable(OsuConfig.EditorFollowPoints) + }, + new CheckBoxOption + { + LabelText = "Stacking", + Bindable = config.GetBindable(OsuConfig.EditorStacking) + }, + }; + } + } +} + diff --git a/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs index 4c51bddbfa..f2d6f6049d 100644 --- a/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs +++ b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs @@ -1,18 +1,18 @@ -using osu.Framework; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.UserInterface; -using osu.Game.Configuration; - +using osu.Framework; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; +using osu.Game.Configuration; + namespace osu.Game.Overlays.Options.Gameplay { public class GeneralGameplayOptions : OptionsSubsection { - protected override string Header => "General"; - - private CheckBoxOption keyOverlay, hiddenApproachCircle, scaleManiaScroll, rememberManiaScroll; + protected override string Header => "General"; - public GeneralGameplayOptions() + [Initializer] + private void Load(OsuConfigManager config) { Children = new Drawable[] { @@ -20,24 +20,27 @@ namespace osu.Game.Overlays.Options.Gameplay new SpriteText { Text = "Progress display: TODO dropdown" }, new SpriteText { Text = "Score meter type: TODO dropdown" }, new SpriteText { Text = "Score meter size: TODO slider" }, - keyOverlay = new CheckBoxOption { LabelText = "Always show key overlay" }, - hiddenApproachCircle = new CheckBoxOption { LabelText = "Show approach circle on first \"Hidden\" object" }, - scaleManiaScroll = new CheckBoxOption { LabelText = "Scale osu!mania scroll speed with BPM" }, - rememberManiaScroll = new CheckBoxOption { LabelText = "Remember osu!mania scroll speed per beatmap" }, + new CheckBoxOption + { + LabelText = "Always show key overlay", + Bindable = config.GetBindable(OsuConfig.KeyOverlay) + }, + new CheckBoxOption + { + LabelText = "Show approach circle on first \"Hidden\" object", + Bindable = config.GetBindable(OsuConfig.HiddenShowFirstApproach) + }, + new CheckBoxOption + { + LabelText = "Scale osu!mania scroll speed with BPM", + Bindable = config.GetBindable(OsuConfig.ManiaSpeedBPMScale) + }, + new CheckBoxOption + { + LabelText = "Remember osu!mania scroll speed per beatmap", + Bindable = config.GetBindable(OsuConfig.UsePerBeatmapManiaSpeed) + }, }; - } - - protected override void Load(BaseGame game) - { - base.Load(game); - var osuGame = game as OsuGameBase; - if (osuGame != null) - { - keyOverlay.Bindable = osuGame.Config.GetBindable(OsuConfig.KeyOverlay); - hiddenApproachCircle.Bindable = osuGame.Config.GetBindable(OsuConfig.HiddenShowFirstApproach); - scaleManiaScroll.Bindable = osuGame.Config.GetBindable(OsuConfig.ManiaSpeedBPMScale); - rememberManiaScroll.Bindable = osuGame.Config.GetBindable(OsuConfig.UsePerBeatmapManiaSpeed); - } } } } \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Graphics/DetailOptions.cs b/osu.Game/Overlays/Options/Graphics/DetailOptions.cs index 14878128e3..f672a353de 100644 --- a/osu.Game/Overlays/Options/Graphics/DetailOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/DetailOptions.cs @@ -1,47 +1,58 @@ using osu.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Game.Configuration; -namespace osu.Game.Overlays.Options.Graphics -{ - public class DetailOptions : OptionsSubsection - { +namespace osu.Game.Overlays.Options.Graphics +{ + public class DetailOptions : OptionsSubsection + { protected override string Header => "Detail Settings"; - private CheckBoxOption snakingSliders, backgroundVideo, storyboards, comboBursts, - hitLighting, shaders, softeningFilter; - - public DetailOptions() - { - Children = new Drawable[] - { - snakingSliders = new CheckBoxOption { LabelText = "Snaking sliders" }, - backgroundVideo = new CheckBoxOption { LabelText = "Background video" }, - storyboards = new CheckBoxOption { LabelText = "Storyboards" }, - comboBursts = new CheckBoxOption { LabelText = "Combo bursts" }, - hitLighting = new CheckBoxOption { LabelText = "Hit lighting" }, - shaders = new CheckBoxOption { LabelText = "Shaders" }, - softeningFilter = new CheckBoxOption { LabelText = "Softening filter" }, - new SpriteText { Text = "Screenshot format TODO: dropdown" } - }; - } - - protected override void Load(BaseGame game) + [Initializer] + private void Load(OsuConfigManager config) { - base.Load(game); - var osuGame = game as OsuGameBase; - if (osuGame != null) + Children = new Drawable[] { - snakingSliders.Bindable = osuGame.Config.GetBindable(OsuConfig.SnakingSliders); - backgroundVideo.Bindable = osuGame.Config.GetBindable(OsuConfig.Video); - storyboards.Bindable = osuGame.Config.GetBindable(OsuConfig.ShowStoryboard); - comboBursts.Bindable = osuGame.Config.GetBindable(OsuConfig.ComboBurst); - hitLighting.Bindable = osuGame.Config.GetBindable(OsuConfig.HitLighting); - shaders.Bindable = osuGame.Config.GetBindable(OsuConfig.Bloom); - softeningFilter.Bindable = osuGame.Config.GetBindable(OsuConfig.BloomSoftening); - } - } - } + new CheckBoxOption + { + LabelText = "Snaking sliders", + Bindable = config.GetBindable(OsuConfig.SnakingSliders) + }, + new CheckBoxOption + { + LabelText = "Background video", + Bindable = config.GetBindable(OsuConfig.Video) + }, + new CheckBoxOption + { + LabelText = "Storyboards", + Bindable = config.GetBindable(OsuConfig.ShowStoryboard) + }, + new CheckBoxOption + { + LabelText = "Combo bursts", + Bindable = config.GetBindable(OsuConfig.ComboBurst) + }, + new CheckBoxOption + { + LabelText = "Hit lighting", + Bindable = config.GetBindable(OsuConfig.HitLighting) + }, + new CheckBoxOption + { + LabelText = "Shaders", + Bindable = config.GetBindable(OsuConfig.Bloom) + }, + new CheckBoxOption + { + LabelText = "Softening filter", + Bindable = config.GetBindable(OsuConfig.BloomSoftening) + }, + new SpriteText { Text = "Screenshot format TODO: dropdown" } + }; + } + } } \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs b/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs index 575d290286..3caf598a53 100644 --- a/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs @@ -1,4 +1,5 @@ using osu.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; @@ -10,31 +11,27 @@ namespace osu.Game.Overlays.Options.Graphics { protected override string Header => "Layout"; - private CheckBoxOption fullscreen, letterboxing; - - public LayoutOptions() - { - Children = new Drawable[] - { - new SpriteText { Text = "Resolution: TODO dropdown" }, - fullscreen = new CheckBoxOption { LabelText = "Fullscreen mode" }, - letterboxing = new CheckBoxOption { LabelText = "Letterboxing" }, - new SpriteText { Text = "Horizontal position" }, - new SpriteText { Text = "TODO: slider" }, - new SpriteText { Text = "Vertical position" }, - new SpriteText { Text = "TODO: slider" }, - }; - } - - protected override void Load(BaseGame game) + [Initializer] + private void Load(OsuConfigManager config) { - base.Load(game); - var osuGame = game as OsuGameBase; - if (osuGame != null) + Children = new Drawable[] { - fullscreen.Bindable = osuGame.Config.GetBindable(OsuConfig.Fullscreen); - letterboxing.Bindable = osuGame.Config.GetBindable(OsuConfig.Letterboxing); - } + new SpriteText { Text = "Resolution: TODO dropdown" }, + new CheckBoxOption + { + LabelText = "Fullscreen mode", + Bindable = config.GetBindable(OsuConfig.Fullscreen), + }, + new CheckBoxOption + { + LabelText = "Letterboxing", + Bindable = config.GetBindable(OsuConfig.Letterboxing), + }, + new SpriteText { Text = "Horizontal position" }, + new SpriteText { Text = "TODO: slider" }, + new SpriteText { Text = "Vertical position" }, + new SpriteText { Text = "TODO: slider" }, + }; } } } \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Graphics/MainMenuOptions.cs b/osu.Game/Overlays/Options/Graphics/MainMenuOptions.cs index 06429f1e61..0944ab401d 100644 --- a/osu.Game/Overlays/Options/Graphics/MainMenuOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/MainMenuOptions.cs @@ -1,39 +1,45 @@ using osu.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics.UserInterface; using osu.Game.Configuration; -namespace osu.Game.Overlays.Options.Graphics -{ - public class MainMenuOptions : OptionsSubsection - { +namespace osu.Game.Overlays.Options.Graphics +{ + public class MainMenuOptions : OptionsSubsection + { protected override string Header => "Main Menu"; - private CheckBoxOption snow, parallax, tips, voices, musicTheme; - - public MainMenuOptions() - { - Children = new[] - { - snow = new CheckBoxOption { LabelText = "Snow" }, - parallax = new CheckBoxOption { LabelText = "Parallax" }, - tips = new CheckBoxOption { LabelText = "Menu tips" }, - voices = new CheckBoxOption { LabelText = "Interface voices" }, - musicTheme = new CheckBoxOption { LabelText = "osu! music theme" }, - }; - } - - protected override void Load(BaseGame game) + [Initializer] + private void Load(OsuConfigManager config) { - base.Load(game); - var osuGame = game as OsuGameBase; - if (osuGame != null) + Children = new[] { - snow.Bindable = osuGame.Config.GetBindable(OsuConfig.MenuSnow); - parallax.Bindable = osuGame.Config.GetBindable(OsuConfig.MenuParallax); - tips.Bindable = osuGame.Config.GetBindable(OsuConfig.ShowMenuTips); - voices.Bindable = osuGame.Config.GetBindable(OsuConfig.MenuVoice); - musicTheme.Bindable = osuGame.Config.GetBindable(OsuConfig.MenuMusic); - } - } - } + new CheckBoxOption + { + LabelText = "Snow", + Bindable = config.GetBindable(OsuConfig.MenuSnow) + }, + new CheckBoxOption + { + LabelText = "Parallax", + Bindable = config.GetBindable(OsuConfig.MenuParallax) + }, + new CheckBoxOption + { + LabelText = "Menu tips", + Bindable = config.GetBindable(OsuConfig.ShowMenuTips) + }, + new CheckBoxOption + { + LabelText = "Interface voices", + Bindable = config.GetBindable(OsuConfig.MenuVoice) + }, + new CheckBoxOption + { + LabelText = "osu! music theme", + Bindable = config.GetBindable(OsuConfig.MenuMusic) + }, + }; + } + } } \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Graphics/RendererOptions.cs b/osu.Game/Overlays/Options/Graphics/RendererOptions.cs index 411bff4a81..ab3fd70d2a 100644 --- a/osu.Game/Overlays/Options/Graphics/RendererOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/RendererOptions.cs @@ -1,4 +1,5 @@ using osu.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; @@ -10,30 +11,29 @@ namespace osu.Game.Overlays.Options.Graphics { protected override string Header => "Renderer"; - private CheckBoxOption fpsCounter, reduceDroppedFrames, detectPerformanceIssues; - - public RendererOptions() - { - // NOTE: Compatability mode omitted - Children = new Drawable[] - { - new SpriteText { Text = "Frame limiter: TODO dropdown" }, - fpsCounter = new CheckBoxOption { LabelText = "Show FPS counter" }, - reduceDroppedFrames = new CheckBoxOption { LabelText = "Reduce dropped frames" }, - detectPerformanceIssues = new CheckBoxOption { LabelText = "Detect performance issues" }, - }; - } - - protected override void Load(BaseGame game) + [Initializer] + private void Load(OsuConfigManager config) { - base.Load(game); - var osuGame = game as OsuGameBase; - if (osuGame != null) + // NOTE: Compatability mode omitted + Children = new Drawable[] { - fpsCounter.Bindable = osuGame.Config.GetBindable(OsuConfig.FpsCounter); - reduceDroppedFrames.Bindable = osuGame.Config.GetBindable(OsuConfig.ForceFrameFlush); - detectPerformanceIssues.Bindable = osuGame.Config.GetBindable(OsuConfig.DetectPerformanceIssues); - } + new SpriteText { Text = "Frame limiter: TODO dropdown" }, + new CheckBoxOption + { + LabelText = "Show FPS counter", + Bindable = config.GetBindable(OsuConfig.FpsCounter), + }, + new CheckBoxOption + { + LabelText = "Reduce dropped frames", + Bindable = config.GetBindable(OsuConfig.ForceFrameFlush), + }, + new CheckBoxOption + { + LabelText = "Detect performance issues", + Bindable = config.GetBindable(OsuConfig.DetectPerformanceIssues), + }, + }; } } } \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Graphics/SongSelectGraphicsOptions.cs b/osu.Game/Overlays/Options/Graphics/SongSelectGraphicsOptions.cs index 044d9bfe96..76037a9d13 100644 --- a/osu.Game/Overlays/Options/Graphics/SongSelectGraphicsOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/SongSelectGraphicsOptions.cs @@ -1,31 +1,25 @@ using osu.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics.UserInterface; using osu.Game.Configuration; -namespace osu.Game.Overlays.Options.Graphics -{ - public class SongSelectGraphicsOptions : OptionsSubsection - { +namespace osu.Game.Overlays.Options.Graphics +{ + public class SongSelectGraphicsOptions : OptionsSubsection + { protected override string Header => "Song Select"; - - private CheckBoxOption showThumbs; - - public SongSelectGraphicsOptions() - { - Children = new[] - { - showThumbs = new CheckBoxOption { LabelText = "Show thumbnails" } - }; - } - protected override void Load(BaseGame game) + [Initializer] + private void Load(OsuConfigManager config) { - base.Load(game); - var osuGame = game as OsuGameBase; - if (osuGame != null) + Children = new[] { - showThumbs.Bindable = osuGame.Config.GetBindable(OsuConfig.SongSelectThumbnails); - } - } - } + new CheckBoxOption + { + LabelText = "Show thumbnails", + Bindable = config.GetBindable(OsuConfig.SongSelectThumbnails) + } + }; + } + } } \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Input/MouseOptions.cs b/osu.Game/Overlays/Options/Input/MouseOptions.cs index 419aecc675..960ef77af8 100644 --- a/osu.Game/Overlays/Options/Input/MouseOptions.cs +++ b/osu.Game/Overlays/Options/Input/MouseOptions.cs @@ -1,43 +1,55 @@ using osu.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Game.Configuration; -namespace osu.Game.Overlays.Options.Input -{ - public class MouseOptions : OptionsSubsection - { +namespace osu.Game.Overlays.Options.Input +{ + public class MouseOptions : OptionsSubsection + { protected override string Header => "Mouse"; - private CheckBoxOption rawInput, mapRawInput, disableWheel, disableButtons, enableRipples; - - public MouseOptions() - { - Children = new Drawable[] - { - new SpriteText { Text = "Sensitivity: TODO slider" }, - rawInput = new CheckBoxOption { LabelText = "Raw input" }, - mapRawInput = new CheckBoxOption { LabelText = "Map absolute raw input to the osu! window" }, - new SpriteText { Text = "Confine mouse cursor: TODO dropdown" }, - disableWheel = new CheckBoxOption { LabelText = "Disable mouse wheel in play mode" }, - disableButtons = new CheckBoxOption { LabelText = "Disable mouse buttons in play mode" }, - enableRipples = new CheckBoxOption { LabelText = "Cursor ripples" }, - }; + private CheckBoxOption rawInput, mapRawInput, disableWheel, disableButtons, enableRipples; + + public MouseOptions() + { } - protected override void Load(BaseGame game) + [Initializer] + private void Load(OsuConfigManager config) { - base.Load(game); - var osuGame = game as OsuGameBase; - if (osuGame != null) + Children = new Drawable[] { - rawInput.Bindable = osuGame.Config.GetBindable(OsuConfig.RawInput); - mapRawInput.Bindable = osuGame.Config.GetBindable(OsuConfig.AbsoluteToOsuWindow); - disableWheel.Bindable = osuGame.Config.GetBindable(OsuConfig.MouseDisableWheel); - disableButtons.Bindable = osuGame.Config.GetBindable(OsuConfig.MouseDisableButtons); - enableRipples.Bindable = osuGame.Config.GetBindable(OsuConfig.CursorRipple); - } - } - } + new SpriteText { Text = "Sensitivity: TODO slider" }, + new CheckBoxOption + { + LabelText = "Raw input", + Bindable = config.GetBindable(OsuConfig.RawInput) + }, + new CheckBoxOption + { + LabelText = "Map absolute raw input to the osu! window", + Bindable = config.GetBindable(OsuConfig.AbsoluteToOsuWindow) + }, + new SpriteText { Text = "Confine mouse cursor: TODO dropdown" }, + new CheckBoxOption + { + LabelText = "Disable mouse wheel in play mode", + Bindable = config.GetBindable(OsuConfig.MouseDisableWheel) + }, + new CheckBoxOption + { + LabelText = "Disable mouse buttons in play mode", + Bindable = config.GetBindable(OsuConfig.MouseDisableButtons) + }, + new CheckBoxOption + { + LabelText = "Cursor ripples", + Bindable = config.GetBindable(OsuConfig.CursorRipple) + }, + }; + } + } } \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Input/OtherInputOptions.cs b/osu.Game/Overlays/Options/Input/OtherInputOptions.cs index a24009454b..64729f7e47 100644 --- a/osu.Game/Overlays/Options/Input/OtherInputOptions.cs +++ b/osu.Game/Overlays/Options/Input/OtherInputOptions.cs @@ -1,35 +1,32 @@ using osu.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; using osu.Game.Configuration; -namespace osu.Game.Overlays.Options.Input -{ - public class OtherInputOptions : OptionsSubsection - { +namespace osu.Game.Overlays.Options.Input +{ + public class OtherInputOptions : OptionsSubsection + { protected override string Header => "Other"; - private CheckBoxOption tabletSupport, wiimoteSupport; - - public OtherInputOptions() - { - Children = new Drawable[] - { - tabletSupport = new CheckBoxOption { LabelText = "OS TabletPC support" }, - wiimoteSupport = new CheckBoxOption { LabelText = "Wiimote/TaTaCon Drum Support" }, - }; - } - - protected override void Load(BaseGame game) + [Initializer] + private void Load(OsuConfigManager config) { - base.Load(game); - var osuGame = game as OsuGameBase; - if (osuGame != null) + Children = new Drawable[] { - tabletSupport.Bindable = osuGame.Config.GetBindable(OsuConfig.Tablet); - wiimoteSupport.Bindable = osuGame.Config.GetBindable(OsuConfig.Wiimote); - } - } - } -} - + new CheckBoxOption + { + LabelText = "OS TabletPC support", + Bindable = config.GetBindable(OsuConfig.Tablet) + }, + new CheckBoxOption + { + LabelText = "Wiimote/TaTaCon Drum Support", + Bindable = config.GetBindable(OsuConfig.Wiimote) + }, + }; + } + } +} + diff --git a/osu.Game/Overlays/Options/Online/InGameChatOptions.cs b/osu.Game/Overlays/Options/Online/InGameChatOptions.cs index 29316b60fc..cca3843278 100644 --- a/osu.Game/Overlays/Options/Online/InGameChatOptions.cs +++ b/osu.Game/Overlays/Options/Online/InGameChatOptions.cs @@ -1,43 +1,46 @@ -using osu.Framework; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.UserInterface; -using osu.Game.Configuration; - +using osu.Framework; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; +using osu.Game.Configuration; + namespace osu.Game.Overlays.Options.Online { public class InGameChatOptions : OptionsSubsection { - protected override string Header => "In-game Chat"; - - private CheckBoxOption filterWords, filterForeign, logPMs, blockPMs; + protected override string Header => "In-game Chat"; - public InGameChatOptions() + [Initializer] + private void Load(OsuConfigManager config) { Children = new Drawable[] { - filterWords = new CheckBoxOption { LabelText = "Filter offensive words" }, - filterForeign = new CheckBoxOption { LabelText = "Filter foreign characters" }, - logPMs = new CheckBoxOption { LabelText = "Log private messages" }, - blockPMs = new CheckBoxOption { LabelText = "Block private messages from non-friends" }, + new CheckBoxOption + { + LabelText = "Filter offensive words", + Bindable = config.GetBindable(OsuConfig.ChatFilter) + }, + new CheckBoxOption + { + LabelText = "Filter foreign characters", + Bindable = config.GetBindable(OsuConfig.ChatRemoveForeign) + }, + new CheckBoxOption + { + LabelText = "Log private messages", + Bindable = config.GetBindable(OsuConfig.LogPrivateMessages) + }, + new CheckBoxOption + { + LabelText = "Block private messages from non-friends", + Bindable = config.GetBindable(OsuConfig.BlockNonFriendPM) + }, new SpriteText { Text = "Chat ignore list (space-seperated list)" }, new TextBox { Height = 20, RelativeSizeAxes = Axes.X }, new SpriteText { Text = "Chat highlight words (space-seperated list)" }, new TextBox { Height = 20, RelativeSizeAxes = Axes.X }, }; - } - - protected override void Load(BaseGame game) - { - base.Load(game); - var osuGame = game as OsuGameBase; - if (osuGame != null) - { - filterWords.Bindable = osuGame.Config.GetBindable(OsuConfig.ChatFilter); - filterForeign.Bindable = osuGame.Config.GetBindable(OsuConfig.ChatRemoveForeign); - logPMs.Bindable = osuGame.Config.GetBindable(OsuConfig.LogPrivateMessages); - blockPMs.Bindable = osuGame.Config.GetBindable(OsuConfig.BlockNonFriendPM); - } } } } \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Online/NotificationsOptions.cs b/osu.Game/Overlays/Options/Online/NotificationsOptions.cs index 0520579f6e..6ed4aed016 100644 --- a/osu.Game/Overlays/Options/Online/NotificationsOptions.cs +++ b/osu.Game/Overlays/Options/Online/NotificationsOptions.cs @@ -1,4 +1,5 @@ using osu.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; using osu.Game.Configuration; @@ -9,35 +10,42 @@ namespace osu.Game.Overlays.Options.Online { protected override string Header => "Notifications"; - private CheckBoxOption chatTicker, notifyMention, notifyChat, audibleNotification, - notificationsDuringGameplay, notifyFriendStatus; - - public NotificationsOptions() + [Initializer] + private void Load(OsuConfigManager config) { Children = new Drawable[] { - chatTicker = new CheckBoxOption { LabelText = "Enable chat ticker" }, - notifyMention = new CheckBoxOption { LabelText = "Show a notification popup when someone says your name" }, - notifyChat = new CheckBoxOption { LabelText = "Show chat message notifications" }, - audibleNotification = new CheckBoxOption { LabelText = "Play a sound when someone says your name" }, - notificationsDuringGameplay = new CheckBoxOption { LabelText = "Show notification popups instantly during gameplay" }, - notifyFriendStatus = new CheckBoxOption { LabelText = "Show notification popups when friends change status" }, + new CheckBoxOption + { + LabelText = "Enable chat ticker", + Bindable = config.GetBindable(OsuConfig.Ticker) + }, + new CheckBoxOption + { + LabelText = "Show a notification popup when someone says your name", + Bindable = config.GetBindable(OsuConfig.ChatHighlightName) + }, + new CheckBoxOption + { + LabelText = "Show chat message notifications", + Bindable = config.GetBindable(OsuConfig.ChatMessageNotification) + }, + new CheckBoxOption + { + LabelText = "Play a sound when someone says your name", + Bindable = config.GetBindable(OsuConfig.ChatAudibleHighlight) + }, + new CheckBoxOption + { + LabelText = "Show notification popups instantly during gameplay", + Bindable = config.GetBindable(OsuConfig.PopupDuringGameplay) + }, + new CheckBoxOption + { + LabelText = "Show notification popups when friends change status", + Bindable = config.GetBindable(OsuConfig.NotifyFriends) + }, }; } - - protected override void Load(BaseGame game) - { - base.Load(game); - var osuGame = game as OsuGameBase; - if (osuGame != null) - { - chatTicker.Bindable = osuGame.Config.GetBindable(OsuConfig.Ticker); - notifyMention.Bindable = osuGame.Config.GetBindable(OsuConfig.ChatHighlightName); - notifyChat.Bindable = osuGame.Config.GetBindable(OsuConfig.ChatMessageNotification); - audibleNotification.Bindable = osuGame.Config.GetBindable(OsuConfig.ChatAudibleHighlight); - notificationsDuringGameplay.Bindable = osuGame.Config.GetBindable(OsuConfig.PopupDuringGameplay); - notifyFriendStatus.Bindable = osuGame.Config.GetBindable(OsuConfig.NotifyFriends); - } - } } } \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Online/OnlineIntegrationOptions.cs b/osu.Game/Overlays/Options/Online/OnlineIntegrationOptions.cs index 4b50914b7e..46f93acd58 100644 --- a/osu.Game/Overlays/Options/Online/OnlineIntegrationOptions.cs +++ b/osu.Game/Overlays/Options/Online/OnlineIntegrationOptions.cs @@ -1,38 +1,41 @@ using osu.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; using osu.Game.Configuration; -namespace osu.Game.Overlays.Options.Online -{ - public class OnlineIntegrationOptions : OptionsSubsection - { +namespace osu.Game.Overlays.Options.Online +{ + public class OnlineIntegrationOptions : OptionsSubsection + { protected override string Header => "Integration"; - private CheckBoxOption yahoo, msn, autoDirect, noVideo; - - public OnlineIntegrationOptions() - { - Children = new Drawable[] - { - yahoo = new CheckBoxOption { LabelText = "Integrate with Yahoo! status display" }, - msn = new CheckBoxOption { LabelText = "Integrate with MSN Live status display" }, - autoDirect = new CheckBoxOption { LabelText = "Automatically start osu!direct downloads" }, - noVideo = new CheckBoxOption { LabelText = "Prefer no-video downloads" }, - }; - } - - protected override void Load(BaseGame game) + [Initializer] + private void Load(OsuConfigManager config) { - base.Load(game); - var osuGame = game as OsuGameBase; - if (osuGame != null) + Children = new Drawable[] { - yahoo.Bindable = osuGame.Config.GetBindable(OsuConfig.YahooIntegration); - msn.Bindable = osuGame.Config.GetBindable(OsuConfig.MsnIntegration); - autoDirect.Bindable = osuGame.Config.GetBindable(OsuConfig.AutomaticDownload); - noVideo.Bindable = osuGame.Config.GetBindable(OsuConfig.AutomaticDownloadNoVideo); - } - } - } + new CheckBoxOption + { + LabelText = "Integrate with Yahoo! status display", + Bindable = config.GetBindable(OsuConfig.YahooIntegration) + }, + new CheckBoxOption + { + LabelText = "Integrate with MSN Live status display", + Bindable = config.GetBindable(OsuConfig.MsnIntegration) + }, + new CheckBoxOption + { + LabelText = "Automatically start osu!direct downloads", + Bindable = config.GetBindable(OsuConfig.AutomaticDownload) + }, + new CheckBoxOption + { + LabelText = "Prefer no-video downloads", + Bindable = config.GetBindable(OsuConfig.AutomaticDownloadNoVideo) + }, + }; + } + } } \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Online/PrivacyOptions.cs b/osu.Game/Overlays/Options/Online/PrivacyOptions.cs index 35880c5627..711272652b 100644 --- a/osu.Game/Overlays/Options/Online/PrivacyOptions.cs +++ b/osu.Game/Overlays/Options/Online/PrivacyOptions.cs @@ -1,4 +1,5 @@ using osu.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; using osu.Game.Configuration; @@ -8,27 +9,23 @@ namespace osu.Game.Overlays.Options.Online public class PrivacyOptions : OptionsSubsection { protected override string Header => "Privacy"; - - private CheckBoxOption shareCity, allowInvites; - public PrivacyOptions() + [Initializer] + private void Load(OsuConfigManager config) { Children = new Drawable[] { - shareCity = new CheckBoxOption { LabelText = "Share your city location with others" }, - allowInvites = new CheckBoxOption { LabelText = "Allow multiplayer game invites from all users" }, + new CheckBoxOption + { + LabelText = "Share your city location with others", + Bindable = config.GetBindable(OsuConfig.DisplayCityLocation) + }, + new CheckBoxOption + { + LabelText = "Allow multiplayer game invites from all users", + Bindable = config.GetBindable(OsuConfig.AllowPublicInvites) + }, }; } - - protected override void Load(BaseGame game) - { - base.Load(game); - var osuGame = game as OsuGameBase; - if (osuGame != null) - { - shareCity.Bindable = osuGame.Config.GetBindable(OsuConfig.DisplayCityLocation); - allowInvites.Bindable = osuGame.Config.GetBindable(OsuConfig.AllowPublicInvites); - } - } } } \ No newline at end of file diff --git a/osu.Game/Overlays/Options/SkinSection.cs b/osu.Game/Overlays/Options/SkinSection.cs index 12f55aafd1..7475ec9e5f 100644 --- a/osu.Game/Overlays/Options/SkinSection.cs +++ b/osu.Game/Overlays/Options/SkinSection.cs @@ -1,22 +1,22 @@ -using OpenTK; -using osu.Framework; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.UserInterface; -using osu.Game.Configuration; -using osu.Game.Graphics; -using osu.Game.Graphics.UserInterface; - +using OpenTK; +using osu.Framework; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; +using osu.Game.Configuration; +using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; + namespace osu.Game.Overlays.Options { public class SkinSection : OptionsSection { protected override string Header => "Skin"; - public override FontAwesome Icon => FontAwesome.fa_paint_brush; - - private CheckBoxOption ignoreSkins, useSkinSoundSamples, useTaikoSkin, useSkinCursor, autoCursorSize; - - public SkinSection() + public override FontAwesome Icon => FontAwesome.fa_paint_brush; + + [Initializer] + private void Load(OsuConfigManager config) { content.Spacing = new Vector2(0, 5); Children = new Drawable[] @@ -38,27 +38,33 @@ namespace osu.Game.Overlays.Options RelativeSizeAxes = Axes.X, Text = "Export as .osk", }, - ignoreSkins = new CheckBoxOption { LabelText = "Ignore all beatmap skins" }, - useSkinSoundSamples = new CheckBoxOption { LabelText = "Use skin's sound samples" }, - useTaikoSkin = new CheckBoxOption { LabelText = "Use Taiko skin for Taiko mode" }, - useSkinCursor = new CheckBoxOption { LabelText = "Always use skin cursor" }, + new CheckBoxOption + { + LabelText = "Ignore all beatmap skins", + Bindable = config.GetBindable(OsuConfig.IgnoreBeatmapSkins) + }, + new CheckBoxOption + { + LabelText = "Use skin's sound samples", + Bindable = config.GetBindable(OsuConfig.SkinSamples) + }, + new CheckBoxOption + { + LabelText = "Use Taiko skin for Taiko mode", + Bindable = config.GetBindable(OsuConfig.UseTaikoSkin) + }, + new CheckBoxOption + { + LabelText = "Always use skin cursor", + Bindable = config.GetBindable(OsuConfig.UseSkinCursor) + }, new SpriteText { Text = "Cursor size: TODO slider" }, - autoCursorSize = new CheckBoxOption { LabelText = "Automatic cursor size" }, + new CheckBoxOption + { + LabelText = "Automatic cursor size", + Bindable = config.GetBindable(OsuConfig.AutomaticCursorSizing) + }, }; - } - - protected override void Load(BaseGame game) - { - base.Load(game); - var osuGame = game as OsuGameBase; - if (osuGame != null) - { - ignoreSkins.Bindable = osuGame.Config.GetBindable(OsuConfig.IgnoreBeatmapSkins); - useSkinSoundSamples.Bindable = osuGame.Config.GetBindable(OsuConfig.SkinSamples); - useTaikoSkin.Bindable = osuGame.Config.GetBindable(OsuConfig.UseTaikoSkin); - useSkinCursor.Bindable = osuGame.Config.GetBindable(OsuConfig.UseSkinCursor); - autoCursorSize.Bindable = osuGame.Config.GetBindable(OsuConfig.AutomaticCursorSizing); - } } } } \ No newline at end of file